Discussion:
[BackupPC-devel] wait a little bit before doing the second ping in Lib::CheckHostAlive to avoid pings spuriously failing
Peter Ross
2009-10-06 20:33:37 UTC
Permalink
Hi,
On a system I am trying to backup (winxp running some unknown
firewall) I get weird behaviour;
PING pascal2.missioncriticalit.com (10.10.10.76) 56(84) bytes of data.
64 bytes from pascal2.missioncriticalit.com (10.10.10.76): icmp_seq=1
ttl=128 time=0.172 ms
--- pascal2.missioncriticalit.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.172/0.172/0.172/0.000 ms
PING pascal2.missioncriticalit.com (10.10.10.76) 56(84) bytes of data.
--- pascal2.missioncriticalit.com ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
As you can see the first ping succeeds but the second fails.  As this
is what happens in Lib::CheckHostAlive it incorrectly marks the ping
as failing.
I applied the following patch to make it work.  One simply sleeps for
one second before doing the second ping, in which case it succeeds.
Regards,
Peter
--- Lib.pm      2009-10-06 22:16:42.000000000 +0200
+++ Lib.pm.new  2009-10-06 22:17:50.000000000 +0200
@@ -963,6 +963,12 @@
    }
    #
+    # Sleep for a bit because some systems don't accept two ping requests
+    # which are immediately after one another.
+    #
+    sleep(1);
+
+    #
    # Do a second ping and get the round-trip time in msec
    #
    $s = $bpc->cmdSystemOrEval($pingCmd, undef, $args);
I forgot to ask is this best place to send the bug report and the fix?
Peter Ross
2009-10-06 20:24:38 UTC
Permalink
Hi,

On a system I am trying to backup (winxp running some unknown
firewall) I get weird behaviour;

***@vpil-bashful:~$ ping -c 1 pascal2; ping -c 1 pascal2
PING pascal2.missioncriticalit.com (10.10.10.76) 56(84) bytes of data.
64 bytes from pascal2.missioncriticalit.com (10.10.10.76): icmp_seq=1
ttl=128 time=0.172 ms

--- pascal2.missioncriticalit.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.172/0.172/0.172/0.000 ms
PING pascal2.missioncriticalit.com (10.10.10.76) 56(84) bytes of data.

--- pascal2.missioncriticalit.com ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

As you can see the first ping succeeds but the second fails. As this
is what happens in Lib::CheckHostAlive it incorrectly marks the ping
as failing.

I applied the following patch to make it work. One simply sleeps for
one second before doing the second ping, in which case it succeeds.

Regards,
Peter

--- Lib.pm 2009-10-06 22:16:42.000000000 +0200
+++ Lib.pm.new 2009-10-06 22:17:50.000000000 +0200
@@ -963,6 +963,12 @@
}

#
+ # Sleep for a bit because some systems don't accept two ping requests
+ # which are immediately after one another.
+ #
+ sleep(1);
+
+ #
# Do a second ping and get the round-trip time in msec
#
$s = $bpc->cmdSystemOrEval($pingCmd, undef, $args);

Loading...