php.net |  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
Votes:1
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 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: ianbytchek at gmail dot com
New email:
PHP Version: OS:

 

 [2014-11-06 07:05 UTC] ianbytchek at gmail dot com
Description:
------------
The comment http://php.net/manual/en/pdo.connections.php#114822 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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-11-07 12:55 UTC] aharvey@php.net
-Status: Open +Status: Feedback
 [2014-11-07 12:55 UTC] aharvey@php.net
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] aharvey@php.net
-Status: Closed +Status: Not a bug
 [2015-03-09 21:37 UTC] aharvey@php.net
No worries; thanks for getting back to us!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 02 14:01:29 2024 UTC