<br><br><div class="gmail_quote">On Mon, Feb 8, 2010 at 6:53 PM, Cade Robinson <span dir="ltr"><<a href="mailto:cade.robinson@gmail.com">cade.robinson@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
The issue is in the hobbitfetch "grabdata" function.<br>
<br>
int n;<br>
char buf[8192];<br>
...<br>
n = read(conn->sockfd, buf, sizeof(buf));<br>
...<br>
else if (n > 0) {<br>
...<br>
buf[n] = '\0';<br>
...<br>
<br>
If the "read" reads 8192 bytes then n is 8192 and then buf[n] tries to<br>
get set to NULL.  There is no element 8192.<br>
Also only one read happens so if there is more than 8192 bytes to be<br>
fetched not everything is fetched.<br>
<br>
I put the "read" and "if"s in a do...while loop and fixed the null<br>
termination on buf and haven't had any issues.<br>
<br>
~/hobbitmon/trunk/hobbitd:-> diff -u hobbitfetch.c ./hobbitfetch.c.new<br>
--- hobbitfetch.c       2010-02-08 12:43:22.781543905 -0600<br>
+++ ./hobbitfetch.c.new 2010-02-08 12:52:25.249509306 -0600<br>
@@ -342,8 +342,9 @@<br>
     int n;<br>
     char buf[8192];<br>
<br>
+    do {<br>
     /* Read data from a peer connection (client or server) */<br>
-        n = read(conn->sockfd, buf, sizeof(buf));<br>
+        n = read(conn->sockfd, buf, sizeof(buf)-2);<br>
     if (n == -1) {<br>
         if ((errno != EINTR) && (errno != EAGAIN)) {<br>
             /* Read failure */<br>
@@ -360,7 +361,7 @@<br>
         /* Save the data */<br>
         dbgprintf("Got %d bytes of data from %s (req %lu)\n",<br>
             n, addrstring(&conn->caddr), conn->seq);<br>
-        buf[n] = '\0';<br>
+        buf[n+1] = '\0';<br>
         addtobuffer(conn->msgbuf, buf);<br>
     }<br>
     else if (n == 0) {<br>
@@ -380,6 +381,7 @@<br>
             break;<br>
         }<br>
     }<br>
+    } while (n>0);<br>
 }<br>
<br>
 void set_polltime(clients_t *client)<br>
<div><div></div><div class="h5"><br>
<br>
<br>
<br>
<br>
<br>
<br>
On Mon, 2010-02-08 at 18:12 +0000, Steinar M. Skúlason wrote:<br>
><br>
><br>
> On Mon, Feb 8, 2010 at 5:36 PM, Daniel McDonald<br>
> <<a href="mailto:dan.mcdonald@austinenergy.com">dan.mcdonald@austinenergy.com</a>> wrote:<br>
>         On 2/8/10 10:37 AM, "Steinar M. Skúlason"<br>
>         <<a href="mailto:steinarms@gmail.com">steinarms@gmail.com</a>> wrote:<br>
><br>
>         > Hi,<br>
>         ><br>
>         > I'm having problems with "msgcache" on the client machines<br>
>         and "hobbitfetch"<br>
>         > on the server machine.<br>
>         > It works for a short period and then get's stuck and all my<br>
>         client side checks<br>
>         > end up with status purple.<br>
><br>
><br>
>         Yup.  Been doing that for a long time here.  I sent a bunch of<br>
>         corefiles to<br>
>         Henrik about it, and he tried a bunch of patches.  Eventually,<br>
>         we just wrote<br>
>         a routine that restarts hobbitfetch whenever a host turns<br>
>         purple.<br>
><br>
>         --<br>
>         Daniel J McDonald, CCIE # 2495, CISSP # 78281<br>
><br>
><br>
>         To unsubscribe from the hobbit list, send an e-mail to<br>
>         <a href="mailto:hobbit-unsubscribe@hswn.dk">hobbit-unsubscribe@hswn.dk</a><br>
><br>
><br>
><br>
> Ok, good to hear that I am not the only one.<br>
> I wrote a ugly routine that restarts hobbitfetch if there is no new<br>
> entry in the logfile<br>
><br>
><br>
> #!/bin/bash<br>
><br>
> #This is to see if any progress has been made within the hobbitfetch<br>
> utility.<br>
> TMP_FILE=/tmp/tmp.hobbitfetch.last<br>
> LAST_LINE=`tail -1 /usr/lib/xymon/server/log/hobbitfetch.log|awk<br>
> '{print $1 $2}'`<br>
> PREV_LINE=`cat /tmp/tmp.hobbitfetch.last`<br>
> echo $LAST_LINE > $TMP_FILE<br>
><br>
> if [ "$LAST_LINE" == "$PREV_LINE" ]; then<br>
>   echo "Nothing has happend .... killing hobbitfetch!"<br>
>   PID=`ps -ef|grep hobbitfetch|awk '{print $2}'`<br>
>   kill -9 $PID<br>
> fi<br>
><br>
> Best Regards,<br>
> Steinar M.<br>
<br>
<br>
To unsubscribe from the hobbit list, send an e-mail to<br>
<a href="mailto:hobbit-unsubscribe@hswn.dk">hobbit-unsubscribe@hswn.dk</a><br>
<br>
<br>
</div></div></blockquote></div>Thank you for your reply Cade, I tried your patch but it was not working for me<br>are you using the 4.3.0-beta2 for both client and server?<br>I get no checks populated with your changes.<br>
Or did you also make changes to the msgcache.c ?<br><br>Regards,<br>Steinar M.<br>