Nagios 3.0.6 and 3.1.2 SIGSEGV on FreeBSD 8 in get_next_comment_by_host

Scott Lambert lambert at lambertfam.org
Fri Sep 18 06:14:41 CEST 2009


I have installed Nagios 3.0.6 using the ports collection on a FreeBSD
8-BETA2 box. 

Nagios runs great until someone acknowleges a down host, (adding
a comment).  Later, when the host comes back up, Nagios exits on
a SIGSEGV.  It seems to only happen when we have retention data
(retention.dat) showing the host down.  If we just restart Nagios
without removing the retention.dat file, it SIGSEGV's the next time it
tries to mark the host up.  I upgraded to the nagios-devel devel (Nagios
3.1.2) and we have the same problem.

I'm not good with gdb, but it looks like there are two threads running.
When it SEGVs it seems to be trying to remove the comment associated
with the acknowlegement message.

sudo gdb -c /var/coredumps/nagios-52050.core /usr/local/bin/nagios
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...(no debugging symbols found)...
Core was generated by `nagios'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libm.so.5...(no debugging symbols found)...done.
Loaded symbols for /lib/libm.so.5
Reading symbols from /lib/libthr.so.3...(no debugging symbols found)...done.
Loaded symbols for /lib/libthr.so.3
Reading symbols from /lib/libc.so.7...(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /libexec/ld-elf.so.1...(no debugging symbols found)...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x0807fe8b in get_next_comment_by_host ()
[New Thread 28326280 (LWP 100051)]
[New Thread 28301140 (LWP 100222)]
(gdb) bt
#0  0x0807fe8b in get_next_comment_by_host ()
#1  0x08080940 in delete_host_acknowledgement_comments ()
#2  0x28331180 in ?? ()
#3  0x4aaac053 in ?? ()
#4  0x080cc394 in __JCR_LIST__ ()
#5  0x28342f00 in ?? ()
#6  0x00000000 in ?? ()
#7  0xbfbfe858 in ?? ()
#8  0x08071c15 in handle_host_state ()
Previous frame inner to this frame (corrupt stack?)

Here is the code for get_next_comment_by_host:

comment *get_next_comment_by_host(char *host_name, comment *start){
	comment *temp_comment=NULL;

	if(host_name==NULL || comment_hashlist==NULL)
		return NULL;

	if(start==NULL)
		temp_comment=comment_hashlist[hashfunc(host_name,NULL,COMMENT_HASHSLOTS)];
	else
		temp_comment=start->nexthash;

	for(;temp_comment && compare_hashdata(temp_comment->host_name,NULL,host_name,NULL)<0;temp_comment=temp_comment->nexthash);

	if(temp_comment && compare_hashdata(temp_comment->host_name,NULL,host_name,NULL)==0)
		return temp_comment;

	return NULL;
	}

I don't grok the for loop but I'm not much of a C guy.  I think it
functions as an obfuscated a while loop.  I am guessing that if the
hashfunc() and compare_hashdata() calls were an issue, they would show
up in the backtrace?

I haven't found any reports of similar issues on the Nagios list or
elsewhere on Google.  I suspect I'm just bleeding on the edge with
FreeBSD 8.  I don't normally like to be this early an adoptor, but this
box was originally only setup to handle DNS and that tested out fine.
When it came time to get Nagios running, this box was in the right
place.

Thanks,

-- 
Scott Lambert                    KC5MLE                       Unix SysAdmin
lambert at lambertfam.org


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list