#1340: Parrot may end up calling dlclose() twice with the same handle, ref.
t/pmc/threads.t test 14
---------------------+------------------------------------------------------
Reporter: heidnes | Type: bug
Status: new | Priority: normal
Milestone: | Component: none
Version: 1.8.0 | Severity: medium
Keywords: dlclose | Lang:
Patch: | Platform: netbsd
---------------------+------------------------------------------------------
Comment(by heidnes):
Replying to [comment:2 doughera]:
> It is permissible to call dlclose() twice on the same handle, if the
shared object has been dlopen()-ed twice. The two calls to dlopen() will
both return the same handle.
Maybe. I've not checked if there is a standard defining that part.
> I don't know what, exactly, parrot means by "clone" on a shared object,
but if the clone method simply called dlopen() again, the multiple calls
to dlclose() would probably work as intended.
The clone operation looks like this (from src/pmc/parrotlibrary.pmc):
{{{
VTABLE PMC *clone() {
PMC * const dest = pmc_new(INTERP, SELF->vtable->base_type);
PMC_oplib_init(dest) = PMC_oplib_init(SELF);
PMC_dlhandle(dest) = PMC_dlhandle(SELF);
if (PMC_metadata(SELF))
PMC_metadata(dest) = VTABLE_clone(INTERP, PMC_metadata(SELF));
return dest;
}
}}}
i.e. it just copies the handle returned by dlopen(), it does not dlopen()
a second time.
When it comes time to clean up after each of the library instances,
dlclose() gets called
twice with the same handle value, returned from a single dlopen() call. I
suspect that is
an error.
The patch I created prevents this from happening.
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/1340#comment:3>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets