Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.85k stars 523 forks source link

perl breaks silently with IPC::Open3 #4213

Closed p5pRT closed 20 years ago

p5pRT commented 22 years ago

Migrated from rt.perl.org#7284 (status was 'resolved')

Searchable as RT7284$

p5pRT commented 22 years ago

From herbert.wengatz@mchr2.siemens.de

Hi!

This is sort of continuation of Bug-ID​: 20010629.002\, since I tried it now with 5.7.1\, too. Here the reaction is different but not really better\, insofar that perl no longer "moans" about the problems it has\, but silently dies away.

I currently have 3 different versions of perl on my machine​: 5.7.1\, 5.6.1 and 5.005_03. They all don't handle the issue properly.

I posted this problem to the perl mongers mailinglist in Munich\, Bavaria and all I got was the acknowledgement that there really is a problem. Some of them got coredumps and I can send you even some stack traces of the cores\, if you wish.

The problem is visible on almost all Unix-OS'es. Linux 2.2.x\, FreeBSD 4.3-stable\, Solaris 2.6\, 7 and 8\, Irix and HP-UX 11. (M$- OSes not tried yet)

Many of the perl mongers in Munich are worried about this\, since some of them use perl in a "mission critical" environment. One of them is Eike Grote\, who translated some of the O'Reilly Perl Books into german.

You should look up the original script in BUG-ID 20010629.002 (No need to put the code in here twice\, even though it's not long).

As I said\, under perl5.7.1 the behaviour has become not much better. It no longer moans about the problems it has... :-( I prefer being informed when my program dies away.

Eike Grote also may have found something that may help. It includes installing a signalhandler (not a bad idea either). But there still may be some issues not properly solved. We haven't tested the possible workaround much until now.

If the answer for the problem should be the installation of the signal handler\, I recommend to include that as an important hint into the "Cookbook"\, from where we had the basic concept.

Below comes the output of perlbug -d for my perl5.7.1.

Best regards\,

Herbert

-- Herbert Wengatz Phone MchP​: +49 (0)89 / 636 - 47677 I&S IT PS 8 Phone MchH​: +49 (0)89 / 722 - 49296 Siemens AG Mobile : +49 (0)160 / 8 85 16 85 Otto Hahn Ring 6 Fax MchP​: +49 (0)89 / 636 - 47586 81738 Muenchen mailto​:herbert.wengatz@​mchr2.siemens.de   http​://www.aida-ix.net


Flags​:   category=core   severity=fatal


This perlbug was built using Perl v5.6.1 - Thu Jun 21 10​:08​:59 MEST 2001 It is being executed now by Perl v5.7.1 - Fri Jul 13 17​:07​:03 MEST 2001.

Site configuration information for perl v5.7.1​:

Configured by hwe at Fri Jul 13 17​:07​:03 MEST 2001.

Summary of my perl5 (revision 5.0 version 7 subversion 1) configuration​:   Platform​:   osname=linux\, osvers=2.2.19\, archname=i686-linux   uname='linux elrond 2.2.19 #3 tue jul 3 10​:58​:10 mest 2001 i686 unknown '   config_args='-Dprefix=/vmware/perl -Doptimze=-O2 -march=i686'   hint=recommended\, useposix=true\, d_sigaction=define   usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef   useperlio=define d_sfio=undef uselargefiles=define usesocks=undef   use64bitint=undef use64bitall=undef uselongdouble=undef   Compiler​:   cc='gcc'\, ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'\,   optimize='-O2 -march=i686'\,   cppflags='-fno-strict-aliasing -I/usr/local/include'   ccversion=''\, gccversion='2.95.2 19991024 (release)'\, gccosandvers=''   intsize=4\, longsize=4\, ptrsize=4\, doublesize=8\, byteorder=1234   d_longlong=define\, longlongsize=8\, d_longdbl=define\, longdblsize=12   ivtype='long'\, ivsize=4\, nvtype='double'\, nvsize=8\, Off_t='off_t'\, lseeksize=8   alignbytes=4\, usemymalloc=n\, prototype=define   Linker and Libraries​:   ld='gcc'\, ldflags =' -L/usr/local/lib'   libpth=/usr/local/lib /lib /usr/lib   libs=-lnsl -lndbm -lgdbm -ldbm -ldb -ldl -lm -lc -lposix -lcrypt -lutil   perllibs=-lnsl -ldl -lm -lc -lposix -lcrypt -lutil   libc=\, so=so\, useshrplib=false\, libperl=libperl.a   Dynamic Linking​:   dlsrc=dl_dlopen.xs\, dlext=so\, d_dlsymun=undef\, ccdlflags='-rdynamic'   cccdlflags='-fpic'\, lddlflags='-shared -L/usr/local/lib'

Locally applied patches​:  


@​INC for perl v5.7.1​:   /vmware/perl/lib/5.7.1/i686-linux   /vmware/perl/lib/5.7.1   /vmware/perl/lib/site_perl/5.7.1/i686-linux   /vmware/perl/lib/site_perl/5.7.1   /vmware/perl/lib/site_perl   .


Environment for perl v5.7.1​:   HOME=/.root_home   LANG=de_DE   LANGUAGE (unset)   LC_COLLATE=POSIX   LD_LIBRARY_PATH (unset)   LOGDIR (unset)   PATH=/usr/sbin​:/bin​:/usr/bin​:/sbin​:/usr/X11R6/bin   PERL_BADLANG (unset)   SHELL=/bin/sh

p5pRT commented 22 years ago

From @gsar

On Mon\, 16 Jul 2001 11​:04​:55 +0200\, Wengatz Herbert wrote​:

This is sort of continuation of Bug-ID​: 20010629.002\, since I tried it now with 5.7.1\, too. Here the reaction is different but not really better\, insofar that perl no longer "moans" about the problems it has\, but silently dies away.

I currently have 3 different versions of perl on my machine​: 5.7.1\, 5.6.1 and 5.005_03. They all don't handle the issue properly.

I see that your code in 20010629.002 uses a $SIG{CHLD} handler. This is not safe.

$SIG{CHLD} = 'IGNORE' might make it safe\, assuming the platform(s) you're running this on can autoreap.

The second alternative (probably the one that works almost everywhere) is to not set $SIG{CHLD} at all\, and just make sure you periodically wait()/waitpid() for your children. Consider non-blocking waitpid() before giving up on this way of doing it.

Sarathy gsar@​ActiveState.com

p5pRT commented 22 years ago

From @gsar

On Mon\, 16 Jul 2001 08​:15​:33 PDT\, Gurusamy Sarathy wrote​:

I see that your code in 20010629.002 uses a $SIG{CHLD} handler. This is not safe.

$SIG{CHLD} = 'IGNORE' might make it safe\, assuming the platform(s) you're running this on can autoreap.

The second alternative (probably the one that works almost everywhere) is to not set $SIG{CHLD} at all\, and just make sure you periodically wait()/waitpid() for your children. Consider non-blocking waitpid() before giving up on this way of doing it.

I forgot to add that 5.7.2 should have "safe signals" (finally!) so please also try running your code unmodified under 5.7.2 first.

Sarathy gsar@​ActiveState.com

p5pRT commented 22 years ago

From [Unknown Contact. See original ticket]

Dear Gurusamy Sarathy\,

I have the bad news\, that my original code still breaks silently away.

I have to admit that it seems to me to run with 5.7.2 more stable than before\, but it defnitely breaks. And it dies away without a famous last word. :( (under Linux 2.2.19)

I'll try tomorrow with some other machines\, too. (HP-UX 11\, Irix\, Solaris 2.x)

I have posted my script to the local perl mongers here in Munich and most of them have almost the same results on their systems. The only one that seems to be rock solid is a guy with an Linux 2.4.x running. - Even with perl 5.6.1. (I doubt him\, I want to check this tonight at home with my private PC).

We also have tried to find out if the problem arises from the eventual zombies that we create. But it wasn't that. It seems more to be a problem of memmory allocation. When there is a huge load on the memmory bus it seems\, then perl breaks. Under Solaris\, one of our perl mongers reported problems with mmap(). It seems it breaks under Solaris in an "out of memory" situation. - But in his case\, it was a 4 CPU Machine with 4 GB of RAM which was running idle\, except for my script. So I guess we can rule out an "out of memmory" situation. (It is a new 420R with Solaris 8. - Solaris 8 seemed to be quite stable with an uniprocessor\, too)

Since Linux 2.4.x seems to be fine\, I guess meanwhile that this may become an operating system dependant issue. :-(

I'd like to stick to my signal handler. - Because\, of course\, I want to be able to handle signals with my scripts. - Maybe your other idea about nonblocking waitpid() is the solution. - I'll try tomorrow (now I have to leave the office...) and I'll report to you.

Best regards\,

  Herbert

PS​: A BIG "Thank you" for your help!

Gurusamy Sarathy wrote​:

On Mon\, 16 Jul 2001 08​:15​:33 PDT\, Gurusamy Sarathy wrote​:

I see that your code in 20010629.002 uses a $SIG{CHLD} handler. This is not safe.

$SIG{CHLD} = 'IGNORE' might make it safe\, assuming the platform(s) you're running this on can autoreap.

The second alternative (probably the one that works almost everywhere) is to not set $SIG{CHLD} at all\, and just make sure you periodically wait()/waitpid() for your children. Consider non-blocking waitpid() before giving up on this way of doing it.

I forgot to add that 5.7.2 should have "safe signals" (finally!) so please also try running your code unmodified under 5.7.2 first.

Sarathy gsar@​ActiveState.com

p5pRT commented 22 years ago

From [Unknown Contact. See original ticket]

Dear all\,

I'm very sorry\, but I could verify that my example breaks even perl 5.7.2 at least under Linux 2.2.19 and Linux 2.4.2. - Even though it was harder.

What I did was especially moving a huge xterm like mad on my screen and after a while select another one. - This usually creates a high load on the mem bus and that will break it.

I assume\, it's still the only alternative to use​:

$SIG{CHLD} = 'IGNORE';

With this\, thousands of runs without any error are possible.

Thank you so far. - If you believe you come up with really safe signals\, I volunteer for testing!

Best regards\,

  Herbert

Gurusamy Sarathy wrote​:

On Mon\, 16 Jul 2001 08​:15​:33 PDT\, Gurusamy Sarathy wrote​:

I see that your code in 20010629.002 uses a $SIG{CHLD} handler. This is not safe.

$SIG{CHLD} = 'IGNORE' might make it safe\, assuming the platform(s) you're running this on can autoreap.

The second alternative (probably the one that works almost everywhere) is to not set $SIG{CHLD} at all\, and just make sure you periodically wait()/waitpid() for your children. Consider non-blocking waitpid() before giving up on this way of doing it.

I forgot to add that 5.7.2 should have "safe signals" (finally!) so please also try running your code unmodified under 5.7.2 first.

Sarathy gsar@​ActiveState.com

p5pRT commented 22 years ago

From [Unknown Contact. See original ticket]

This is sort of continuation of Bug-ID​: 20010629.002\, since I tried it now with 5.7.1\, too. Here the reaction is different but not really better\, insofar that perl no longer "moans" about the problems it has\, but silently dies away.

I currently have 3 different versions of perl on my machine​: 5.7.1\, 5.6.1 and 5.005_03. They all don't handle the issue properly.

I posted this problem to the perl mongers mailinglist in Munich\, Bavaria and all I got was the acknowledgement that there really is a problem. Some of them got coredumps and I can send you even some stack traces of the cores\, if you wish.

The problem is visible on almost all Unix-OS'es. Linux 2.2.x\, FreeBSD 4.3-stable\, Solaris 2.6\, 7 and 8\, Irix and HP-UX 11. (M$- OSes not tried yet)

Many of the perl mongers in Munich are worried about this\, since some of them use perl in a "mission critical" environment. One of them is Eike Grote\, who translated some of the O'Reilly Perl Books into german.

You should look up the original script in BUG-ID 20010629.002 (No need to put the code in here twice\, even though it's not long).

As I said\, under perl5.7.1 the behaviour has become not much better. It no longer moans about the problems it has... :-( I prefer being informed when my program dies away.

Eike Grote also may have found something that may help. It includes installing a signalhandler (not a bad idea either). But there still may be some issues not properly solved. We haven't tested the possible workaround much until now.

If the answer for the problem should be the installation of the signal handler\, I recommend to include that as an important hint into the "Cookbook"\, from where we had the basic concept.

Below comes the output of perlbug -d for my perl5.7.1.

Best regards\,

Herbert

-- Herbert Wengatz Phone MchP​: +49 (0)89 / 636 - 47677 I&S IT PS 8 Phone MchH​: +49 (0)89 / 722 - 49296 Siemens AG Mobile : +49 (0)160 / 8 85 16 85 Otto Hahn Ring 6 Fax MchP​: +49 (0)89 / 636 - 47586 81738 Muenchen mailto​:herbert.wengatz@​mchr2.siemens.de   http​://www.aida-ix.net


Flags​:   category=core   severity=fatal


This perlbug was built using Perl v5.6.1 - Thu Jun 21 10​:08​:59 MEST 2001 It is being executed now by Perl v5.7.1 - Fri Jul 13 17​:07​:03 MEST 2001.

Site configuration information for perl v5.7.1​:

Configured by hwe at Fri Jul 13 17​:07​:03 MEST 2001.

Summary of my perl5 (revision 5.0 version 7 subversion 1) configuration​:   Platform​:   osname=linux\, osvers=2.2.19\, archname=i686-linux   uname='linux elrond 2.2.19 #3 tue jul 3 10​:58​:10 mest 2001 i686 unknown '   config_args='-Dprefix=/vmware/perl -Doptimze=-O2 -march=i686'   hint=recommended\, useposix=true\, d_sigaction=define   usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef   useperlio=define d_sfio=undef uselargefiles=define usesocks=undef   use64bitint=undef use64bitall=undef uselongdouble=undef   Compiler​:   cc='gcc'\, ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'\,   optimize='-O2 -march=i686'\,   cppflags='-fno-strict-aliasing -I/usr/local/include'   ccversion=''\, gccversion='2.95.2 19991024 (release)'\, gccosandvers=''   intsize=4\, longsize=4\, ptrsize=4\, doublesize=8\, byteorder=1234   d_longlong=define\, longlongsize=8\, d_longdbl=define\, longdblsize=12   ivtype='long'\, ivsize=4\, nvtype='double'\, nvsize=8\, Off_t='off_t'\, lseeksize=8   alignbytes=4\, usemymalloc=n\, prototype=define   Linker and Libraries​:   ld='gcc'\, ldflags =' -L/usr/local/lib'   libpth=/usr/local/lib /lib /usr/lib   libs=-lnsl -lndbm -lgdbm -ldbm -ldb -ldl -lm -lc -lposix -lcrypt -lutil   perllibs=-lnsl -ldl -lm -lc -lposix -lcrypt -lutil   libc=\, so=so\, useshrplib=false\, libperl=libperl.a   Dynamic Linking​:   dlsrc=dl_dlopen.xs\, dlext=so\, d_dlsymun=undef\, ccdlflags='-rdynamic'   cccdlflags='-fpic'\, lddlflags='-shared -L/usr/local/lib'

Locally applied patches​:  


@​INC for perl v5.7.1​:   /vmware/perl/lib/5.7.1/i686-linux   /vmware/perl/lib/5.7.1   /vmware/perl/lib/site_perl/5.7.1/i686-linux   /vmware/perl/lib/site_perl/5.7.1   /vmware/perl/lib/site_perl   .


Environment for perl v5.7.1​:   HOME=/.root_home   LANG=de_DE   LANGUAGE (unset)   LC_COLLATE=POSIX   LD_LIBRARY_PATH (unset)   LOGDIR (unset)   PATH=/usr/sbin​:/bin​:/usr/bin​:/sbin​:/usr/X11R6/bin   PERL_BADLANG (unset)   SHELL=/bin/sh

p5pRT commented 22 years ago

From @schwern

PS The Debian/x86 Linux/2.2 machine used was under load when the test was run. Here's top​:

  9​:20pm up 95 days\, 9​:41\, 8 users\, load average​: 1.35\, 2.01\, 2.70 149 processes​: 146 sleeping\, 2 running\, 1 zombie\, 0 stopped CPU states​: 42.1% user\, 12.6% system\, 0.0% nice\, 45.1% idle Mem​: 257568K av\, 255484K used\, 2084K free\, 69780K shrd\, 5504K buff Swap​: 995988K av\, 34712K used\, 961276K free 48868K cached

  PID USER PRI NI SIZE RSS SHARE STAT LIB %CPU %MEM TIME COMMAND 29036 crown 18 0 4888 4888 1256 R 0 46.6 1.8 0​:04 update_itemc 29040 mysql 16 0 24788 17M 3364 S 0 38.7 6.9 0​:10 mysqld 25832 www-data 3 0 16536 10M 2828 S 0 5.3 4.2 0​:02 apache 25937 mysql 3 0 24788 17M 3364 S 0 5.0 6.9 0​:04 mysqld 28880 schwern 7 0 980 980 688 R 0 3.8 0.3 0​:10 top 29041 mysql 7 0 24788 17M 3364 S 0 3.6 6.9 0​:00 mysqld 29046 www-data 3 0 13824 8200 2804 S 0 3.2 3.1 0​:01 apache 14695 resort 0 0 12968 8684 1268 S 0 1.1 3.3 553​:15 resort 29057 mysql 1 0 24788 17M 3364 S 0 1.1 6.9 0​:00 mysqld 29022 www-data 1 0 13952 8332 2824 S 0 0.5 3.2 0​:01 apache 2185 www-data 0 0 16344 10M 2384 S 0 0.1 4.2 0​:04 apache 28865 root 0 0 1640 1616 1112 S 0 0.1 0.6 0​:00 sshd   1 root 0 0 104 64 48 S 0 0.0 0.0 6​:18 init   2 root 0 0 0 0 0 SW 0 0.0 0.0 34​:24 kflushd   3 root 0 0 0 0 0 SW 0 0.0 0.0 42​:26 kupdate   4 root 0 0 0 0 0 SW 0 0.0 0.0 0​:00 kpiod   5 root 0 0 0 0 0 SW 0 0.0 0.0 221​:21 kswapd

--

Michael G. Schwern \schwern@​pobox\.com http​://www.pobox.com/~schwern/ Perl6 Quality Assurance \perl\-qa@​perl\.org Kwalitee Is Job One Don't step on my funk