Geoffrey Young wrote: > > Philippe M. Chiasson wrote: > >>It's been a long awaited feature, to bring back something similar to the old >>mod_perl option to have mod_perl statically linked to httpd. Here is my attempt >>at it. > > > whee!
This patch sure needs a bit of polishing, but yes, it was long due...
>
>>There is currently one bug with mod_perl compiled statically. It tries to add
>>the MODPERL2 server define at hook-registry phase, but for statically linked
>>modules, that hook-registry phase is called before ap_server_config_defines is
>>created.
>
>
> hmm, called before, or the dso reload behavior is different so we don't
> notice with dso? I wasn't aware that the order of things actually changed
> with dso vs static.
>
Basically, we want to define MODPERL2 as a server define, and the only phase
where you can safely do that before configuration is during the hook-registry
phase. the pre_config hook is not early enough for this.
So, from httpd/server/main.c:
ap_setup_prelinked_modules(process);
[...]
ap_server_config_defines = apr_array_make(pcommands, 1, sizeof(char *));
And the problem is that ap_setup_prelinked_modules() loads up static modules
about the same way that mod_so does it, just at a much earlier time.
ap_setup_prelinked_modules() calls register_hooks on mod_perl (and the other
statically compiled modules), and mod_perl's register_hooks tries to push
MODPERL2 to ap_server_config_defines, but that's not initialized yet, so SEGV.
It can be fixed either with my simple httpd patch, or possibly by introducing an
httpd API to manipulate ap_server_config_defines that can create it when first
accessed.
But the patch I suggested just moves static module initialization after a few
global structures have been initialized, so I can't see what harm it could do.
>>The following httpd patch fixes it, and I think it should be submitted to
>>[EMAIL PROTECTED] for inclusion, as what mod_perl is doing is the only way I could
>>find
>>of adding defines, and it just doesn't work when statically linked.
>
>
> hmm, can you expand on this a bit more. clearly mod_perl isn't the only one
> who needs to link both statically and dynamically, so is it that mod_perl is
> doing something other core modules (like, say, dav) are not?
Yup, we try to apr_array_push() to a not yet created ap_server_config_defines
> I'd be happy to shepherd whatever needs to be done with httpd, I just need
> to understand it well enough to defend it or offer alternatives when people
> over there say httpd is all well and fine. so, more specific code pointers
> would be much appreciated.
>
> --Geoff
>
--
--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5
signature.asc
Description: OpenPGP digital signature
