Bugs item #2113169, was opened at 2008-09-16 03:24
Message generated for change (Comment added) made by roeften
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=676128&aid=2113169&group_id=116817
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Other
Group: None
Status: Open
Resolution: None
Priority: 4
Private: No
Submitted By: kostos (kostos)
Assigned to: wimpunk (wimpunk)
Summary: Timeout option doesn't prevent hangs
Initial Comment:
Hi,
i have Aolynk DR814 ADSL modem which is hanging from time to time and wifi-router (Dlink) connected between ADSL modem and server running ddclient.
In this configiration, when ADSL modem hangs, ddclient also hanging with message like " ddclient - read from 192.168.1.1 .." and still hanged infinitely, even after modem restarted, regardless timeout option is set.
As W/A i have changed the source code line below:
local $SIG{'ALRM'} = sub { $timeout = 1; };
to close socket descriptor when timeout happens:
local $SIG{'ALRM'} = sub { $timeout = 1; close($sd);};
Not sure is it good enough solution, but after week of testing (2 or 3 hangs happened) - it seem working, ddclient didn't hang since. Could you please check if it possible to include similar change into release?
P.S.
Could you also please consider small extension of functionality: in my feeling, it would be not too bad idea to log error message when timeout happens, or even better - to call external script given by option parameter to try to fix the issue.
----------------------------------------------------------------------
Comment By: Panos (roeften)
Date: 2009-10-16 15:19
Message:
Hello I had the same problem and managed to solve it by changing the code a
bit. The key is to use an eval/die pair to force the alarm signal to do
what we want it to do, that is interrupt the read
(http://perldoc.perl.org/perlipc.html#Signals).
Around line 1816 (Commented out the original code):
# my $timeout = 0;
# local $SIG{'ALRM'} = sub { $timeout = 1; msg(qq{Alarm!\n});};
# $0 = sprintf("%s - reading from %s port %s", $program, $peer,
$port);
# alarm(opt('timeout')) if opt('timeout') > 0;
# while (!$timeout && ($_ = <$sd>)) {
# $0 = sprintf("%s - read from %s port %s", $program, $peer,
$port);
# verbose("RECEIVE:", "%s", define($_, "<undefined>"));
# $reply .= $_ if defined $_;
# }
# if (opt('timeout') > 0) {
# alarm(0);
# }
$0 = sprintf("%s - reading from %s port %s", $program, $peer,
$port);
eval {
local $SIG{'ALRM'} = sub { die "timeout";};
alarm(opt('timeout')) if opt('timeout') > 0;
while (($_ = <$sd>)) {
$0 = sprintf("%s - read from %s port %s", $program,
$peer, $port);
verbose("RECEIVE:", "%s", define($_, "<undefined>"));
$reply .= $_ if defined $_;
}
if (opt('timeout') > 0) {
alarm(0);
}
};
close($sd);
# if ($timeout) {
if ($@ and $@ =~ /timeout/) {
warning("TIMEOUT: %s after %s seconds", $to,
opt('timeout'));
$reply = '';
}
----------------------------------------------------------------------
Comment By: Cyril VINH-TUNG (cvinh)
Date: 2009-08-16 20:57
Message:
Hello
I have exactly the same problem with web checkip.
ddclient hangs at :
CONNECT: checkip.dyndns.org
CONNECTED: using HTTP
SENDING: GET / HTTP/1.0
SENDING: Host: checkip.dyndns.org
SENDING: User-Agent: ddclient/3.7.3
SENDING: Connection: close
SENDING:
I tried to modify the script with
local $SIG{'ALRM'} = sub { $timeout = 1; close($sd);};
but I have a segfault after timeout (20s) and ddclient daemon crashes :
Aug 16 07:41:53 videosurvey ddclient[8215]: CONNECT: checkip.dyndns.org
Aug 16 07:41:54 videosurvey ddclient[8215]: CONNECTED: using HTTP
Aug 16 07:41:54 videosurvey ddclient[8215]: SENDING: GET / HTTP/1.0
Aug 16 07:41:54 videosurvey ddclient[8215]: SENDING: Host:
checkip.dyndns.org
Aug 16 07:41:54 videosurvey ddclient[8215]: SENDING: User-Agent:
ddclient/3.7.3
Aug 16 07:41:54 videosurvey ddclient[8215]: SENDING: Connection: close
Aug 16 07:41:54 videosurvey ddclient[8215]: SENDING:
Aug 16 07:42:14 videosurvey kernel: ddclient[8215]: segfault at 8 ip
002abf9c sp bfdb7a70 error 6 in libperl.so[101000+257000]
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=676128&aid=2113169&group_id=116817
|