The browser wait for some data from server and logging is done only after server restart. Also I see may childs are forked.
$ah{ $r->hostname } ||= HTML::Mason::ApacheHandler->new ( .. )
sub handle{
eval{ $ah{ $r->hostname }->handle_request($r); };
if( $@ ) {
$r->filename( $r->document_root . '/errors/500.html' );
$ah{ $r->hostname }->handle_request($r); };
$r->log_error( 'ERROR' );
}
}
What I do wrong so they are not finished?
UPD I have found only one note about same problem: http://sourceforge.net/p/mason/mailman/message/14999444/ but no clue.
http://foertsch.name/ModPerl-Tricks/custom-content_type-with-custom_response.shtml
So, instead of passing the error text directly to custom_response we store it in pnotes and set an otherwise unused URI, say /-/error, as custom_response:
sub handler {
my ($r)=@_;
@{$r->pnotes}{qw/etext ect/}=("sorry, no access\n", 'text/plain; charset=my-characters');
$r->custom_response( 403, "/-/error" );
return 403;
}
Now, we need to configure /-/error to run a Perl handler:
<Location /-/error>
SetHandler modperl
PerlResponseHandler My::Error
</Location>
And, of course, we need the handler function, My::Error::handler:
sub handler {
my ($r)=@_;
return Apache2::Const::NOT_FOUND unless $r->prev;
$r->content_type($r->prev->pnotes->{ect});
$r->print($r->prev->pnotes->{etext});
return Apache2::Const::OK;
}
This solution seems to work, but I do not know the answer from main question yet: Why request is not finished?
UPD
That seems a bug with mod_perl2 https://bz.apache.org/bugzilla/show_bug.cgi?id=57976