Some errors with SIGSEGV

Herbert Straub herbert at linuxhacker.at
Fri Mar 30 13:07:46 CEST 2007


Quoting Ethan Galstad <nagios at nagios.org>:

> Herbert Straub wrote:
>> Quoting matthias.flittner at nethinks.com:
>>
>>> Hello developers,
>>> Hendrik supposed me to build the nagios source without the option '-O2'. I
>>> have done this, but nothing changed. The SIGSEGV also happens in Version
>>> 3.0a2 without the '-O2' option.
>>> Output from gdb:
>>> #0  0xb7e43e84 in mallopt () from /lib/tls/libc.so.6
>>> #1  0xb7e42dcb in free () from /lib/tls/libc.so.6
>>> #2  0x080774ac in my_free ()
>>> #3  0x08073d4f in clear_volatile_macros ()
>>> #4  0x0806c92c in log_host_event ()
>>> #5  0x080706a8 in handle_host_state ()
>>> #6  0x0805bfa8 in process_host_check_result_3x ()
>>> #7  0x0805bc42 in handle_async_host_check_result_3x ()
>>> #8  0x08057533 in reap_check_results ()
>>> #9  0x0806ac7d in handle_timed_event ()
>>> #10 0x0806aaea in event_execution_loop ()
>>> #11 0x080554f1 in main ()
>>
>>
>> I think this is a problem with glibc6 version (2.3.2.ds1-22sa) in
>> debian sarge and the NPTL. I confirm the situation on a Debian Sarge
>> machine. I got no errors with the following workaround:
>>
>> export LD_ASSUME_KERNEL=2.4.15
>> /usr/local/nagios/bin/nagios /usr/local/nagios/etc/nagios.cfg
>>
>> The /debian/FAQ from glibc6 contains the following section:
>> The application should continue to run for now, but when the warning message
>> is printed use of the NPTL threading library, and other new kernel-2.6
>> features, it's worth trying to set environment variable   
>> LD_ASSUME_KERNEL=2.4.1
>> (switch to LinuxThreads instead of NPTL).
>>
>> Debian using glibc-2.3 Ubuntu 2.4, RHEL5 glib-2.5. Perhaps this could
>> be a reason? See the debian changelog of glibc6:
>> http://packages.debian.org/changelogs/pool/main/g/glibc/glibc_2.5-0exp6/changelog
>>
>
> This could be a bug in glibc6 or NPTL, but it could also be a problem
> with the thread code in Nagios.  Perhaps in the signal handling or
> thread startup or state information?  I'm not sure where the problem
> might lie, or where to go for pointers on finding the source of the
> problem.  Any threading gurus care to lend a hand?
>

Yesterday I installed Ubuntu Warty, which using the same glibc and  
NPTL version as Debian Sarge and i can reproduce the segmentation  
fault error. Next, I tried to configure nagios with --enable-DEBUGALL  
and see one warning and one error in the compile phase:

utils.c: In function ?get_raw_command_line2?:
utils.c:2944: error: ?cmd? undeclared (first use in this function)
utils.c:2944: error: (Each undeclared identifier is reported only once
utils.c:2944: error: for each function it appears in.)
--> Ok

utils.c: In function ?generate_check_stats?:
utils.c:5984: warning: incompatible implicit declaration of built-in  
function ?round?
utils.c:5989: warning: incompatible implicit declaration of built-in  
function ?round?
--> this could the reason for the segfault!

After patching nagios (see patch attachment), i could'nt reproduce the  
segfault under Debian Sarge! Looks good! I compared the 2.8 with 3.0  
and see, that 2.8 doesn't contains the round function call.

For me, the details of this phenomenon are unclear, but one hint can  
give this little test programm:

#include <stdio.h>
#include <math.h>

main()
{
         int test1; int test2; int test3;

         test1=5; test2=10;
         test3=(int)floor((double)(test1*test2));
         printf("test3: %d\n", test3);
         test3=(int)round((double)(test1*test2));
         printf("test3: %d\n", test3);
}

Debian Sarge:
$ gcc -o test_round -lm test_round.c
$ ./test_round
test3: 50
test3: 0


Ubuntu Edgy:
$ gcc -o test_round -lm test_round.c
test_round.c: In function ?main?:
test_round.c:11: warning: incompatible implicit declaration of  
built-in function ?round?
$ ./test_round
./test_round
test3: 50
test3: 50

Anyway, please test the situation and report the situation.

Best Regards
Herbert Straub




-------------- next part --------------
A non-text attachment was scrubbed...
Name: nagios-3.0a2.patch
Type: text/x-patch
Size: 1412 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20070330/c2b39a6c/attachment.bin>
-------------- next part --------------
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list