FW: DBD::Informix & $SIG{ALRM} & /etc/services

FW: DBD::Informix & $SIG{ALRM} & /etc/services

am 07.11.2006 16:17:21 von tvilliers

> -----Original Message-----
> From: Jonathan Leffler [mailto:jonathan.leffler@gmail.com]
> Sent: 03 November 2006 22:30
>
> On 11/3/06, Jay Hannah wrote:
>
> > Oops. I noticed my versions were behind. I upgraded DBI and DBD::Informix.
> >
> > I'm still getting the same behavior (14.3 seconds to time out), so I'm
> > still curious about what might be going on.
>
>
> CSDK probably uses alarm itself - for connection timeouts, no less - so
> your attempt to use alarm at the same time is likely to cause confusion
> somewhere.
>
> You could probably track this with the equivalent of truss (strace on
> Linux?), looking for alarm system calls in the output. You'd probably be
> able to identify your own alarm(2) call; you might have to work harder to
> identify which other alarm() calls are made before you see SIGALRM fire.
>

Oracle has a similar issue with timing out, see perldoc DBI "Signal
Handling and Canceling Operations" and also
http://search.cpan.org/~lbaxter/Sys-SigAction/dbd-oracle-tim eout.POD.

The recommended solution for Oracle works fine with Informix too:

__START__
use Sys::SigAction qw( set_sig_handler );
$timeout = 3;
eval {
my $h = set_sig_handler( 'ALRM', sub { die "TIMEOUT" ; } );
alarm $timeout;
$dbh = DBI->connect(...);
alarm(0);
};
alarm(0);
if ( $@ ) {
if ( $@ =~ m/^TIMEOUT/ ) {
...
}
}

__END__

Re: FW: DBD::Informix & $SIG{ALRM} & /etc/services

am 11.11.2006 19:43:03 von lab

On Tue, 2006-11-07 at 15:17 +0000, Tielman de Villiers wrote:
> Oracle has a similar issue with timing out, see perldoc DBI "Signal
> Handling and Canceling Operations" and also
> http://search.cpan.org/~lbaxter/Sys-SigAction/dbd-oracle-tim eout.POD.
>
> The recommended solution for Oracle works fine with Informix too:

That's useful information.

I'll update the doc with the next release to include a list of databases
for which the solution works, if folks let me know the ones that do.
(I'll add Informix for sure).

Lincoln