Dec 28, 1995, 8:42 PM
Post #25 of 30
(1407 views)
Permalink
> > This has hit me in two ways previously. In SG-IRIX, there is an OS bug which means
> > that when I use POSIX signal blocking and die, the signal block gets locked. In my
> > EventDriven server, I have control (I always know when this could happen) so that I
> > automatically unblock when I come into this situation. Its only happened on the SG so far.
> > The reports and workarounds are somewhere in the pp archives.
>
> Do you have some _simple_ perl code to demonstrate this? It's doesn't seem
> very easy to trigger in perl.
These are the reports (at least those that I could find in my archives) that I made
to the list:
Message-Id: <9506161553.AA21188@bison.lif.icnet.uk>
Date: Fri, 16 Jun 95 16:53:14 BST
>From: js@biu.icnet.uk (Jack Shirazi - BIU)
To: perl5-porters@africa.nicoh.com
Subject: Problem with POSIX signals and signal masks on IRIX
The following prog apparently acts incorrectly on IRIX. It installs an
Alarm handler with a full signal mask, then does the various kills. On
SunOS this correctly produces 4 'here's and then a 'Terminated'. This
also is what happens on IRIX if you use the 'a' signal handler. But if
you use the 'b' one, then all signals after the first are blocked. If
you comment out the 'fillset' line, then only the ALRM signals are
blocked after the first one. All this leads me to think that on IRIX,
when the handler is called, the signal mask that is specified by the
sigaction call while the handler is operating is used, but that if the
process 'dies' in the handler, then the sigmask is NOT restored to the
pre-handler state. So every time a handler gets called and died out of,
at least its signal (and whatever others were specified in the mask) is
going to get added to the signal mask.
I think you get this sort of difference because of the differences in
longjmp, which acts like _longjmp on some platforms, and siglongjmp on
others.
But then I'm not a real C programmer, so this could all be rubbish.
I tried this with both 5.000 and 5.001l.
#!perl
require POSIX;
$FULL_MASK = POSIX::SigSet->new();
$FULL_MASK->fillset();
$H = 'a';
$H = 'b';
sub a {warn "here\n";}
sub b {warn "here\n";die;}
sub t1 {
POSIX::sigaction(POSIX::SIGALRM() ,POSIX::SigAction->new($H,$FULL_MASK));
eval {kill 'ALRM',$$} ;
eval {kill 'ALRM',$$} ;
eval {kill 'ALRM',$$} ;
eval {kill 'ALRM',$$} ;
eval {kill 'TERM',$$} ;
}
t1();
__END__
output of myconfig:
Summary of my perl5 (patchlevel 1) configuration:
Platform:
osname=irix, osver=5, archname=IP22-irix
uname='irix sgi 5.2 02282016 ip22 mips '
hint=recommended
Compiler:
cc='cc', optimize='-O', ld='ld'
cppflags='-D_POSIX_SOURCE -ansiposix -D_BSD_TYPES'
ccflags ='-D_POSIX_SOURCE -ansiposix -D_BSD_TYPES -Olimit 3000'
ldflags =''
stdchar='unsigned char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=1, d_casti32=define, d_castneg=undef
intsize=4, alignbytes=8, usemymalloc=y, randbits=15
Libraries:
so=so
libpth=/usr/lib /usr/local/lib /lib
libs=-lsun -lm -lc -lcrypt -lbsd -lPW
libc=/usr/lib/libc.so
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef
cccdlflags=' ', ccdlflags=' ', lddlflags='-shared'
Message-Id: <9506190913.AA25086@bison.lif.icnet.uk>
Date: Mon, 19 Jun 95 10:13:32 BST
>.From: js@biu.icnet.uk (Jack Shirazi - BIU)
To: perl5-porters@africa.nicoh.com
Subject: Re: Problem with POSIX signals and signal masks on IRIX
I wrote that the following prog doesn't work correctly in IRIX - the problem
being that a die in a signal handler leaves that signal blocked. I'm using
the following as a workaround:
After any eval, check $@ and if its true, reset the signal mask, i.e.
$@ && POSIX::sigprocmask(POSIX::SIG_UNBLOCK(),$FULL_MASK);
> #!perl
> require POSIX;
>
> $FULL_MASK = POSIX::SigSet->new();
> $FULL_MASK->fillset();
> $H = 'a';
> $H = 'b';
>
> sub a {warn "here\n";}
> sub b {warn "here\n";die;}
>
> sub t1 {
> POSIX::sigaction(POSIX::SIGALRM() ,POSIX::SigAction->new($H,$FULL_MASK));
> eval {kill 'ALRM',$$} ;
> eval {kill 'ALRM',$$} ;
> eval {kill 'ALRM',$$} ;
> eval {kill 'ALRM',$$} ;
> eval {kill 'TERM',$$} ;
> }
>
> t1();
> __END__
-- Jack Shirazi, JackS@slc.com