[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: [ID 20000118.004] DynaLoader doesn't dlclose XS code on interpreter



Ilya Zakharevich wrote:

> Super-User writes:
> > The failure of DynaLoader to dlclose the XS modules leads to a very insiduous
> > bug.  The XS modules are left loaded in memory, and if the perl libperl.so is
> > subsequently reloaded via dlopen, it is often loaded into a different address.
> > The orphaned XS .so files are still in memory, linked to a 'ghost' of the perl
> > libperl.so.  This causes all sorts of insiduous memory and heap corruption
> > problems.
> 
> Looks like "do not do this" category.  Though may be it is safe to
> dlclose() things at the end of "global destruction"...

Right.  Tell that to the Apache developers.
Actually, I think that if we claim that perl can be embedded inside
another program, it is reasonable to expect it to clean up after itself
when asked to exit.  This includes removing any .so files it has
dlopened.

> > DynaLoader maintains a list of opened .so files in dl_librefs - on exit it
> > should dlunload all the objects in this list.
> 
> Is not this list dead at the end of global destruction?  1/2 ;-)

Couldn't it be done in an END block inside DynaLoader?

Alan Burlison


Follow-Ups from:
Alan Burlison <Alan.Burlison@uk.sun.com>
References to:
Ilya Zakharevich <ilya@math.ohio-state.edu>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]