Subject: | OCIHandleAlloc(OCI_HTYPE_ERROR) on re-use of cached OCI environment handle |
Date: | Mon, 08 Jun 2009 11:02:27 -0500 |
To: | bug-DBD-Oracle [...] rt.cpan.org |
From: | Tim Heath <trheath [...] qwest.net> |
Environment:
Redhat RHEL5, kernel build 2.6.18-128.1.10.el5, x86_64
Perl v5.8.8 x86_64-linux-thread-multi (stock RHEL5)
Apache 2.2.3 (stock RHEL5 using preforked workers, no multithreading)
mod_perl version 2 (stock RHEL5)
DBI v1.607
Oracle DBD v1.22
Using apache with mod_perl, if a connect attempt is directed to a
shutdown database, the connection fails (as it should) with the following:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory (DBD ERROR:
OCISessionBegin)
However, after the database is brought up again, subsequent attempts to
connect with the same httpd worker fail with the following:
OCIHandleAlloc(OCI_HTYPE_ERROR) failed at
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/Oracle.pm line 232
Other httpd workers that were not used while the database was down work fine. Restarting httpd clears the problem but is not a viable fix for us.
It was suggested by Tim Bunce that the problem could possibly be avoided by including "ora_envhp => 0" in the connect(). This indeed fixed the problem. I am including Tim's comments below:
"Try passing ora_envhp => 0 in the connect() attributes.
If that fixes it then the bug is probably that dbd::oracle
should not use a cached environment handle if it's not usable.
(and OCIHandleAlloc(OCI_HTYPE_ERROR) is a reasonable way to test that
the environment handle is usable)."
Thanks,
Tim Heath
Qwest Communications