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: 2014-01-01 12:39 UTC
From: andre at tomt dot net Assigned:
Status: Open Package: PDO OCI
PHP Version: 5.4.0 OS: Ubuntu 12.04
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [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
 [2016-04-21 10:07 UTC] 34557049 at qq dot com
WINDOW 64BIT APACHE2.4 PHP Version 5.5.12 

class LocalSoapClient extends \SoapClient
{
    public $server = '';

    function __construct($wsdl, $options) {
        parent::__construct($wsdl, $options);
        $this->server = new \SoapServer($wsdl, $options);
        // $this->server->addFunction('Add');
        $this->server->setClass('App\Libaraies\HelloWorld');
    }

    function __doRequest($request, $location, $action, $version, $one_way = 0) {
        ob_start();
        $this->server->handle($request);
        $response = ob_get_contents();
        ob_end_clean();
        return $response;
    }
}

ErrorException in LocalSoapClient.php line 22: SoapServer::setClass(): Tried to set a non existent class (App\Libaraies\HelloWorld)

使用的是laravel5.1,无法调用路径下的类库,放在laravel框架外部,直接写setClass('HelloWorld')是能调到这个HelloWorld类的
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Wed Jun 28 02:01:37 2017 UTC