Mark Blackman wrote:
On 15 Apr 2008, at 13:51, Mark Blackman wrote:While I did find Torsten Förtsch's very useful Perl::AfterFork module, surely themod_perl code must be doing something like this itself, no? I'd be grateful to understand mod_perl's response to Perl's pid caching is, given that forking *will* happen in the mod_perl environment.Ok, more investigation suggests we're seeing an ordering problem. mod_perl (2.0.3) does reinitialize $$ in modperl_hook_child_init in mod_perl.c by calling void modperl_perl_init_ids_server(server_rec *s) in modperl_perl.c However, judicious sprinkling of printf statements suggests very strongly that the above code gets called *AFTER* the handler specified in PerlChildInitHandler.
That's most likely correct. From src/modules/perl/mod_perl.c: ap_hook_child_init(modperl_hook_child_init, [...]); /* Handler for $$ */ modperl_register_handler_hooks(); /* Handler for PerlChildInit */ So I assume the hook ordering for the same level is LIFO.
Would anyone are to comment why the code above would be done AFTER?
It shouldn't be, IMO.
The routine names suggest that modperl_hook_child_init() would get called before a PerlChildInitHandler to me, but my logging suggests otherwise.
Can you try this simple patch and see if it makes your troubles go away. <Untested> Index: src/modules/perl/mod_perl.c =================================================================== --- src/modules/perl/mod_perl.c (revision 643757) +++ src/modules/perl/mod_perl.c (working copy) @@ -896,7 +896,7 @@ NULL, NULL, MODPERL_HOOK_REALLY_REALLY_FIRST); ap_hook_child_init(modperl_hook_child_init, - NULL, NULL, APR_HOOK_FIRST); + NULL, NULL, MODPERL_HOOK_REALLY_REALLY_FIRST); modperl_register_handler_hooks(); } </Untested> -- Philippe M. Chiasson GPG: F9BFE0C2480E7680 1AE53631CB32A107 88C3A5A5 http://gozer.ectoplasm.org/ m/gozer\@(apache|cpan|ectoplasm)\.org/
signature.asc
Description: OpenPGP digital signature