system() with timeout

Matt Lawrence matt.lawrence at
Fri Apr 17 12:14:43 BST 2009

Aaron Crane wrote:
> Matt Lawrence writes:
>> I recently discovered that die() inside a signal handler causes a
>> memory leak.[...]  I guess that might be related to the problem you
>> were having before timing out system().
> Unlikely. [...]
> There's an additional problem when the underlying waitpid is interrupted
> like this: nothing ever waits for the child process, until the parent
> process exits, when the child gets reparented by init(8).  That can be
> worked around by, for example, ignoring SIGCHLD, or calling wait() at
> suitable points in your Perl code.
Of course. It didn't occur to me that it was normal for child processes 
to zombie like that. I somehow imagined that some other internal cleanup 
was failing, causing both the leak and the failure to reap the child.


More information about the mailing list