From:             tsr2600 at gmail dot com
Operating system: FreeBSD 6.1
PHP version:      5.1.4
PHP Bug Type:     MySQLi related
Bug description:  MySQLi connection is not cleaned up properly

Description:
------------
When a MySQLi resource is created, a fatal error or exception (possibly
others) will result in the script terminating but MySQL's SHOW
PROCESSLIST; will report a "Reading from net" state indefinitely for as
many connections as were created before script termination.  These
connections will be accumulated until MySQL fails with too many
connections.

This only occurs when PHP is running as an Apache module, it does not
occur when PHP is running from the command line.  Also, this does not
occur with the MySQL PHP functions, only MySQLi.

I have tested this on:

FreeBSD 6.1, PHP 5.1.4, Apache 2.0.58, MySQL 4.0.19
Gentoo, PHP 5.1.4, Apache 2.2.0, MySQL 4.0.19

Reproduce code:
---------------
<?php

$dbh = mysqli_connect($any, $valid, $params, $work);

some_undefined_function_resulting_in_error();

?>

Expected result:
----------------
A fatal error, telling me that I made a call to an undefined function.  I
expect no residual MySQLi connections.

Actual result:
--------------
A fatal error, telling me that I made a call to an undefined function. 
However, I still have a residual MySQLi connection, as reported by MySQL's
SHOW PROCESSLIST;

-- 
Edit bug report at http://bugs.php.net/?id=37560&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37560&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=37560&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37560&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37560&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=37560&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37560&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37560&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37560&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37560&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37560&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=37560&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=37560&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37560&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37560&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37560&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37560&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37560&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37560&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37560&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37560&r=mysqlcfg

Reply via email to