[hobbit] hobbitd status-board not available

Henrik Stoerner henrik at hswn.dk
Fri Feb 23 12:34:57 CET 2007


On Fri, Feb 23, 2007 at 08:24:01AM -0300, Guillermo Castellini wrote:
> I have problems with bbgen test, i found this logs:
> 
> bb-display.log
> ::::::::::::::
> 2007-02-22 17:29:33 hobbitd status-board not available


I'm curious if the attached patch solves this problem. I ran into a
similar issue during a major network problem here, and found out that
the Hobbit 4.2.0 "hobbitd" daemon could stop servicing requests if one
connection to e.g. a client sending a status report was hanging.


Regards,
Henrik

-------------- next part --------------
--- hobbitd/hobbitd.c.orig	2007-02-23 12:33:49.678273441 +0100
+++ hobbitd/hobbitd.c	2007-02-23 12:33:53.374595668 +0100
@@ -4368,6 +4368,8 @@
 			switch (cwalk->doingwhat) {
 			  case RECEIVING:
 				if (FD_ISSET(cwalk->sock, &fdread)) {
+					if ((n == -1) && (errno == EAGAIN)) break; /* Do nothing */
+
 					n = read(cwalk->sock, cwalk->bufp, (cwalk->bufsz - cwalk->buflen - 1));
 					if (n <= 0) {
 						/* End of input data on this connection */
@@ -4405,6 +4407,8 @@
 				if (FD_ISSET(cwalk->sock, &fdwrite)) {
 					n = write(cwalk->sock, cwalk->bufp, cwalk->buflen);
 
+					if ((n == -1) && (errno == EAGAIN)) break; /* Do nothing */
+
 					if (n < 0) {
 						cwalk->buflen = 0;
 					}
@@ -4527,6 +4531,9 @@
 			int sock = accept(lsocket, (struct sockaddr *)&addr, &addrsz);
 
 			if (sock >= 0) {
+				/* Make sure our sockets are non-blocking */
+				fcntl(sock, F_SETFL, O_NONBLOCK);
+
 				if (connhead == NULL) {
 					connhead = conntail = (conn_t *)malloc(sizeof(conn_t));
 				}


More information about the Xymon mailing list