From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1474 Path: news.gmane.org!not-for-mail From: Charlie Brady Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: runit not collecting zombies Date: Thu, 12 Jul 2007 10:42:18 -0400 (EDT) Message-ID: References: <20070603111056.15978.qmail@3deb4a0e5d8414.315fe32.mid.smarden.org> <20070611131112.GA1576@home.power> <20070618134516.GA1560@home.power> <20070619181325.23252.qmail@a92f927aabd53f.315fe32.mid.smarden.org> <20070619190751.GC27090@home.power> <20070620162325.26345.qmail@7d91355cde742c.315fe32.mid.smarden.org> <20070620165736.GC12963@home.power> <20070620183532.4571.qmail@9f638fd8b69905.315fe32.mid.smarden.org> <20070623044205.GA1594@home.power> <20070626095920.6195.qmail@3e147d410b1c2c.315fe32.mid.smarden.org> <20070707071657.GA1517@home.power> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Trace: sea.gmane.org 1184251343 18779 80.91.229.12 (12 Jul 2007 14:42:23 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 12 Jul 2007 14:42:23 +0000 (UTC) Cc: supervision@list.skarnet.org To: Alex Efros Original-X-From: supervision-return-1711-gcsg-supervision=m.gmane.org@list.skarnet.org Thu Jul 12 16:42:20 2007 Return-path: Envelope-to: gcsg-supervision@gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by lo.gmane.org with smtp (Exim 4.50) id 1I8zs4-0005bP-OC for gcsg-supervision@gmane.org; Thu, 12 Jul 2007 16:42:20 +0200 Original-Received: (qmail 3158 invoked by uid 76); 12 Jul 2007 14:42:42 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 3152 invoked from network); 12 Jul 2007 14:42:41 -0000 X-X-Sender: charlieb@e-smith.charlieb.ott.istop.com In-Reply-To: Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1474 Archived-At: On Sat, 7 Jul 2007, Charlie Brady wrote: >> */1 * * * * ( cd /var/www/soft.p/html && exec chpst -L >> .lib/var/.lock.service runsvdir .lib/service/ &>/dev/null ) & > > So every minute cron will run a shell script, and then wait for it to finish. > Each shell script forks a subshell in the background and then exits, so cron > no longer waits. The subshell is reparented to process 1. When it exits, it > will become a zombie until process 1 reaps its status. Note a process forks you do not know whether parent or child runs first. With the above job, you are creating a situation where both parent and child will exit very quickly - the parent (shell) by reading EOF and then exiting, the child (subshell) by execing chpst which exits when it fails to get the lock. A common method of avoiding zombie processes is for a SIGCHILD handler in the parent to reap the status. I wonder whether there is possibility for SIGCHILD to be queued to the wrong process (due to a race during reparenting). Does runit as process 1 depend on SIGCHILD to reap zombies? Alex, are you running an SMP system (which would allow parent and child to both be scheduled simulateously)?