Bug #75419 [NEW]: Database connection not garbage collected
| From: | abedi at xento dot com | Date: | Mon, 23 Oct 2017 15:10:29 +0000 |
| Subject: | Bug #75419 [NEW]: Database connection not garbage collected | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-211858@lists.php.net to get a copy of this message | ||
From: abedi at xento dot com
Operating system: Ubuntu 16/Windows 10
PHP version: 7.1.10
Package: PostgreSQL related
Bug Type: Bug
Bug description:Database connection not garbage collected
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 bug report at https://bugs.php.net/bug.php?id=75419&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75419&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75419&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75419&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75419&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75419&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75419&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75419&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75419&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75419&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75419&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75419&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75419&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75419&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75419&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75419&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75419&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75419&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75419&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75419&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75419&r=mysqlcfg