php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16502 OCIPLogon does not reconnect to restarted Database
Submitted: 2002-04-08 23:16 UTC Modified: 2005-09-08 17:27 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: bmironov at jonview dot com Assigned:
Status: Closed Package: OCI8 related
PHP Version: 4.1.2 OS: RedHat 7.2
Private report: No CVE-ID: None
 [2002-04-08 23:16 UTC] bmironov at jonview dot com
Hello,

I have an issue between PHP and Oracle. As soon as I have to restart database I have to do same for Apache. If I will not do that my session will retrieve error message about "end-of-file coonection". I agree that some of child processes in Apache can be in this status. But I guess, that it is possible to track that OCIPLogon tries to connect to DB through dead connection. That can trigger whole "connection process" to run again. It is better than wait for administrator to restart whole web server. I prefer OCIPLogon for small SELECT's because of performance issue.

I tried to solve this issue with   apache_child_terminate() but received message that it is disabled somehow (I even have no idea how to enable it)

My environment is:
RedHat 6.1 / 7.2
Apache 1.3.23
PHP 4.1.2  (--with-oci8)
Oracle 8.1.5 client
remote Oracle7 and Oracle8.1.5 databases


Thanks for any advise,
Boris
bmironov@jonview.com

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-13 09:20 UTC] thies@php.net
hack:
change your tnsnames.ora to include a failover to the same db.
PROD=(
    DESCRIPTION=(
        ADDRESS=(PROTOCOL=TCP)(Host=127.0.0.1)(Port=1521))
        (CONNECT_DATA=(SID=PROD)(failover_mode=(backup=PROD)(type=session)(method=basic)(retry=100)(delay=60)))
)

this will make the Net8 client to reconnect automagically

 [2002-04-13 09:21 UTC] thies@php.net
hack:
change your tnsnames.ora to include a failover to the same db.
PROD=(
    DESCRIPTION=(
        ADDRESS=(PROTOCOL=TCP)(Host=127.0.0.1)(Port=1521))
        (CONNECT_DATA=(SID=PROD)(failover_mode=(backup=PROD)(type=session)(method=basic)(retry=100)(delay=60)))
)

this will make the Net8 client to reconnect automagically

 [2002-04-15 08:55 UTC] bmironov at jonview dot com
Thanks!

I'm gonna try it.
 [2002-04-15 10:51 UTC] bmironov at jonview dot com
Hello,

I've tested your solution. This is very elegant!
It's working perfectly for Oracle8i database and not working for Oracle7 database. We use Oracle8i clients and listeners.

When PHP tries to connect to Oracle7 through Oracle8i client and Oracle8i listener with mentioned above settings, OCIPLogon throws following error:

ORA-03115: unsupported network datatype or representation


I have another solution but I'm not sure that is "proper" one. I've uncommented call for 'oci_ping' in oci8.c file (rows 2375 - 2361, right after text "XXX ini-flag" in the _oci_open_server function).
I understand that it has "price" equals to OCIServerVersion call per each logon. But in case of Oracle7 I don't see solutions so far.

Just couple questions left:
1. Is it really proper way for the problem?
2. If it is, Can it be incorporated in coming release?


Thanks a lot,
Boris
 [2003-02-20 07:57 UTC] sniper@php.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 "Open". Thank you.


 [2005-08-24 00:06 UTC] msheldon at ultradns dot com
I've been dealing with this bug for a while now.

The failover statements mentioned earlier did not help. Once a DB connection fails, it is useless from that point on, but PHP will not drop it, nor does there seem to be any way for me to forcibly terminate it in code. The only thing I can do is to restart apache.

Frankly, this is complete foolishness. There is no excuse for there not being an available function to forcibly terminate/reestablish a database connection.
 [2005-09-08 17:27 UTC] tony2001@php.net
The bug has been fixed in OCI8 v.1.1, which is available in CVS HEAD and PECL (use `pear install oci8-beta` to install it).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 05:01:31 2024 UTC