Subject: | DBD::Oracle 1.44 crashes multi-threaded Perl application |
Date: | Fri, 17 Jan 2014 14:20:42 +0000 |
To: | <bug-DBD-Oracle [...] rt.cpan.org> |
From: | <Detlef.Luetticke [...] materna.de> |
Subject: DBD::Oracle 1.44 crashes multi-threaded Perl application
---------------------
used Perl:
me@sunny-1/2 (~)> perl -v
This is perl 5, version 12, subversion 3 (v5.12.3) built for sun4-solaris-thread-multi-64
Copyright 1987-2010, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
---------------------
used OS:
me@sunny-1/1 (~)> uname -a
SunOS sunny 5.11 11.1 sun4v sparc SUNW,T5240
---------------------
DBD::Orcle:
used version is DBD-Oracle-1.44 -- 23 Apr 2012
---------------------
Description:
Running a multi-threaded Perl application with 2 threads using database connections.
Each thread holds its own connection handle for db requests. The handles are not shared
between the threads. The application aborts without any hint while doing some db stuff more
or less in time. A (lucky) truss output locates the crash in the underlying OCI driver (Oracle 11.2.0_64 Patch 11.2.0.3).
It seems that the OCI driver prevents a possible core dump, but I am not sure.
---------------------
temp. Solution:
Getting information from the DBI trace, the DBD::Oracle source and the OCI manual I fixed the problem
using an additional undocumented connection attribute (ora_init_mode => 0x03) at application level.
This enables the OCI environment in the mode OCI_THREADED (0x02) and OCI_OBJECT (0x01).
Currently DBD::Oracle uses only OCI_OBJECT compiled as a multi-threaded Perl module.
Fixed line of application code:
DBI->connect("dbi:Oracle:foodb","bar","",{RaiseError=>1,ora_init_mode=>0x03});
---------------------
Looking at the source:
OCI_THREADED was present up to and including 1.28.
Since 1.29_1 (developer version) and 1.30 OCI_THREADED disappeared without any (useful) change comment.
I suspect it is a mistake.
Changes in DBD-Oracle 1.29_1
[ENHANCEMENTS]
- added support for TAF callback (John Scoles)
- now trap OCIServerAttach errors (patch by Marc Fielding, applied
by Martin J. Evans) [rt68958]
- added installation notes for MAC Snow Leopard (Martin J. Evans)
- added '/etc' to the search paths for tnsnames.ora (Martin J. Evans, Jay Senseman)
[rt67942]
- removed support for ProcC connections (John Scoles)
...
Version 1.28 source dbdimp.c, line 641, function dbd_db_login6
#if defined(USE_ITHREADS) || defined(MULTIPLICITY) || defined(USE_5005THREADS)
init_mode |= OCI_THREADED;
#endif
---------------------
Looking ahead:
Is it possible to reuse the mode OCI_THREADED in the case of using DBD::Oracle in a
multi-threaded Perl environment for the next Version of DBD::Oracle.
Best regards
Detlef Lütticke