php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52249 Connection not closed on thrown exception, E_ERROR
Submitted: 2010-07-05 09:47 UTC Modified: 2013-02-18 00:34 UTC
From: dinumarina at gmail dot com Assigned:
Status: No Feedback Package: MySQLi related
PHP Version: Irrelevant OS: CentOs
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dinumarina at gmail dot com
New email:
PHP Version: OS:

 

 [2010-07-05 09:47 UTC] 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-05 10:18 UTC] johannes@php.net
-Status: Open +Status: Feedback
 [2010-07-05 10:18 UTC] johannes@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 11:39 UTC] dinumarina at gmail dot com
-Status: Feedback +Status: Open
 [2010-07-05 11:39 UTC] 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 12:00 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-07-05 12:00 UTC] pajoye@php.net
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).
 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC