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

Re: [hobbit] Whoops error



On Tue, Sep 11, 2007 at 01:29:37PM -0400, Stewart L wrote:
> I get this fairly frequently.   Where should I look?  this is running on a
> beefy box,  Dell 6850 server with 4 procs and 16GB of RAM.
[snip]
> Whoops ! bb failed to send message - timeout hobbitd status-board not
> available

Please try the attached patch. It's been available for a while, but
isn't part of the "all-in-one" patch.

Henrik

--- 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));
 				}