From: Operating system: CentOs PHP version: Irrelevant Package: MySQLi related Bug Type: Bug Bug description:Connection not closed on thrown exception, E_ERROR
Description: ------------ PHP version is 5.1.6 I haven't had the chance to run on newer versions but I suspect it's a persistent structural bug; What happens is MySQLi connection is not closed when script ends if it terminates due to a raised exception or an E_ERROR. This causes a number of problems from filling connection pool (mild) to blocking transactions (severe). The connection is never closed until reset by mysql server. For exceptions, there is the workaround of manually closing the connection in a default exception handler, but for E_ERROR I couldn't find any closing protocol. If this has been fixed in the later releases please be so kind to ignore this. However I suspect otherwise since I could find no discussions related to this. At the moment I don't have time to test with another release. Test script: --------------- mysqli_connect($db_host,$db_user,$db_password); throw new Exception(); Expected result: ---------------- When a script terminates (especially when crashed) all resources should be freed: all open handles, tcp connections, etc. I realize there is a problem with persistent connection handling, but a way should be found to clean up the mess; otherwise one script can trash the whole server by blocking transactions. Actual result: -------------- Connection lingers. -- Edit bug report at http://bugs.php.net/bug.php?id=52249&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52249&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52249&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52249&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52249&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52249&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52249&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52249&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52249&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52249&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52249&r=support Expected behavior: http://bugs.php.net/fix.php?id=52249&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52249&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52249&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52249&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52249&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52249&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52249&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52249&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52249&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52249&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52249&r=mysqlcfg