Gerald Richter wrote:

> Sorry, I missed that thread. I have posted this problem more then once here,
> because it have beaten me and other often when using Embperl. The problem
> there is often more hidden, because it doesn't SIGSEGV, it still works, but
> some functionality (where Perl variables are tied to C variables) doesn't
> work, so it's often not easy to detect.
> 
> Unfortunably I never had the time to track this down enought to create a
> real usefull patch (just a workaround, (PERL_STARTUP_DONE_CHECK), which will
> cause the XS libraries only loaded after the second load of libperl.so; this
> works for the startup, but not after a restart).

To summarise:  Apache dlclose's the mod_perl.so, which then results in
the perl libperl.so being unloaded as well (there's a linker dependency
from mod_perl -> perl libperl.so).  Unfortunately the perl XS modules
loaded in during startup via dlopen are *not* unloaded, nor do they
succeed in locking the perl libperl.so into memory (you could construe
this as a linker bug).  Then Apache reloads the mod_perl libperl.so,
which also results in the perl libperl.so being pulled back in, BUT AT A
DIFFERENT ADDRESS!  Result:  The perl XS modules are linked to a 'ghost'
of the originally loaded perl libperl.so.  Result: all sorts of
strangeness - coredumps, variables not being updated etc etc etc.

The current fix is to forcibly unload the perl XS modules during the
unload.  However, on reflection I'm not at all sure this is the correct
thing to do.  Although you can unload the .so component of a perl
module, you can't unload the .pm component, so just removing the .so
part as in the current workaround is suspect at least.

I think the correct fix is for the Apache core to avoid dlclosing
anything it has dlopened in the first place.  If new modules have been
added to the config files, they should be dlopened, but any old ones
should *not* be dlclosed, EVEN IF THEY ARE NO LONGER IN THE CONFIG
FILE!!!

I firmly believe this needs fixing in the Apache core, not by hacking
around it in mod_perl.

Alan Burlison

Reply via email to