[Bug 375] httpd does not reap zombies

bugzilla at busybox.net bugzilla at busybox.net
Thu Jul 16 08:52:20 UTC 2009


https://bugs.busybox.net/show_bug.cgi?id=375





--- Comment #6 from Shmulik Hen <shmulik.h at adi-vt.com>  2009-07-16 08:52:19 UTC ---
(In reply to comment #4)
> What is your environment? Most importantly, what version of busybox?

It is an STLinux-2.3 environment, running kernel 2.6.23.17_stm23_0117 on a
STMicro based board (Hitachi SuperH 4 processor).
The supplied busybox version is 1.8.2 in source RPM format, patched by STM for
compatibility with their init scripts.

> Yes, this would cause exited children to remain as zombies, _unless_ SIGCHLD is
> set to SIG_IGN. 
> 
> But busybox does set it to SIG_IGN - see comment #1.
> 
> In order to demonstrate it, I ran busybox as follows, and viewed
> http://127.0.0.1:88/ in by browser:
> 
> # strace -oLOG -tt -f -s99 ./busybox httpd -f -p88 -vvv -h /.1/video
> [::ffff:127.0.0.1]:47252: connected
> [::ffff:127.0.0.1]:47252: url:/
> [::ffff:127.0.0.1]:47252: closed
> 
> Here we see how SIGCHLD is set to SIG_IGN:
> 
> 15969 21:36:59.217432 execve("./busybox", ["./busybox", "httpd", "-f", "-p88",
> "-vvv", "-h", "/.1/video"], [/* 32 vars */]) = 0
> ...
> 15969 21:36:59.218715 chdir("/.1/video") = 0
> 15969 21:36:59.218826 rt_sigaction(SIGCHLD, {SIG_IGN}, {SIG_DFL}, 8) = 0
> 15969 21:36:59.218954 socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = 3
> 15969 21:36:59.219078 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
> ...
> 
> And here CGI writes out last part of the result, and exits:
> 
> ...
> 15971 21:37:02.378285 write(1, "vi</a><td class=sz>631650920<td class=dt>...
> 15971 21:37:02.378477 poll( <unfinished ...>
> 15972 21:37:02.378552 <... write resumed> ) = 1654
> 15972 21:37:02.378622 _exit(0)          = ?
> 15971 21:37:02.378746 <... poll resumed> [{fd=0, events=0}, {fd=3,
> events=POLLIN, revents=POLLHUP}, {fd=0, events=0}], 3, -1) = 1
> 15971 21:37:02.378833 read(3, "", 4096) = 0
> 15971 21:37:02.378937 shutdown(1, 1 /* send */) = 0
> 15971 21:37:02.379201 write(2, "[::ffff:127.0.0.1]:47252: closed\n", 33) = 33
> 15971 21:37:02.379546 _exit(0)          = ?
> 15969 21:37:05.224802 <... accept resumed> 0xffcbcaf4, [28]) = ? ERESTARTSYS
> (To be restarted)
> 
> See? We did not get SIGCHLD, since kernel knows we aren't interested. Now I
> Ctrl-C it:
> 
> 15969 21:37:05.224937 --- SIGINT (Interrupt) @ 0 (0) ---
> 15969 21:37:05.225069 +++ killed by SIGINT +++
> 
> I will attach complete LOG.
> 
> 
> I also ran "./busybox httpd -f -p88 -vvv -h /.1/video", then refreshed
> http://127.0.0.1:88/ a dozen times in the browser, then ran ps -A and I
> definitely do not see any zombies.
> 

But what did the web browser request from httpd in busybox?

I could see that if the browser requests regular files that it can serve
locally from /home/httpd/html/, or if it requests a cgi-bin script that resides
under /home/httpd/cgi-bin/ - everything works OK.
But, if it requires an execution of an external interpreter, using the PHP
external interpreter method, I get the described problem.

Is it possible that by the phrase "external interpreter" it is meant to be a
shell (or other) script, and not a C application so the shell can take care of
such signals?

Could it be that the C application should be implemented differently than the
httpd_indexcgi.c sample code, and maybe handle such signals on its own?

If so, could you point me to an example?


-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list