|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68360 PDO PgSQL doesn't disconnect as expected
Submitted: 2014-11-06 07:05 UTC Modified: 2015-03-09 21:37 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: ianbytchek at gmail dot com Assigned:
Status: Not a bug Package: PDO PgSQL
PHP Version: 5.6.2 OS: OS X 10.10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: ianbytchek at gmail dot com
New email:
PHP Version: OS:


 [2014-11-06 07:05 UTC] ianbytchek at gmail dot com
The comment makes a very valid point. When we use the suggested method of dropping the connection by doing 

$pdo = null;

The connection doesn't get dropped as described in the documentation. I stumbled across this issue when running a few hundred PHPUnit tests, which resulted in PostgreSQL running out of available connections after 150's test. I migrated from MySQL recently, which didn't have that problem. The default number of available connections is 150 for both systems.

The workaround is to use gc_collect_cycles() after unsetting the $pdo. However, the disconnection should happen immediately after unsetting the variable, not when the GC gets invoked.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-11-07 12:55 UTC]
-Status: Open +Status: Feedback
 [2014-11-07 12:55 UTC]
Are you sure that you don't have another reference to the object kicking around? What output do you get if you call debug_zval_dump($pdo); immediately before setting it to NULL?
 [2014-12-30 10:42 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 "Re-Opened". Thank you.
 [2015-03-07 18:04 UTC] ianbytchek at gmail dot com
-Status: No Feedback +Status: Closed
 [2015-03-07 18:04 UTC] ianbytchek at gmail dot com
This turned out to be caused by another framework (phalcon), sorry, wasn't the most obvious thing. Tried without phalcon on the 5.6.6, works as expected.
 [2015-03-09 21:37 UTC]
-Status: Closed +Status: Not a bug
 [2015-03-09 21:37 UTC]
No worries; thanks for getting back to us!
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 04:01:31 2024 UTC