Hello,
I'm running freebsd 9.3 on amd64 with nagios-plugins 2.1.1. After the upgrade to 2.1.1 last week, check_smtp and check_tcp segfault when the port they are meant to be monitoring is closed:
nagios@grackle:/usr/local/libexec/nagios>./check_smtp -V
check_smtp v (nagios-plugins 2.1.1)
nagios@grackle:/usr/local/libexec/nagios>./check_smtp -H localhost
Segmentation fault
nagios@grackle:/usr/local/libexec/nagios>./check_tcp -V
check_tcp v (nagios-plugins 2.1.1)
nagios@grackle:/usr/local/libexec/nagios>./check_tcp -H localhost -p 26
Segmentation fault
Also when -v is used with no other arguments (I found this by accident, I was aiming for -V):
nagios@grackle:/usr/local/libexec/nagios>./check_smtp -v
HELOCMD: HELO grackle
Segmentation fault
nagios@grackle:/usr/local/libexec/nagios>./check_tcp -v
Using service TCP
Port: 0
flags: 0x2
Segmentation fault
Is there anything more I can do on my end to help sort out what the issue might be?
(I reported this to the freebsd port maintainers; they say it's "not a FreeBSD specific problem".
Thanks,
Kyle
segfault in check_tcp, check_smtp on a closed port
Re: segfault in check_tcp, check_smtp on a closed port
I looks like you could have an issue with resolving the localhost for your system.
Take a look at the output when I run ./check_tcp -v on my system.
Take a look at your /etc/hosts file and see if it has localhost defined.
Take a look at the output when I run ./check_tcp -v on my system.
Code: Select all
./check_tcp -v
Using service TCP
Port: 0
flags: 0x2
connect to address 127.0.0.1 and port 0: Connection refused
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: segfault in check_tcp, check_smtp on a closed port
Sorry for the delay, I was away from the office for a bit. Yes, localhost is defined:
::1 localhost localhost.my.domain
127.0.0.1 localhost localhost.my.domain
what else should I look for?
Thanks,
Kyle
::1 localhost localhost.my.domain
127.0.0.1 localhost localhost.my.domain
what else should I look for?
Thanks,
Kyle
Re: segfault in check_tcp, check_smtp on a closed port
If you run the check_tcp command and check a closed port on a remote system, do you get a Segmentation fault or is it just the localhost causing it?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: segfault in check_tcp, check_smtp on a closed port
I get segfault on remote systems as well as localhost.
Re: segfault in check_tcp, check_smtp on a closed port
If you have strace you could run the following to see what it was doing when it crashed:
strace -s 255 ./check_smtp -H localhost
Then post back the last 20 lines or so.
strace -s 255 ./check_smtp -H localhost
Then post back the last 20 lines or so.
Former Nagios employee
Re: segfault in check_tcp, check_smtp on a closed port
FreeBSD apparently uses truss, not strace. I'm guessing the output will be similar:
> truss -s 255 -o /tmp/truss_check_smtp ./check_smtp -H localhost
(...)
madvise(0x801494000,0x2000,0x5,0x93,0x7fffffffe040,0xffffffff) = 0 (0x0)
__sysctl(0x7fffffffea10,0x2,0x801440100,0x7fffffffea08,0x0,0x0) = 0 (0x0)
sigprocmask(SIG_SETMASK,SIGHUP|SIGINT|SIGQUIT|SIGILL|SIGTRAP|SIGABRT|SIGEMT|SIGFPE|SIGKILL|SIGBUS|SIGSEGV|SIGSYS|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0)
sigaction(SIGALRM,{ 0x800e473c0 SA_RESTART|SA_SIGINFO ss_t },{ SIG_DFL 0x0 ss_t }) = 0 (0x0)
sigprocmask(SIG_SETMASK,0x0,0x0) = 0 (0x0)
setitimer(0,{0.000000, 10.000000 },{0.000000, 0.000000 }) = 0 (0x0)
stat("/etc/nsswitch.conf",{ mode=-rw-r--r-- ,inode=518218,size=320,blksize=16384 }) = 0 (0x0)
open("/etc/hosts",O_RDONLY,0666) = 3 (0x3)
fstat(3,{ mode=-rw-r--r-- ,inode=518500,size=2297,blksize=16384 }) = 0 (0x0)
read(3,"# $FreeBSD: releng/9.3/etc/hosts 109997 2003-01-28 21:29:23Z dbaker $\n#\n# Host Database\n#\n# This file should contain the addresses and aliases for local hosts that\n# share this file. Replace 'my.domain' below with the domainname of your\n# machine."...,16384) = 2297 (0x8f9)
read(3,0x8014a3000,16384) = 0 (0x0)
close(3) = 0 (0x0)
madvise(0x8014a3000,0x4000,0x5,0xa2,0x7fffffffb770,0x801400e38) = 0 (0x0)
__sysctl(0x7fffffffe590,0x4,0x0,0x7fffffffe5b8,0x0,0x0) = 0 (0x0)
__sysctl(0x7fffffffe590,0x4,0x801444300,0x7fffffffe5b8,0x0,0x0) = 0 (0x0)
socket(PF_INET6,SOCK_DGRAM,17) = 3 (0x3)
connect(3,{ AF_INET6 [::1]:1 },28) = 0 (0x0)
getsockname(3,{ AF_INET6 [::1]:64603 },0x7fffffffe5dc) = 0 (0x0)
ioctl(3,SIOCGIFAFLAG_IN6,0xffffe5e0) ERR#6 'Device not configured'
close(3) = 0 (0x0)
socket(PF_INET,SOCK_DGRAM,17) = 3 (0x3)
connect(3,{ AF_INET 127.0.0.1:1 },16) = 0 (0x0)
getsockname(3,{ AF_INET 127.0.0.1:13744 },0x7fffffffe5dc) = 0 (0x0)
close(3) = 0 (0x0)
madvise(0x80149f000,0x1000,0x5,0x9e,0x7fffffffdaa0,0xffffffff) = 0 (0x0)
madvise(0x801496000,0x1000,0x5,0x95,0x7fffffffdaa0,0xffffffff) = 0 (0x0)
socket(PF_INET,SOCK_STREAM,6) = 3 (0x3)
connect(3,{ AF_INET 127.0.0.1:25 },16) ERR#61 'Connection refused'
close(3) = 0 (0x0)
socket(PF_INET6,SOCK_STREAM,6) = 3 (0x3)
connect(3,{ AF_INET6 [::1]:25 },28) ERR#61 'Connection refused'
close(3) = 0 (0x0)
SIGNAL 11 (SIGSEGV)
process exit, rval = 0
The truss output file for check_tcp is only 108 lines; I can post it in its entirety if it helps. (The one for check_smtp runs to 222 lines.)
> truss -s 255 -o /tmp/truss_check_smtp ./check_smtp -H localhost
(...)
madvise(0x801494000,0x2000,0x5,0x93,0x7fffffffe040,0xffffffff) = 0 (0x0)
__sysctl(0x7fffffffea10,0x2,0x801440100,0x7fffffffea08,0x0,0x0) = 0 (0x0)
sigprocmask(SIG_SETMASK,SIGHUP|SIGINT|SIGQUIT|SIGILL|SIGTRAP|SIGABRT|SIGEMT|SIGFPE|SIGKILL|SIGBUS|SIGSEGV|SIGSYS|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0)
sigaction(SIGALRM,{ 0x800e473c0 SA_RESTART|SA_SIGINFO ss_t },{ SIG_DFL 0x0 ss_t }) = 0 (0x0)
sigprocmask(SIG_SETMASK,0x0,0x0) = 0 (0x0)
setitimer(0,{0.000000, 10.000000 },{0.000000, 0.000000 }) = 0 (0x0)
stat("/etc/nsswitch.conf",{ mode=-rw-r--r-- ,inode=518218,size=320,blksize=16384 }) = 0 (0x0)
open("/etc/hosts",O_RDONLY,0666) = 3 (0x3)
fstat(3,{ mode=-rw-r--r-- ,inode=518500,size=2297,blksize=16384 }) = 0 (0x0)
read(3,"# $FreeBSD: releng/9.3/etc/hosts 109997 2003-01-28 21:29:23Z dbaker $\n#\n# Host Database\n#\n# This file should contain the addresses and aliases for local hosts that\n# share this file. Replace 'my.domain' below with the domainname of your\n# machine."...,16384) = 2297 (0x8f9)
read(3,0x8014a3000,16384) = 0 (0x0)
close(3) = 0 (0x0)
madvise(0x8014a3000,0x4000,0x5,0xa2,0x7fffffffb770,0x801400e38) = 0 (0x0)
__sysctl(0x7fffffffe590,0x4,0x0,0x7fffffffe5b8,0x0,0x0) = 0 (0x0)
__sysctl(0x7fffffffe590,0x4,0x801444300,0x7fffffffe5b8,0x0,0x0) = 0 (0x0)
socket(PF_INET6,SOCK_DGRAM,17) = 3 (0x3)
connect(3,{ AF_INET6 [::1]:1 },28) = 0 (0x0)
getsockname(3,{ AF_INET6 [::1]:64603 },0x7fffffffe5dc) = 0 (0x0)
ioctl(3,SIOCGIFAFLAG_IN6,0xffffe5e0) ERR#6 'Device not configured'
close(3) = 0 (0x0)
socket(PF_INET,SOCK_DGRAM,17) = 3 (0x3)
connect(3,{ AF_INET 127.0.0.1:1 },16) = 0 (0x0)
getsockname(3,{ AF_INET 127.0.0.1:13744 },0x7fffffffe5dc) = 0 (0x0)
close(3) = 0 (0x0)
madvise(0x80149f000,0x1000,0x5,0x9e,0x7fffffffdaa0,0xffffffff) = 0 (0x0)
madvise(0x801496000,0x1000,0x5,0x95,0x7fffffffdaa0,0xffffffff) = 0 (0x0)
socket(PF_INET,SOCK_STREAM,6) = 3 (0x3)
connect(3,{ AF_INET 127.0.0.1:25 },16) ERR#61 'Connection refused'
close(3) = 0 (0x0)
socket(PF_INET6,SOCK_STREAM,6) = 3 (0x3)
connect(3,{ AF_INET6 [::1]:25 },28) ERR#61 'Connection refused'
close(3) = 0 (0x0)
SIGNAL 11 (SIGSEGV)
process exit, rval = 0
The truss output file for check_tcp is only 108 lines; I can post it in its entirety if it helps. (The one for check_smtp runs to 222 lines.)
Re: segfault in check_tcp, check_smtp on a closed port
Some additional tidbits, in case they'll help.
nagios-plugins-2.1.1, compiled and installed on a linux (Mint, 17.1 Rebecca) works fine.
nagios-plugins-2.1.0 and -2.1.1, compiled from source on FreeBSD amd64, has this problem.
nagios-plugins-2.0.3, compiled from source on FreeBSD amd64, works fine.
For FreeBSD, I've tried them on both 9.3-RELEASE and 10.1-RELEASE.
Thanks,
Kyle
nagios-plugins-2.1.1, compiled and installed on a linux (Mint, 17.1 Rebecca) works fine.
nagios-plugins-2.1.0 and -2.1.1, compiled from source on FreeBSD amd64, has this problem.
nagios-plugins-2.0.3, compiled from source on FreeBSD amd64, works fine.
For FreeBSD, I've tried them on both 9.3-RELEASE and 10.1-RELEASE.
Thanks,
Kyle
Re: segfault in check_tcp, check_smtp on a closed port
My guess is that the close() statement is trying to close a socket descriptor but is getting the wrong pointer, but I am not a BSD guy and I am only a moderately useful C programmer. I will see if our C dev can look at this.
Former Nagios employee
Re: segfault in check_tcp, check_smtp on a closed port
A fix has been propagated through the FreeBSD ports system. If it originated here, thank you!
If not, here is the github post referenced in the port commit message:
https://github.com/stromnet/nagios-plug ... 2a1541a067
Thanks again for checking on this.
If not, here is the github post referenced in the port commit message:
https://github.com/stromnet/nagios-plug ... 2a1541a067
Thanks again for checking on this.