develooper Front page | perl.perl5.porters | Postings from November 2004

[perl #9117] backtick generates zombie processes

Thread Previous
From:
Steve Peters via RT
Date:
November 29, 2004 12:55
Subject:
[perl #9117] backtick generates zombie processes
Message ID:
rt-3.0.11-9117-101241.10.5610663373622@perl.org
> [root@snmon3.sinectis.com.ar - Tue Apr 30 06:35:55 2002]:
> 
> 
> This is a bug report for perl from hernan@hmasci.hq.sinectis.com.ar,
> generated with the help of perlbug 1.33 running under perl v5.6.1.
> 
> 
> -----------------------------------------------------------------
> [Please enter your report here]
> 
> When trying to execute a "backtick command" where the command fails
> (i.e.: the command even exist!), the process forked to EXECute the
> command goes to zombie state.
> Just trying this:
> 
> shell>> vi x.pl:
> 
> #!/usr/bin/perl
> while (sleep 1) {
> 	`non_existing_command`;
> }
> 
> 
> shell>> chmod a+x x.pl
> shell>> ./x.pl &
> 
> .... and few seconds later I get:
> 
> shell>> ps auwx|grep x.pl
> 
> root     21708  0.0  0.2  2360 1068 pts/1    S    17:17   0:00 perl
> ./x.pl
> root     21715  0.0  0.0     0    0 pts/1    Z    17:17   0:00 [x.pl
> <defunct>]
> root     21723  0.0  0.0     0    0 pts/1    Z    17:17   0:00 [x.pl
> <defunct>]
> ....
> root     21858  0.0  0.0     0    0 pts/1    Z    17:17   0:00 [x.pl
> <defunct>]
> 
> WHAT SIMPLE!!!!
> 
> but it only manifests if the system is RedHat Linux 6.2 and the Perl
> version
> is 5.6.1 (I've tested it on the same system with perl 5.00x and on
> Solaris 2.6
> and 2.8 with perl 5.6.1, and it does't happens, the children die
> gracefully)
> 
> If you try the same script but this way:
> 
> shell>> perl ./x.pl
> 
> .... or if you try this script:
> (notice the ":;" before the command)
> 
> shell>> vi x.pl
> 
> #!/usr/bin/perl
> while (sleep 1) {
>     `:;non_existing_command`;
> }
> 
> .... you won't see zombie processes (I don't know why), and you'll
> see:
> sh: non_existing_command: command not found
> 

There was an issue in the Linux kernel where forked pthreads would wait
until the parent process ended before truly ending themselves.  The
following email thread discusses the issue:  
http://lists.gnu.org/archive/html/bug-glibc/2000-12/msg00022.html

Considering this was run on a 2.2.18 kernel and Alan Cox was going to
look into it starting at 2.2.19, I'd sugest updating your kernel.

Thread Previous


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