perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Albert <...@netrition.com>
Subject Re: mod_perl2 timely catching SIGPIPE
Date Thu, 10 Jun 2004 21:26:24 GMT
Stas Bekman wrote:

> Jim Albert wrote:
> 
>> I'm trying to determine how to have my mod_perl apache server properly 
>> catch a SIGPIPE signal in a timely manner.
>>
>> My environment is Apache/2.0.49 (Fedora) and mod_perl 2.
> 
> 
> Jim, please *always* report bugs and problems following these guidelines!
> http://perl.apache.org/bugs/
> and save yourself and us time. Thank you!
> 
>> In my conf.d/perl.conf file I have the following:
>> PerlFixupHandler Apache::SIG2
> 
> [...]
> 
>> Under Apache/1.3.27 and mod_perl/1.27 I had a very similar 
>> PerlFixupHandler in place (a slightly modified Apache::SIG.pm) to 
>> catch a SIGPIPE and the SIGPIPE was caught and my signal handler 
>> executed at the correct time... when the connection was broken by the 
>> browser.  I would like to be able to continue to catch a SIGPIPE like 
>> this under Apache2/modperl2.  Can anyone offer any suggestions as to 
>> how to get my signal handler, PIPE, executed as soon as the SIGPIPE is 
>> generated?
> 
> 
> What perl version are you using now (and which one have you used with 
> 1.3.x?) (which you were supposed to sent as a part of the bug report).

In my mod_perl environment (Apache 1.3 / mod_perl 1.27) where my perl 
handler catches and immediately handles the SIGPIPE I am using perl 5.6.1.

In my mod_perl environment (Apache2.0.49 / mod_perl 2) where my perl 
handler properly catches the SIGPIPE, but does not handle it immediately 
I am using perl 5.8.3.


> I 
> don't think this has anything to do with what mod_perl version you are 
> using.
 >
 > Starting from 5.8.0 perl delays signal delivery, making signals safe.
[...]

Stas, you are absolutely correct... thanks a lot!  I added the following 
line to my server_startup.pl (Apache2.0.49 / mod_perl 2) which gets 
included from my conf.d/perl.conf file:
$ENV{PERL_SIGNALS} = "unsafe";

With that line in place, my PerlFixupHandler now catches a SIGPIPE and 
immediately executes the SIGPIPE signal handler.

I hadn't had any significant problem that I noticed using "unsafe" 
signals in the past and  I need the functionality that "unsafe" signals 
provide me, so I'm going to go with "unsafe" signals in my 
apache2/mod_perl2/perl5.8 environment.

> Please let us know which technique has worked for you and it'd be great 
> to have a section documenting this area, including full examples as in 
> your original bug report.

I've been researching this problem for several days so I'm anxious to 
get an Apache2/mod_perl2 system into production now that I have a 
solution.  When I get some time I'll post a detailed explanation of this 
problem with examples to this mailing list.

Jim Albert



-- 
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


Mime
View raw message