Edit report at http://bugs.php.net/bug.php?id=52249&edit=1
ID: 52249 Updated by: paj...@php.net Reported by: dinumarina at gmail dot com Summary: Connection not closed on thrown exception, E_ERROR -Status: Open +Status: Feedback Type: Bug Package: MySQLi related Operating System: CentOs PHP Version: Irrelevant New Comment: If you are in a hurry, then test it with a decent version (5.2.13 or 5.2.14RC2, 5.3.2 or 5.3.3RC2). Previous Comments: ------------------------------------------------------------------------ [2010-07-05 11:39:35] dinumarina at gmail dot com Hi, Do you expect it will fix it or just for test? I'm really pressed with time. ------------------------------------------------------------------------ [2010-07-05 10:18:18] johan...@php.net Please try using this snapshot: http://snaps.php.net/php5.3-latest.tar.gz For Windows: http://windows.php.net/snapshots/ ------------------------------------------------------------------------ [2010-07-05 09:47:18] dinumarina at gmail dot com 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 this bug report at http://bugs.php.net/bug.php?id=52249&edit=1