2.0a1 and embedded-perl

Matthew Kent matt at bravenet.com
Fri Mar 19 01:54:58 CET 2004


We'll I've about reached the limit of what my amateurish C debugging
skills can accomplish. :) 

Basically the problem is that if I compile nagios with
--enable-embedded-perl it hangs with a nagios zombie process. No checks
are ever run. Compiling it without, everything rolls along just great.

With strace I can see where it's happening. This is while it's trying to
run the check_disk plugin

[pid  6247] pipe([5, 9])                = 0
[pid  6247] vfork()                     = 6248
[pid  6248] close(5)                    = 0
[pid  6248] dup2(9, 1)                  = 1
[pid  6248] close(9)                    = 0
[pid  6248] write(8,
"\240\240\33@\2\0\0\0\0\0\0\0\376\360\32@\f3\32@\200[\27\10X\271\377\277
aU\17@\260\23\32@\240\17\32 at X\271\3
77\277HU\17 at turkish\0   "..., 148) = 148
[pid  6244] <... poll resumed> [{fd=7, events=POLLIN, revents=POLLIN}],
1, 2000) = 1
[pid  6248] rt_sigprocmask(SIG_SETMASK, NULL,  <unfinished ...>
[pid  6244] getppid( <unfinished ...>
[pid  6248] <... rt_sigprocmask resumed> [RTMIN], 8) = 0
[pid  6244] <... getppid resumed> )     = 6243
[pid  6248] rt_sigsuspend([] <unfinished ...>
[pid  6244] read(7,
"\240\240\33@\2\0\0\0\0\0\0\0\376\360\32@\f3\32@\200[\27\10X\271\377\277
aU\17@\260\23\32@\240\17\32 at X\271\37
7\277HU\17 at turkish\0   "..., 148) = 148
[pid  6244] kill(6245, SIGRT_1)         = 0
[pid  6245] <... poll resumed> [{fd=5, events=POLLIN}], 1, 500) = -1
EINTR (Interrupted system call)
[pid  6245] --- SIGRT_1 (Real-time signal 1) ---
[pid  6245] _exit(0)                    = ?
[pid  6244] --- SIGRT_1 (Real-time signal 1) ---
[pid  6244] sigreturn()                 = ? (mask now ~[TRAP KILL STOP])
[pid  6244] wait4(6245,  <unfinished ...>
[pid  6246] close(6 <unfinished ...>
[pid  6247] close(9 <unfinished ...>
[pid  6246] <... close resumed> )       = 0
[pid  6247] <... close resumed> )       = 0
[pid  6246] _exit(0)                    = ?
[pid  6247] fstat64(5,  <unfinished ...>
[pid  6243] <... wait4 resumed> NULL, 0, NULL) = 6246
[pid  6243] --- SIGCHLD (Child exited) ---
[pid  6243] time([1079656326])          = 1079656326
[pid  6243] nanosleep({0, 250000000},  <unfinished ...>
[pid  6247] <... fstat64 resumed> {st_mode=S_IFIFO|0600, st_size=0,
...}) = 0
[pid  6247] old_mmap(NULL, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40013000
[pid  6247] read(5,  <unfinished ...>

And that's it. Pid 6247 just waits there. 

Looking at the code; it seems to hang in base/checks.c line 431, the
first fgets on the process.

Now with embedded turned off I get this:

[pid  8845] pipe([4, 6])                = 0
[pid  8845] fork()                      = 8846
[pid  8846] getpid()                    = 8846
[pid  8846] getrlimit(0x3, 0xbfffccc0)  = 0
[pid  8846] close(4)                    = 0
[pid  8846] dup2(6, 1)                  = 1
[pid  8846] close(6)                    = 0
[pid  8846] getpid()                    = 8846
[pid  8846] getrlimit(0x3, 0xbfffbb20)  = 0
[pid  8846] rt_sigaction(SIGRTMIN, {SIG_DFL}, NULL, 8) = 0
[pid  8846] rt_sigaction(SIGRT_1, {SIG_DFL}, NULL, 8) = 0
[pid  8846] rt_sigaction(SIGRT_2, {SIG_DFL}, NULL, 8) = 0
[pid  8846] execve("/bin/sh", ["sh", "-c",
"/usr/lib/nagios/plugins/check_http -H 192.169.1.6"], [/* 25 vars */]) =
0

etc, etc.

What I got stuck on was why popen seemed to call fork() when compiled
without and then vfork() when compiled with embedded perl on. Shouldn't
they be the same since check_http and check_disk aren't written in perl?

Last note is that if I expanded the strace width I could read a funky
looking error message which the forked process seemed to spit out.

[pid 12217] write(8,
"\240\240\33@\2\0\0\0\0\0\0\0\376\360\32@\f3\32@\200[\27\10\330\305\377\
277aU\17@\260\23\32@\240\17\32@\330
\305\377\277HU\17 at turkish\0
\374\226\32 at p\306\377\277\10f\0@\23\253\32@\240\332\10@\0\n\nuBd\0@ the
`glibcbug\' scriX\306\377
\277o\n\0re\n\0\0\374\226\32@\1\0\0\0\336\262\32 at l\243\32@\34\217\32@\22
0\313\2@\t\0\0\0", 148) = 148

This is a stock redhat install with kernel 2.4.20-30.7, perl 5.6 (tried
5.8 compiled from source too), and glibc-2.2.5-44.

Matthew Kent \ SA \ bravenet.com \ 1-250-954-3203 ext 108


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click




More information about the Developers mailing list