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

Re: [hobbit] Problems with hobbitping when the Network is unreachable (BUG)



On Thu, May 22, 2008 at 07:07:42PM +0100, Sebastian wrote:
> I rebooted my hobbit server and it lost its default gateway, unbeknown to
> me.  The only symptoms of something wrong was a purple in a network test is
> was supposed to be doing and a purple in the server's bbtest column.  Now, I
> reckon one or other or both of these should have both gone red and not
> purple, and the reason that they did not is due to hobbitping going into a
> spin:  what looks like a fairly tight loop.  Hobbitping was using quite a
> lot of CPU (I saw it at well over 30%) and server/tmp/ping-stdout.1407 was
> empty but server/tmp/ping-stderr.5499 was getting many (about 60) "Failed to
> send ICMP packet: Network is unreachable" written to it every second.

Thanks, the attached patch should solve this problem.


Regards,
Henrik

--- hobbit/bbnet/hobbitping.c	2008/01/03 09:42:11	1.14
+++ hobbit/bbnet/hobbitping.c	2008/05/23 08:47:33
@@ -211,7 +211,10 @@
 			   (struct sockaddr *) &hosts[idx]->addr, sizeof(struct sockaddr_in));
 
 	if (sentbytes == -1) {
-		if (errno != EWOULDBLOCK) errprintf("Failed to send ICMP packet: %s\n", strerror(errno));
+		if (errno != EWOULDBLOCK) {
+			errprintf("Failed to send ICMP packet: %s\n", strerror(errno));
+			idx++; /* To avoid looping indefinitely trying to send to this host */
+		}
 	}
 	else if (sentbytes == PING_PACKET_SIZE) {
 		/* We managed to send a ping! */