Hi,

I have trouble with Oracle connections "stalling" if they are unused for a
long time, particularly Apache::DBI connections. So I overrode the
DBD::Oracle::db::ping subroutine to set an alarm and hence detect this
case-- if the "select sysdate from dual" statement took more than a few
seconds, reconnect.

Unfortunately, it would appear (from searching with google) that perl
5.8.0's deferred signal handling makes this approach unusable.. a simple
test (given below) works fine with perl 5.6.1 but hangs until the statement
completes with perl 5.8.0.

I believe others have encountered this-- has anyone found a solution? I
can't think of one, and can't find one by use of search engine or eyeballing
the dbi-users archives.

All help appreciated.

Test code:

perl5.8.0 -MDBI -e '$dbh = DBI->connect(qw|dbi:Oracle:dbname dbuser dbpass|,
{AutoCommit=>0,PrintError=>0,RaiseError=>1,ShowErrorStatement=>1}); $sth =
$dbh->prepare(q[SELECT SUM(d_c_count) FROM big_table]); eval { local
$SIG{ALRM} = sub { my $res; $sth && ($res = $sth->cancel); print STDERR
"sigalrm $res\n"; die "alarm" }; alarm(2); $sth->execute; alarm(0); }'

where "truss" demonstrates that Perl uses sigaction() to trap SIGALRM, and
SIGALRM is delivered, but the read() inside the Oracle library is resumed.

I am using DBI 1.30-nothread, DBD::Oracle 1.12 and variously perl 5.6.1
sun4-solaris and perl 5.8.0 sun4-solaris-64int.

SRH


Please note that:
 
1. This e-mail may constitute privileged information. If you are not the intended 
recipient, you have received this confidential email and any attachments transmitted 
with it in error and you must not disclose, copy, circulate or in any other way use or 
rely on this information.
2. E-mails to and from the company are monitored for operational reasons and in 
accordance with lawful business practices.
3. The contents of this email are those of the individual and do not necessarily 
represent the views of the company.
4. The company does not conclude contracts by email and all negotiations are subject 
to contract.
5. The company accepts no responsibility once an e-mail and any attachments is sent.

http://www.activis.com




This annotation was added by the e-scan service.
http://www.activis.com
----------------------------------------------------------------------------------
This message has been checked for all known viruses by e:)scan.
For further information please contact [EMAIL PROTECTED]

Reply via email to