<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’m using 4.3.30 and I’m experiencing core dumps on some servers using the directory directive in hosts.cfg. The contents of my directory sometimes change and this sometimes leads to a core dump.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">In hosts.cfg I have:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">directory /home/xymon/server/etc/include_xxxxx/xxxxx/<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">this directory contains one file per host which contain something like this:<o:p></o:p></p>
<p class="MsoNormal">0.0.0.0   a_unique_name   # noconn NOCOLUMNS:conn,info,trends nonongreen<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">A cron job adds/removes files from this directory periodically, however, the directory should contain at least one file at all times.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">It’s been a long time since I did any C but I think I’ve been able to track this down a bit with gdb and --debug on xymond. Here’s some xymond debug output:<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.037113 File /home/xymon/server/etc/include_xxxxx/xxxxx//xxxxxxxxx new timestamp<o:p></o:p></p>
<p class="MsoNormal">16223 2021-11-03 12:08:45.037136 -> save_checkpoint<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.037218 Opening file /home/xymon/server/etc/hosts.cfg<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.040573 Opening file /home/xymon/server/etc/include_xxxxx/xxxxx//xxxxxxxxxx<br>
.. (opens all the files)<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047109 -> handle_dropnrename<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047128 -> posttochannel<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047144 Posting message 13651 to 1 readers<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047155 <- posttochannel<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047159 -> posttochannel<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047168 Posting message 4683 to 1 readers<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047176 <- posttochannel<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047179 -> posttochannel<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047188 Posting message 1367 to 1 readers<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047195 <- posttochannel<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047199 -> posttochannel<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047207 Posting message 1905 to 1 readers<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047214 <- posttochannel<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047218 -> posttochannel<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047221 Dropping message - no readers<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047225 -> posttochannel<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047228 Dropping message - no readers<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047232 -> posttochannel<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047240 Posting message 785 to 1 readers<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047247 <- posttochannel<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047251 -> posttochannel<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047259 Posting message 6 to 1 readers<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047266 <- posttochannel<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047269 -> posttochannel<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047273 Dropping message - no readers<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047287 -> free_log_t<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047300 <- free_log_t<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047308 <- handle_dropnrename<o:p></o:p></p>
<p class="MsoNormal">5315 2021-11-03 12:08:45.047312 -> handle_dropnrename<o:p></o:p></p>
<p class="MsoNormal">16223 2021-11-03 12:08:45.240284 <- save_checkpoint<o:p></o:p></p>
<p class="MsoNormal">2021-11-03 12:09:00.061085 Whoops ! Failed to send message (timeout)<o:p></o:p></p>
<p class="MsoNormal">2021-11-03 12:09:00.061303 -><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">On the last handle_dropnrename, the core dump occurs:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Program terminated with signal 6, Aborted.<o:p></o:p></p>
<p class="MsoNormal">#0  0x00007f39f751e387 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:55<o:p></o:p></p>
<p class="MsoNormal">55        return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);<o:p></o:p></p>
<p class="MsoNormal">(gdb) bt<o:p></o:p></p>
<p class="MsoNormal">#0  0x00007f39f751e387 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:55<o:p></o:p></p>
<p class="MsoNormal">#1  0x00007f39f751fa78 in __GI_abort () at abort.c:90<o:p></o:p></p>
<p class="MsoNormal">#2  0x0000000000415f63 in sigsegv_handler (signum=<optimized out>) at sig.c:57<o:p></o:p></p>
<p class="MsoNormal">#3  <signal handler called><o:p></o:p></p>
<p class="MsoNormal">#4  __strlen_sse2_pminub () at ../sysdeps/x86_64/multiarch/strlen-sse2-pminub.S:38<o:p></o:p></p>
<p class="MsoNormal">#5  0x000000000040a5ac in handle_dropnrename (cmd=cmd@entry=CMD_DROPSTATE, sender=sender@entry=0x425e3c "xymond", hostname=0x0, n1=n1@entry=0x0, n2=n2@entry=0x0) at xymond.c:2511<o:p></o:p></p>
<p class="MsoNormal">#6  0x0000000000403eb1 in main (argc=<optimized out>, argv=<optimized out>) at xymond.c:5702<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">What is interesting is that handle_dropnrename appears to be passed an empty hostname or null pointer if I understand gdb correctly.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">In handle_dropnrename strlen is called on hostname and I think this causes the core dump? (xymond.c line 2511):<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">                                char *msgbuf = (char *)malloc(20 + strlen(hostname) + (n1 ? strlen(n1) : 0) + (n2 ? strlen(n2) : 0))<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I _<i>think</i>_ handle_dropnrename is being called around line 5700 of xymond.c:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">                                                                                else if (hostinfo(hwalk->hostname) == NULL) {<o:p></o:p></p>
<p class="MsoNormal">                                                                                                /* Remove all state info about this host. This will NOT remove files. */<o:p></o:p></p>
<p class="MsoNormal">                                                                                                handle_dropnrename(CMD_DROPSTATE, "xymond", hwalk->hostname, NULL, NULL);<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">What am I doing wrong <span style="font-family:"Segoe UI Emoji",sans-serif">
😊</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-GB">Zak </span><span style="mso-fareast-language:EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1"><br>
This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by
 you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of
 internal compliance with Accenture policy. Your privacy is important to us. Accenture uses your personal data only in compliance with data protection laws. For further information on how Accenture processes your personal data, please see our privacy statement
 at https://www.accenture.com/us-en/privacy-policy. <br>
______________________________________________________________________________________<br>
<br>
www.accenture.com<br>
</font>
</body>
</html>