CC: | Pierre Phaneuf <pierre.phaneuf [...] seanodes.com> |
Subject: | Bug in perl-forks in SIGCHLD signal handler |
Date: | Thu, 30 Nov 2006 10:46:28 +0100 |
To: | bug-forks [...] rt.cpan.org |
From: | Alban Crequy <alban.crequy [...] seanodes.com> |
Hello,
I have a bug on perl-forks-0.19 in the SIGCHLD signal handler. When
reading the code of perl-forks-0.20, I think the bug is still present.
=== Hypothesis ===
In forks.pm:
unless ($FORCE_SIGCHLD_IGNORE) {
local $ENV{PATH} = "/bin:/usr/bin";
if (system('/bin/test') == -1) {
$SIG{CHLD} = sub { reaper::REAPER ( shift, \&REAPER ); };
$CUSTOM_SIGCHLD = 1;
} else {
$CUSTOM_SIGCHLD = 0;
}
}
I don't know what means the condition with /bin/test. I guess it is
something that says if we are running Windows or Linux (?)
Anyway, on Linux Mandriva, '/bin/test' does not exist: the "test"
program is in /usr/bin, not in /bin.
$ echo 'if (system("/bin/test") == -1) { print "yes\n"; } else { print
"no\n" } '|perl
yes
Maybe you want to use the $^O special variable? In "man perlvar":
$OSNAME
$^O The name of the operating system (...)
=== Symptoms ===
$ perl -v, uname -a, distro
This is perl, v5.8.7 built for i386-linux
Linux alban 2.6.12-25mdk #1 Fri Aug 18 15:09:47 MDT 2006 i686 Intel(R)
Pentium(R) 4 CPU 2.80GHz unknown GNU/Linux
Mandriva Linux release 2006.0 (Official) for i586
$ ps f
15317 pts/18 S+ 0:14 \_ /usr/bin/perl mytest
15319 pts/18 S+ 0:00 \_ /usr/bin/perl mytest
16405 pts/18 Z+ 0:00 \_ [mytest] <defunct>
$ strace -p 15317
read(3, <unfinished ...>
$ strace -p 15319
select(16, [6 7], NULL, NULL, NULL
$ ls -l /proc/1531[79]/fd/
/proc/15317/fd/:
total 5
lrwx------ 1 acrequy dev 64 Nov 30 09:01 0 -> /dev/pts/18
lrwx------ 1 acrequy dev 64 Nov 30 09:01 1 -> /dev/pts/18
lrwx------ 1 acrequy dev 64 Nov 30 08:45 2 -> /dev/pts/18
lrwx------ 1 acrequy dev 64 Nov 30 09:01 3 -> socket:[34560951]
lrwx------ 1 acrequy dev 64 Nov 30 09:01 7 -> socket:[34548781]
/proc/15319/fd/:
total 8
lrwx------ 1 acrequy dev 64 Nov 30 09:02 0 -> /dev/pts/18
lrwx------ 1 acrequy dev 64 Nov 30 09:02 1 -> /dev/pts/18
lrwx------ 1 acrequy dev 64 Nov 30 08:45 2 -> /dev/pts/18
lr-x------ 1 acrequy dev 64 Nov 30 09:02 3 -> /usr/bin/...
lr-x------ 1 acrequy dev 64 Nov 30 09:02 4 -> /usr/lib/...
lr-x------ 1 acrequy dev 64 Nov 30 09:02 5 -> /usr/lib/...
lrwx------ 1 acrequy dev 64 Nov 30 09:02 6 -> socket:[34548779]
lrwx------ 1 acrequy dev 64 Nov 30 09:02 7 -> socket:[34548782]
Process 15317 and 15319 are deadlocked.
I tested to run:
kill -SIGCHLD 15317 15319
but nothing happen: process stay deadlocked and strace show nothing new
(stay in read/select).
=== Reproductible ===
Reproduced 2 times. However, I have to run my program for ~12 hours
before the bug happens. I do not know how to reproduce the bug each
time.
Have a nice day,
Alban