php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57963 oci_pconnect opens multiple database session
Submitted: 2007-12-11 17:11 UTC Modified: 2007-12-11 17:18 UTC
From: cherr at vt dot edu Assigned:
Status: Not a bug Package: oci8 (PECL)
PHP Version: 5.2.1 OS: RHEL
Private report: No CVE-ID: None
 [2007-12-11 17:11 UTC] cherr at vt dot edu
Description:
------------
PHP - 5.2.3
Oracle HTTP Server 10.1.2 (as a part of the Oracle Forms and Reports 10.1.2 standalone)
HTTPS configured with Thawte Premium Server Cert using Oracle Wallet
ZendCore 2.0
oci (version according to ZendCore) 10.1-1.


When using oci_pconnect, multiple database sessions are opened.  For instance, I load the page initially.  Then, I go to another page with similar code, or refresh the same page, and the Oracle SESSIONID is different.  This prohibits any effective VPD implementation.

Using HTTPS, also occasionally generates a strange error: SSL call to function nzos_Handshake fails with error 29014 (client_ip:port)

KeepAlive and any timeout related stuff set to 600 (10 min timeouts) or 0 (unlimited connections)



Reproduce code:
---------------
<?php

   $conn = @oci_pconnect('scott', 'tiger', 'mydb');
   $query = "select sys_context('USERENV','SESSIONID') from dual";
   $stid = oci_parse($_SESSION['conn'], $query);
   $results = oci_execute($stid, OCI_DEFAULT);
   $row = oci_fetch_array($stid);
   echo $row[0];

?>

Expected result:
----------------
SESSIONID#1
(refresh page)
SESSIONID#1
(visit another page)
SESSIONID#1
(refresh page)
SESSIONID#1


Actual result:
--------------
SESSIONID#1
(refresh page)
SESSIONID#1 or #2 (i.e. sometimes not the same sessionid, sometimes is the same)
(refresh page)
SESSIONID#1 or #2
(visit another page)
SESSIONID#1 or #2
(refresh other page)
SESSIONID#1 or #2
(visit original page
SESSIONID#1 or #2
and so on

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-11 17:15 UTC] christopher dot jones at oracle dot com
Thank you for taking the time to write to us, but this is not
a bug.

Each different HTTP server process that handles a request will open it's own connection to the database.  PHP doesn't share resources across processes.

If you have a reproducible test case for the SSL issue, please open a separate bug.
 [2007-12-11 17:18 UTC] tony at daylessday dot org
Persistent connections are kept in Apache childs.
Say, your first request is handled by one child and the next one is handled by another one -> you have TWO open persistent connections.
This number may grow up to the number of Apache childs.
Though persistent connections are reused when they already exist in this particular Apache process.

See more details here: http://www.php.net/manual/en/features.persistent-connections.php

Please report SSL errors to Oracle (or whoever maintains the Oracle HTTP Server nowadays).
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 18:01:25 2019 UTC