develooper Front page | perl.perl5.porters | Postings from December 2007

[perl #49073] SIGTERM not terminating child process

Thread Next
From:
Jerry D. Hedden
Date:
December 24, 2007 08:29
Subject:
[perl #49073] SIGTERM not terminating child process
Message ID:
rt-3.6.HEAD-4716-1198511443-1995.49073-75-0@perl.org
# New Ticket Created by  "Jerry D. Hedden" 
# Please include the string:  [perl #49073]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=49073 >


This is a bug report for perl from jdhedden[at]cpan[dot]org,
generated with the help of perlbug 1.36 running under perl 5.11.0.
-----------------------------------------------------------------

'make test' in blead has been failing for me with:

ext/Time/HiRes/t/HiRes........................................FAILED--non-zero
wait status: 15

The cause is that SIGTERM to a child process does not always
kill it as illustrated by the test script below (also
attached):

    #!/usr/bin/perl

    use strict;
    use warnings;

    print("Main process = $$\n");

    my $child_pid = fork();

    if ($child_pid == 0) {
        # Child process
        print("Child process = $$\n");
        sleep(60);

        # Should not get here because child will be killed by SIGTERM
        print(">>> BUG: Child process should have terminated\n");
    }

    sleep(2);   # Let child process start

    print("Main process ($$) terminating child process ($child_pid)\n");
    kill('TERM', $child_pid);

    sleep(1);
    print("Main process done\n");

This script frequently outputs:

    Main process = 656
    Child process = 868
    Main process (656) terminating child process (868)
    >>> BUG: Child process should have terminated
    Main process done

This shows that the SIGTERM to the child process is knocking
it out of its sleep call, but is not terminating the
process.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=high
---
Site configuration information for perl 5.11.0:

Configured by Jerry at Mon Dec 24 08:14:26 EST 2007.

Summary of my perl5 (revision 5 version 11 subversion 0 patch 32719)
configuration:
  Platform:
    osname=cygwin, osvers=1.5.25(0.15642), archname=cygwin-thread-multi-64int
    uname='cygwin_nt-5.1 seymour 1.5.25(0.15642) 2007-12-14 19:21 i686 cygwin '
    config_args='-de -Dusedevel -Dversiononly=no -Dinstallusrbinperl
-DPERL_OLD_COPY_ON_WRITE -Duse64bitint -Dusethreads -Uusemymalloc
-Dnoextensions=attrs IPC/SysV Sys/Syslog Devel/DProf Devel/Peek re
Text/Soundex Math/BigInt/FastCalc Time/Piece -A append:ccflags=
-DPL_OP_SLAB_ALLOC -DNO_MATHOMS -A define:optimize=-Os -pipe
-funit-at-a-time -march=pentium4 -mfpmath=sse -mieee-fp -mmmx -msse
-msse2'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__
-DPL_OP_SLAB_ALLOC -DNO_MATHOMS -fno-strict-aliasing -pipe',
    optimize='-Os -pipe -funit-at-a-time -march=pentium4 -mfpmath=sse
-mieee-fp -mmmx -msse -msse2',
    cppflags='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__
-DPL_OP_SLAB_ALLOC -DNO_MATHOMS -fno-strict-aliasing -pipe'
    ccversion='', gccversion='3.4.4 (cygming special, gdc 0.12, using
dmd 0.125)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long long', ivsize=8, nvtype='double', nvsize=8,
Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='g++', ldflags =' -Wl,--enable-auto-import
-Wl,--export-all-symbols -Wl,--stack,8388608
-Wl,--enable-auto-image-base -Wl,--enable-auto-import -s
-L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib /lib
    libs=-ldl -lcrypt
    perllibs=-ldl -lcrypt
    libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' -s'
    cccdlflags=' ', lddlflags=' --shared  -Wl,--enable-auto-import
-Wl,--export-all-symbols -Wl,--stack,8388608
-Wl,--enable-auto-image-base -Wl,--enable-auto-import -s
-L/usr/local/lib'

Locally applied patches:
    DEVEL

---
@INC for perl 5.11.0:
    /usr/lib/perl5/5.11.0/cygwin
    /usr/lib/perl5/5.11.0
    .

---
Environment for perl 5.11.0:
    CYGWIN=ntsec
    HOME=/home/Jerry
    LANG=C
    LANGUAGE=C
    LC_ALL=C
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/Jerry/bin:/usr/local/src/perl/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/c/Dev-Cpp/bin/:/c/Defrag:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/Program
Files/ATI Technologies/ATI Control
Panel:/c/PROGRA~1/COMMON~1/SONICS~1:/c/Program
Files/QuickTime/QTSystem/:.
    PERLIO=perlio
    PERL_BADLANG (unset)
    SHELL (unset)


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