Bug #75419 [Opn->Asn]: Database connection not garbage collected
| From: | pollita@php.net | Date: | Mon, 23 Oct 2017 18:10:12 +0000 |
| Subject: | Bug #75419 [Opn->Asn]: Database connection not garbage collected | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-211859@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75419&edit=1
ID: 75419
Updated by: pollita@php.net
Reported by: abedi at xento dot com
Summary: Database connection not garbage collected
-Status: Open
+Status: Assigned
Type: Bug
Package: PostgreSQL related
Operating System: Ubuntu 16/Windows 10
PHP Version: 7.1.10
-Assigned To:
+Assigned To: pollita
Block user comment: N
Private report: N
New Comment:
I can see what happened and should have a fix soon.
Basically, every extension needed to be touched for the PHP 7 API changes and some logic got flipped
in PGSQL's "default link" handling.
Previous Comments:
------------------------------------------------------------------------
[2017-10-23 15:10:24] abedi at xento dot com
Description:
------------
Multiple database connections opened via pg_connect are not being garage collected & closed.
Test script:
---------------
<?php
$dbLink1 = pg_connect( "host=localhost port=5432 dbname=development",
PGSQL_CONNECT_FORCE_NEW );
pg_query($dbLink1, 'select 1; /*FIRST*/');
$dbLink2 = pg_connect( "host=localhost port=5432 dbname=development",
PGSQL_CONNECT_FORCE_NEW );
pg_query($dbLink2, 'select 1; /*SECOND*/');
/*closing first link*/
pg_close($dbLink1);
$dbLink2 = pg_connect( "host=localhost port=5432 dbname=development",
PGSQL_CONNECT_FORCE_NEW );
pg_query($dbLink2, 'select 1; /*THIRD*/');
/*2nd 3rd connection remain idle on the database connection as long as the scripts is alive, the 2nd
connection overridden by $dbLink2 should be automatically destroyed*/
sleep(200);
?>
Expected result:
----------------
Only one connection referenced by $dbLink2 should be open on the database. The problem doesn't
appear on earlier versions of php 5, works fine in php 5.5, 5.6 and the database correctly reports
only 1 connection idle
Actual result:
--------------
2 open idle connections reported on the database on any PHP 7.X version,
#1. idle connection for the query of select 1; /*SECOND*/
#2. idle connection for the query of select 1; /*THIRD*/
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75419&edit=1