Re: modperl2, fork, and signals

[prev] [thread] [next] [Date index for 2004/11/24]

From: Stas Bekman
Subject: Re: modperl2, fork, and signals
Date: 15:40 on 24 Nov 2004
SUCH SANMARTÍN wrote:
> Hello, i'm working with a kind-of-daemon for my mp2 modules. I will u
> se  on Linux but i'm doing the "testing" on a windows machine, and i am having
> troubles with fork processes and signal caching:
> Procedure A is auto-forked and live in an infinite-loop. Procedure B is
> a function (called by pointing to an URL) to stop this  infinite loop.
[...]

> The problem is that sometimes the signal is received and the process
> finishes (but usually apache crashes), and sometimes (most of times)
> the signal is ignored. I've realized that without the "sleep"
> instruction in the while loop the signal is always catched and the
> process finishes always, but sometimes apache crashes equally.

Starting from 5.8.0 perl delays signal delivery, making signals safe. For 
more information please see:
http://search.cpan.org/dist/perl/pod/perl58delta.pod#Safe_Signals
http://search.cpan.org/dist/perl/pod/perlipc.pod#Deferred_Signals_(Safe_Signals)

If you want to disable that perl feature, you can either recompile perl 
(starting from 5.8.1):
http://search.cpan.org/dist/perl/pod/perl581delta.pod#Unsafe_signals_again_available
http://search.cpan.org/dist/perl/pod/perlrun.pod#PERL_SIGNALS

Or use POSIX signal handling which bypasses perl signal mechanism:
http://search.cpan.org/dist/perl/ext/POSIX/POSIX.pod#POSIX::SigAction


        -- 
        __________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxx.xxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

modperl2, fork, and signals
=?iso-8859-1?Q?SUCH_SANMART=CDN=2C_GERARD?= 07:28 on 24 Nov 2004

Re: modperl2, fork, and signals
Stas Bekman 15:40 on 24 Nov 2004

Generated at 11:26 on 21 Dec 2004 by mariachi v0.52