From owner-freebsd-stable Wed Sep 6 13:37: 4 2000 Delivered-To: freebsd-stable@freebsd.org Received: from karon.dynas.se (karon.dynas.se [192.71.43.4]) by hub.freebsd.org (Postfix) with SMTP id 32E2537B42C for ; Wed, 6 Sep 2000 13:37:01 -0700 (PDT) Received: (qmail 65050 invoked from network); 6 Sep 2000 20:36:56 -0000 Received: from spirit.sto.dynas.se (HELO spirit.dynas.se) (172.16.1.10) by karon.sto.dynas.se with SMTP; 6 Sep 2000 20:36:56 -0000 Received: (qmail 3574 invoked from network); 6 Sep 2000 20:36:59 -0000 Received: from explorer.rsa.com (10.81.217.59) by spirit.dynas.se with SMTP; 6 Sep 2000 20:36:59 -0000 Received: (from mikko@localhost) by explorer.rsa.com (8.9.3/8.9.3) id NAA19883; Wed, 6 Sep 2000 13:36:53 -0700 (PDT) (envelope-from mikko) Date: Wed, 6 Sep 2000 13:36:53 -0700 (PDT) From: Mikko Tyolajarvi Message-Id: <200009062036.NAA19883@explorer.rsa.com> To: Cy.Schubert@uumail.gov.bc.ca Cc: freebsd-stable@freebsd.org Subject: Re: running lyris for linux makes many zombies Newsgroups: local.freebsd-stable References: Your message of "Wed, 06 Sep 2000 13:03:14 EDT." <14774.30930.120103.685216@onceler.kciLink.com> <200009061756.e86Huaa75647@cwsys.cwsent.com> X-Newsreader: NN version 6.5.6 (NOV) Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In local.freebsd-stable you write: >In message <14774.30930.120103.685216@onceler.kciLink.com>, Vivek Khera >writes: >> On a FreeBSD 4.1-S cvsup'd yesterday, I'm running Lyris 4.0 for linux >> (with the security patches installed). I had been running this on a >> RedHat 6.0 system quite well, but I'd rather rid myself of that system >> ;-) >> >> Anyhow, I'm getting *lots* of zombie processes being left around after >> processing a few messages, and the number keeps growing. This did not >> happen on the "real" linux system. >> >> Is there some knob I can turn on in the linux compatibility system to >> get the zombies to be reaped properly? I have COMPAT_LINUX defined in >> my kernel so the linux compat is statically linked into the kernel. >Lyris is failing to issue a wait(2) call to obtain the exit status of >children that have terminated. The kernel will keep a a process table >entry for the terminated child until the exit status has been fetched >by its parent. >My guess the reason Linux doesn't have any zombies is that the Linux >init(8) is getting involved to fetch the status and clean up after the >application. This is not standard UNIX. What FreeBSD is doing, e.g. >nothing as it's an application issue, is the correct thing to do. >IIRC, there are some differences between SYSV and BSD in this regard, >though I cannot remember the details and I don't have Stevens' book >here to reference. On SYSV (and Linux) doing "signal(SIGCHLD, SIG_IGN)" is sufficient to get rid of zombies. On BSD, you have to use sigaction() with the SA_NOCLDWAIT flag to get the same result. (Two minutes later) Yes, the following Q&D program does not leave a zombie child on linux. But when the linux-compiled binary is run under the linuxulator, it does leave a zombie. I.e. linuxulator bug. #include int main() { int pid; signal(SIGCHLD, SIG_IGN); if ((pid = (int)fork()) == 0) { exit(0); } printf("Child is %d, go look for it!\n", pid); sleep(30); } The same source compiled under FreeBSD also leaves a zombie, but that is an entirely different matter (it is supposed to). $.02, /Mikko -- Mikko Työläjärvi_______________________________________mikko@rsasecurity.com RSA Security To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message