develooper Front page | perl.perl5.porters | Postings from September 2012

[perl #18849] fork/system bug on FreeBSD

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
September 27, 2012 18:41
Subject:
[perl #18849] fork/system bug on FreeBSD
Message ID:
rt-3.6.HEAD-11172-1348796483-538.18849-15-0@perl.org
On Fri Jun 13 07:04:22 2003, alan wrote:
> On 12 Jun 2003, Jarkko Hietaniemi wrote:
> 
> > On Thu, Jun 12, 2003 at 12:57:42PM -0400, alan wrote:
> > > Thanks.  Now I'm even more confused  :)
> >
> > That's what I'm here for :-)
> 
> As far as I can tell from reading all the man page snippets you've
> sent, the expected behavior is the same everywhere (except possibly
> for the specific varieties of wait() call which will wait for all
> children).  I don't have any good ideas on why versions other than BSD
> don't fail (I can't believe every OS has left it unimplemented as RH
> did).
> 
> I'm hesitatant to suggest removing SA_NOCLDWAIT completely, for fear
> of creating zombies on random platforms.  So, if there's a convenient
> way to identify the affected BSD systems with macros, my patch
> suggestion is still to tweak util.c to stop using SA_NOCLDWAIT on
> platforms where it has been identified as a problem.
> 
> Thanks,
> 
> Alan Ferrency
> 
> > > All of these man pages say the same thing that FreeBSD's man page
> > > says: if SA_NOCLDWAIT is in force, and you wait(), it'll wait for
> All
> > > children to exit.  I wonder why FreeBSD seems to be the only OS
> which
> > > exhibits this behavior in Perl?
> > >
> > > In the original bug report, I sent a short C program which, in
> > > FreeBSD, duplicates the behavior I'm seeing in Perl.  Without
> > > SA_NOCLDWAIT it exits quickly; with SA_NOCLDWAIT it exits in 120
> > > seconds, instead.
> > >
> > > If you have Even More Time To Kill, can you see if this compiles
> on
> > > something other than FreeBSD, and if so, what it does for you?
> >
> > Compiled and tested in:
> >
> > Tru64/alpha 5.1B:	runs quickly to completion
> > Solaris/sparc 8:	runs quickly to completion
> > Debian/x86 3.0:		runs quickly to completion
> > AIX/ppc	4.3.1.0:	runs quickly to completion (1)
> > IRIX/mips 5.1:		runs quickly to completion (2) (3)
> > MacOSX/10.2.6:		the 2-minute wait
> >
> > (1) "If SA_NOCLDWAIT is set, and sig equals SIGCHLD, child processes
> of
> > the calling processes will not be transformed into zombie processes
> > when they terminate. If the calling process subsequently waits for
> its
> > children, and the process has no unwaited for children that were
> > transformed into zombie processes, it will block until all of its
> > children terminate, and wait, wait3, waitid and waitpid will fail
> and
> > set errno to ECHILD. Otherwise, terminating child processes will be
> > transformed into zombie processes, unless SIGCHLD is set to
> SIG_IGN."
> >
> > (2)       "SA_NOCLDWAIT If set and sig equals SIGCHLD, the system
> will not
> >                         create zombie processes when children of the
> calling
> >                         process exit.  If the calling process
> subsequently
> >                         issues a wait(2), it blocks until all of the
> calling
> >                         process's child processes terminate, and
> then returns a
> >                         value of -1 with errno set to ECHILD."
> >
> > (3) No wait4() in IRIX, waitpid() used instead.
> >
> > --
> > Jarkko Hietaniemi <jhi@iki.fi> http://www.iki.fi/jhi/ "There is this
> special
> > biologist word we use for 'stable'.  It is 'dead'." -- Jack Cohen
> >
> 
> 

This RT has been collecting dust for more than nine years.  Are there
any BSD experts out there who could review the discussion and make a
recommendation?

Thank you very much.
Jim Keenan

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=18849

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About