Perl / perl5

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

«only "parent" interpreter can diddle signals» #11885

Open p5pRT opened 12 years ago

p5pRT commented 12 years ago

Migrated from rt.perl.org#108758 (status was 'new')

Searchable as RT108758$

p5pRT commented 12 years ago

From @Leont

This is a bug report for perl from fawaka@​gmail.com\, generated with the help of perlbug 1.39 running under perl 5.14.2.


Currently\, %SIG doesn't set the system level signal handler for threads other than the main thread (a feature commented in 7-fold with the title of this bug report). This means that one can not set a signal handler for system signals unless the parent thread also has set a signal handler for it (threads.pm's pseudo-signals are nothing more than setting a flag in the deferred signal queue\, they bypass the real signaling system entirely\, making it useless for many if not most purposes).

The complication here is this​: system signal handlers are process-wide (contrary to signal masks\, which are per-thread)\, whereas perl's idea of signal handlers is per interpreter (which usually but not necessarily overlaps with a thread). Handling this correctly is rather problematic.

POSIX​::sigaction does do exactly what it advertises​: actually set a signal handler no matter what.



Flags​:   category=core   severity=low


Site configuration information for perl 5.14.2​:

Configured by leon at Tue Jan 17 21​:29​:06 CET 2012.

Summary of my perl5 (revision 5 version 14 subversion 2) configuration​:

  Platform​:   osname=linux\, osvers=3.0.0-14-generic\, archname=x86_64-linux-thread-multi   uname='linux leon-laptop 3.0.0-14-generic #23-ubuntu smp mon nov 21 20​:28​:43 utc 2011 x86_64 x86_64 x86_64 gnulinux '   config_args='-de -Dprefix=/home/leon/perl5/perlbrew/perls/perl-5.14.2 -Dusethreads'   hint=recommended\, useposix=true\, d_sigaction=define   useithreads=define\, usemultiplicity=define   useperlio=define\, d_sfio=undef\, uselargefiles=define\, usesocks=undef   use64bitint=define\, use64bitall=define\, uselongdouble=undef   usemymalloc=n\, bincompat5005=undef   Compiler​:   cc='cc'\, ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'\,   optimize='-O2'\,   cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'   ccversion=''\, gccversion='4.6.1'\, gccosandvers=''   intsize=4\, longsize=8\, ptrsize=8\, doublesize=8\, byteorder=12345678   d_longlong=define\, longlongsize=8\, d_longdbl=define\, longdblsize=16   ivtype='long'\, ivsize=8\, nvtype='double'\, nvsize=8\, Off_t='off_t'\, lseeksize=8   alignbytes=8\, prototype=define   Linker and Libraries​:   ld='cc'\, ldflags =' -fstack-protector -L/usr/local/lib'   libpth=/usr/local/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /usr/lib   libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lpthread -lc   perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc   libc=\, so=so\, useshrplib=false\, libperl=libperl.a   gnulibc_version='2.13'   Dynamic Linking​:   dlsrc=dl_dlopen.xs\, dlext=so\, d_dlsymun=undef\, ccdlflags='-Wl\,-E'   cccdlflags='-fPIC'\, lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'

Locally applied patches​:


@​INC for perl 5.14.2​:   /home/leon/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/x86_64-linux-thread-multi   /home/leon/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2   /home/leon/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/x86_64-linux-thread-multi   /home/leon/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2   .


Environment for perl 5.14.2​:   HOME=/home/leon   LANG=en_US.utf8   LANGUAGE=en_US​:en_GB​:en   LD_LIBRARY_PATH (unset)   LOGDIR (unset)   PATH=/home/leon/perl5/perlbrew/bin​:/home/leon/perl5/perlbrew/perls/perl-5.14.2/bin​:/home/leon/bin​:/usr/lib/lightdm/lightdm​:/usr/local/sbin​:/usr/local/bin​:/usr/sbin​:/usr/bin​:/sbin​:/bin​:/usr/games   PERLBREW_HOME=/home/leon/.perlbrew   PERLBREW_PATH=/home/leon/perl5/perlbrew/bin​:/home/leon/perl5/perlbrew/perls/perl-5.14.2/bin   PERLBREW_PERL=perl-5.14.2   PERLBREW_ROOT=/home/leon/perl5/perlbrew   PERLBREW_VERSION=0.25   PERL_BADLANG (unset)   SHELL=/bin/bash