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

[ID 19991118.011] IPC::Open3 calls die, not exit, on exec failure

David Blumenthal
November 18, 1999 16:47
[ID 19991118.011] IPC::Open3 calls die, not exit, on exec failure
Message ID:

This is a bug report for perl from,
generated with the help of perlbug 1.26 running under perl 5.00503.

[Please enter your report here]
In, version 1.0101, line 188/189, there is the following 

	exec @cmd
	    or croak "open3: exec of @cmd failed";

This code is executed after the process has forked.  This has the large
problem that if you run the code in an eval block, your child process will 
break out to the top of the block rather than die.

This caused a big problem for us, because we have code that runs in a
loop and executes functions in eval blocks.  The parent process was executing
an open3 command and the program to run wasn't in the path.  The exec
in the child process failed and the child process dropped back to the
end of the eval in the loop.  The parent sat waiting for the child to
terminate, and the child kept running in the loop.  The next phase of
the loop caused the same problem, and this kept happening until we had
40 copies of the application running and the server ran out of memory.

An easy solution to this problem is to make line 188 of print
the error to STDERR and call exit rather than calling croak.  The Open3
caller can then check the STDERR for the error.

[Please do not change anything below this line]

Site configuration information for perl 5.00503:

Configured by hartmans at Mon Nov  1 07:02:21 CST 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
    osname=dec_osf, osvers=4.0, archname=alpha-dec_osf
    uname='osf1 utwig v4.0 878 alpha '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=define d_sfio=define
    cc='cc', optimize='-O4', gccversion=
    cppflags='-std -ieee -D_INTRINSICS -I/prod/devtrees/hartmans/tools/sfio/include -I/usr/local/include -I/mesa/myarch/include -DLANGUAGE_C'
    ccflags ='-std -fprm d -ieee -D_INTRINSICS -I/prod/devtrees/hartmans/tools/sfio/include -I/usr/local/include -I/mesa/myarch/include -DLANGUAGE_C'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=8, ptrsize=8, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -L/prod/devtrees/hartmans/tools/sfio/src/lib/sfio -L/usr/local/lib'
    libpth=/prod/devtrees/hartmans/tools/sfio/src/lib/sfio /usr/local/lib /usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /var/shlib
    libs=-lsfio -ldbm -ldb -lm
    libc=/usr/shlib/, so=so, useshrplib=true,
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='  -Wl,-rpath,/mesa/arch/alpha_osf1/lib/perl5/5.00503/alpha-dec_osf/CORE'
    cccdlflags=' ', lddlflags='-shared -expect_unresolved "*" -O4 -msym -s -L/prod/devtrees/hartmans/tools/sfio/src/lib/sfio -L/usr/local/lib'

Locally applied patches:

@INC for perl 5.00503:

Environment for perl 5.00503:
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)
    SHELL=/bin/bash Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About