beckmanel has asked for the wisdom of the Perl Monks concerning the following question:
Gentlepersons - I surrounded db change code with a timeout, hoping that if there was a problem with the DB I/O, and it hung, the timeout would free up the program and allow it to continue. However, it does not seem to be working, and the program is hanging up. This is on a Windows 10 server. Did I miswrite the timeout, or is there an issue with Windows, or something else ?
my $sth; my $res; eval{ local $SIG{ALRM} = sub { die "db_timeout" }; alarm 12; $sth = $dbh->prepare($sql); if (! defined $sth) { print LOG "ERROR: insert prepare failed\n"; } else { $res = $sth->execute; } alarm 0; }; if ($@) { if ($@ !~ /db_timeout/) { print LOG "ERROR: Alarm during insert execute othe +r than db_timeout: $@\n"; } else { print LOG "ERROR: db_timeout: $@\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Timeout Failing
by huck (Prior) on Oct 23, 2017 at 15:07 UTC | |
|
Re: Timeout Failing
by thanos1983 (Parson) on Oct 23, 2017 at 15:12 UTC | |
|
Re: Timeout Failing
by vr (Curate) on Oct 25, 2017 at 19:05 UTC | |
|
Re: Timeout Failing
by holli (Abbot) on Oct 23, 2017 at 14:29 UTC | |
|
Re: Timeout Failing
by Anonymous Monk on Oct 25, 2017 at 04:11 UTC | |
by Your Mother (Archbishop) on Oct 25, 2017 at 04:51 UTC |