Subject: | PerlCleanupHandler doesn't get called with MP2 |
Note: I built MP2 with MP_COMPAT_1X=0. Maybe that's the only reason for
my problem.
Apache::DBI is supposed to register a PerlCleanupHandler to rollback a
database handle at the end of each request. This doesn't work with my
MP2 setup. The code to register the handler is:
if (!$Rollback{$Idx} and Apache->can('push_handlers')) {
debug(2, "$prefix push PerlCleanupHandler");
if (MP2) {
my $s = Apache2::ServerUtil->server;
$s->push_handlers("PerlCleanupHandler", sub { cleanup($Idx) });
}
else {
Apache->push_handlers("PerlCleanupHandler", sub {
cleanup($Idx) });
}
# make sure, that the rollback is called only once for every
# request, even if the script calls connect more than once
$Rollback{$Idx} = 1;
}
First of all, Apache->can('push_handlers') returns false under MP2, at
least if you built it with MP_COMPAT_1X=0. If you remove that check the
cleanup handler is registered successfully, but it's still not called.
Maybe this is because the handler is registered with the server, not the
request. I had a look at the MP2 source code, but I can't find where the
cleanup handlers are called.