Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Perl Signal Handling (Red Hat AS 3)

0 views
Skip to first unread message

Joshua N Pritikin

unread,
Sep 22, 2006, 1:27:47 PM9/22/06
to Oliver Rees, perl...@perl.org
On Fri, Sep 22, 2006 at 03:32:28PM +0100, Oliver Rees wrote:
> I have been looking at your Event module to see if it might solve a
> problem I am experiencing with signal handling using perl 5.8.0 on Red
> Hat AS 3.
>
> I have a module which forks a number of processes and captures the
> exit codes via a handler defined for $SIG{CHLD}. I have listed the
> reaper handler below. 99% of the time it works fine - but every so
> often, a process exitcode is recorded as 255 and the signal that
> apparently terminated it as 127 - which I do not believe is accurate.
> I have restricted my waitpid() calls to specific process IDs.

Hrm, here's some info from the perl FAQ:

Perl versions before 5.8 had in its C source code signal handlers
which
would catch the signal and possibly run a Perl function that you
had
set in %SIG. This violated the rules of signal handling at that
level
causing perl to dump core. Since version 5.8.0, perl looks at
%SIG
*after* the signal has been caught, rather than while it is being
caught.

> Is there an obvious/common explanation for this behaviour? If so, how
> does the Event module handle it?

If the above is true, I don't think Event does it any less correctly
than perl.

Oliver Rees

unread,
Sep 25, 2006, 7:23:19 AM9/25/06
to Joshua N Pritikin, perl...@perl.org
Joshua,

Thank you for your reply.

Just to clarify, I have not tried to use the Event module yet. I am trying to ascertain whether the method I am currently using (with $SIG{CHLD} set to the reaper function I listed) should be 100% reliable since perl 5.8.0, or whether there are any race conditions etc that might have a bearing.

If I am not using a reliable method, then I wondered whether Event would be better, and if so why.

The perl signal handling documentation that I have found to date does not explain the sporadic WEXITSTATUS($?)=255 WTERMSIG($?)=127 results that I have seen across a number of systems.

Regards,
Oliver

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.


0 new messages