mod_fcgi/perl: Problem with signals

Albert Leidinger <albert.leidinger-kt1KeoM4Q/BvMmomy+XrYrNldLUNz+W/@public.gmane.org>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
Hi again!

I just tried the example from FastCGI.com/FAQ. How can I see, that the 
handler was called?
I tried this:
(some added warns to the example on fastcgi.com)

#!/usr/bin/perl

use FCGI;
use strict;

my $count = 0;
my $handling_request = 0;
my $exit_requested = 0;

my $request = FCGI::Request();

sub sig_handler {
    $exit_requested = 1;
    warn "got signal";                                       # added to 
get an entry in the apache error-log, but nothing when reloading or 
restarting apache
    exit(0) if !$handling_request;                      # also didnt get 
this entry in the apache error-log saying the script exited with status 0
}

$SIG{USR1} = \&sig_handler;
$SIG{TERM} = \&sig_handler;
$SIG{PIPE} = 'IGNORE';

while ($handling_request = ($request->Accept() >= 0)) {
    &do_request;
    $handling_request = 0;
    last if $exit_requested;
}

$request->Finish();
warn 'stopping';                                        # added to get 
an entry in apache error-log, just as above - nothing in the apache 
errorlog!
close( LOG );

exit(0);

sub do_request() {
    print("Content-type: text/html\r\n\r\n", ++$count);
    $request->Finish();
    warn 'did request';                           # added to see that 
warn really works. Yepp, those entries are in the apache log for each 
request!
}


I read that programmers should do nearly nothing in a handler because of 
limitations.
Is warn already too much?

Is my conclusion that the handler isnt executed at all wrong?

thanks
Albert

___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.