develooper Front page | perl.perl5.porters | Postings from July 2013

[perl #114722] [PATCH] Reap child in case where exception has been thrown

Thread Previous | Thread Next
From:
Tony Cook via RT
Date:
July 25, 2013 06:07
Subject:
[perl #114722] [PATCH] Reap child in case where exception has been thrown
Message ID:
rt-3.6.HEAD-2552-1374732455-440.114722-15-0@perl.org
On Wed Sep 05 18:35:49 2012, jkeenan wrote:
> Your demonstration program, open3bug, uses 'pstree', which appears to be
> Linux-specific.  Would you have an equivalent way of demonstrating the
> bug on a system that lacks 'pstree' (as my Darwin does)?  That might
> elicit more responses.

A simpler way to demonstrate it, in one terminal:

# cwd is a built blead
pallas:perl tony$ ./perl -Ilib -MIPC::Open3 -le 'for (1..10) { my ($in,
$out); eval { my $pid = open3($in, $out, "", "unknownprogram");
waitpid($pid, 0) }; } sleep 100'

in another:

pallas:~ tony$ ps w
  PID   TT  STAT      TIME COMMAND
 7361 s002  Ss     0:00.03 -bash
40376 s002  S+     0:00.02 ./perl -Ilib -MIPC::Open3 -le for (1..10) {
my ($in, $out); eval { my $pid = open3($in, $out, "", "unkno
40377 s002  Z+     0:00.00 (perl)
40378 s002  Z+     0:00.00 (perl)
40379 s002  Z+     0:00.00 (perl)
40380 s002  Z+     0:00.00 (perl)
40381 s002  Z+     0:00.00 (perl)
40382 s002  Z+     0:00.00 (perl)
40383 s002  Z+     0:00.00 (perl)
40384 s002  Z+     0:00.00 (perl)
40385 s002  Z+     0:00.00 (perl)
40386 s002  Z+     0:00.00 (perl)
40303 s003  Ss     0:00.01 -bash

(the processes with the Z+ flags are zombies)

The patch fixes the problem.

I'll apply this in a couple of days unless someone points out a problem
with it (along with an AUTHORS update and version bump)

Tony

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

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