Skip Menu |

This queue is for tickets about the HTTP-Server-Simple CPAN distribution.

Report information
The Basics
Id: 71045
Status: open
Priority: 0/
Queue: HTTP-Server-Simple

People
Owner: Nobody in particular
Requestors: thaljef [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.44
Fixed in: (no value)



Subject: Can't reap my own children
At line 241 (of version 0.044): local $SIG{CHLD} = 'IGNORE'; # reap child processes According to the documenation[1], this means that I can't reap my own children if I'm running inside HTTP::Server::Simple. So things like system() and IPC::Run don't work properly. In fact, this very issue has surfaced in Dancer: https://github.com/sukria/Dancer/issues/499 It is possible to workaround by resetting $SIG{CHLD} in my code, but it isn't clear to me why that should be necessary anyway. Can you help me understand why HTTP::Server::Simple needs to have its children reaped automatically? Thanks! -Jeff [1] (from perldoc perlipc): On most Unix platforms, the "CHLD" (sometimes also known as "CLD") signal has special behavior with respect to a value of 'IGNORE'. Setting $SIG{CHLD} to 'IGNORE' on such a platform has the effect of not creating zombie processes when the parent process fails to "wait()" on its child processes (i.e. child processes are automatically reaped). Calling "wait()" with $SIG{CHLD} set to 'IGNORE' usually returns "−1" on such platforms. -- Jeffrey Thalhammer Imaginative Software Systems www.imaginative-software.com
On Sat Sep 17 23:18:25 2011, THALJEF wrote: Show quoted text
> At line 241 (of version 0.044): > > local $SIG{CHLD} = 'IGNORE'; # reap child processes > > According to the documenation[1], this means that I can't reap my own > children if I'm running inside HTTP::Server::Simple. So things like > system() and IPC::Run don't work properly. In fact, this very issue has > surfaced in Dancer: > > https://github.com/sukria/Dancer/issues/499
Looks like the Dancer bugtracker moved since this ticket was created (a while ago, sorry about that) Show quoted text
> It is possible to workaround by resetting $SIG{CHLD} in my code, but it > isn't clear to me why that should be necessary anyway. Can you help me > understand why HTTP::Server::Simple needs to have its children reaped > automatically? Thanks!
Unfortunately, the history isn't super helpful (and predates my work on the module) https://github.com/bestpractical/http-server-simple/commit/2ed82cc In RT (which makes heavy use of HTTP-Server-Simple for things) we actually do reset SIGCHLD in a number of places, which is probably why we don't run into this. I'd test a patch that replaces that SIGCHLD with a wait(), especially since we have some tests around it already in 01live.t -kevin