php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61502 pdo_oci persistent connections broken with Oracle 9.2 servers
Submitted: 2012-03-24 22:55 UTC Modified: 2021-06-20 04:22 UTC
From: andre at tomt dot net Assigned: cmb (profile)
Status: No Feedback Package: PDO OCI
PHP Version: 5.4.0 OS: Ubuntu 12.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
41 + 50 = ?
Subscribe to this entry?

 
 [2012-03-24 22:55 UTC] andre at tomt dot net
Description:
------------
I've only verified this in PHP 5.3.10, but I checked that the relevant code has not changed in git/master.

Enabling persistent connection to Oracle 9.2 servers does not work. The server seem to brutally kill the connection on OCIPing, a function the code in ext/pdo/oci_driver.c:pdo_oci_check_liveness() assumes will fail gracefully on older Oracle versions.

This makes the error_code == 1010 check fail and it will (now correctly) re-connect to the server, saving the day by not failing in a user-visible way, but however rendering persistent connections to 9.2 servers useless and adding ~900ms of extra latency (in our case).

I tried extending the check to the resulting 3113 (end-of-file on communication channel) error, but it turned out the connection really is dead at that point.

Is there really any downside to just using OCIServerVersion instead of OCIPing?

Test script:
---------------
<?php
$pdo = new PDO(
  'oci:dbname=//dbserver/dbname', 
  'user',
  'pass',
  array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_PERSISTENT => true)
);

?>

Expected result:
----------------
connections not beeing re-established (source port numbers in netstat -anp not changing)

Actual result:
--------------
connections beeing re-established (source port numbers in netstat -anp changing), incurring a large latency penalty.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-26 17:47 UTC] sixd@php.net
Check you have the latest Oracle DB patchset 9.2.0.8 and latest Oracle
11.2 client.  Look for Oracle traces.  Utilize Oracle Support to
identify the cause and find a remedy.  I've not seen other reports of
problems.  Does the OCI8 extension have the same problem?

OCIServerVersion and OCIPing check different things.  The latter can
check more to provide better reliability.  If your same PHP code
connects to multiple Oracle DB versions, perhaps you could modify the
PDO_OCI source and add a runtime check to determine which function to
use?

Oracle 9.2 was released in 2002. Oracle's Extended Support for it
finished in 2010.  (Ref:
http://www.oracle.com/us/support/library/lifetime-support-technology-
069183.pdf)

The PDO_OCI extension currently does not have a maintainer.  The
OCI8 extension does, and has better functionality.  Using OCI8
is preferred.
 [2014-01-01 12:39 UTC] felipe@php.net
-Package: PDO related +Package: PDO OCI
 [2021-06-09 10:56 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-06-09 10:56 UTC] cmb@php.net
Any news here?
 [2021-06-20 04:22 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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 09:01:28 2024 UTC