[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] FW: DBD::Informix & $SIG{ALRM} & /etc/services



I sent this off to dbi-users today. :)

j
 


-----Original Message-----
From: Jay Hannah 
Sent: Friday, November 03, 2006 2:37 PM
To: 'dbi-users@perl.org'
Cc: 'jonathan.leffler@gmail.com'
Subject: DBD::Informix & $SIG{ALRM} & /etc/services

Weird. My alarm(2) takes 14 seconds? Is DBD::Informix or something else
overriding my $SIG{ALRM}?

If I substitute the connect() call with a sleep 10, then my alarm(2)
takes 2 seconds, as I expected. :)

Thanks,

j



$ cat j.t
use strict;
use DBI;
my $dbh;
eval {
   local $SIG{ALRM} = sub { die "timeout\n" };
   alarm(2); # seconds before time out
   $dbh = DBI->connect('dbi:Informix:omni@drprod_tcp');
   alarm(0); # cancel alarm (if connect worked fast) };
alarm(0);    # cancel alarm (if eval failed)
chomp $@;
print "[$@][$DBI::err][$DBI::errstr]\n";

$ time perl j.t
[timeout][-931][SQL: -931: Cannot locate drprod_tcp service/tcp service
in /etc/services.]

real    0m14.320s
user    0m0.319s
sys     0m0.044s



$ perl -MDBI -e 'DBI->installed_versions'
  Perl            : 5.008004    (i686-linux)
  OS              : linux       (2.6.4-52-smp)
  DBI             : 1.46
  DBD::Sybase     : 1.04
  DBD::Sponge     : 11.10
  DBD::Proxy      : install_driver(Proxy) failed: Can't locate
RPC/PlClient.pm in @INC
  DBD::Informix   : 2003.04
  DBD::File       : 0.31
  DBD::ExampleP   : 11.12
  DBD::DBM        : 0.02