|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2006-10-03 19:43 UTC] tony2001@php.net
  [2006-10-03 19:53 UTC] kiranm at hp dot com
  [2006-10-03 19:56 UTC] tony2001@php.net
  [2006-10-03 20:26 UTC] kiranm at hp dot com
  [2006-10-03 20:47 UTC] tony2001@php.net
  [2006-10-03 23:54 UTC] kiranm at hp dot com
  [2006-10-11 19:50 UTC] kiranm at hp dot com
  [2006-10-11 20:13 UTC] tony2001@php.net
 | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 15:00:01 2025 UTC | 
Description: ------------ I have a small script : <html> <body> <?php $db = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP) (HOST = <oracleserver>)(PORT=1521)) (CONNECT_DATA=(SERVER=DEDICATED) (SERVICE_NAME=TEST)))"; $connection = oci_pconnect("scott","tiger",$db); $stmt = OCIParse($connection, "select * from ALL_USERS"); OCIExecute($stmt); while(OCIFetch($stmt)) echo OCIResult($stmt,"USERNAME")."<BR>\n"; echo "\n"; ?> </body> </html> I use the Apache worker model. The php.ini file has the following parameters set : [Oci8] oci8.max_persistent=1 oci8.persistent_timeout=10 oci8.ping_interval=0 When I use the Apache bench (ab) tool to run the above script 1000 times, I get about 50 connections opened with Oracle. I tested this by executing : netstat -an | grep 1521 After the timeout of 10 secs, when I run netstat again, I find all the connections still open. When I reissued the ab request, I found that no new connections are established and that the old connections were used. I used tusc/truss tool to check this out. Reproduce code: --------------- I went through the code and did not find any active housekeeping that is done to terminate connections that have passed the timeout. The decision to use an existing connection or a new connection seems to be something that is made when there is a new request. In the php_oci_persistent_helper() function, I found that connection->idle_expiry is compared with the timestamp only when the connection is not used. So that part of the code does not get executed when there is already an open connection even when the timeout has expired. I think this check should be made always otherwise persistent connections will continue to get used. I changed it on my machine and it works as expected. Expected result: ---------------- Persistent connections should expire after timeout or at the least when there is a new request after the timeout period has elapsed. Actual result: -------------- Persistent connections continue to exist and be used even after the specified timeout.