[Gc] Re: Race condition in garbage collector

Juan Jose Garcia-Ripoll juanjose.garciaripoll at gmail.com
Sun Jul 22 12:20:48 PDT 2012

On Sun, Jul 22, 2012 at 4:43 PM, Juan Jose Garcia-Ripoll <
juanjose.garciaripoll at gmail.com> wrote:

> 1) This thread is a servicing one. It is trying to exit and in the process
> it acquires the GC lock, but for some reason the thread invokes the dyld
> library. I still haven't located where in GC this happens but from the
> symptoms it seems it is close to GC_unregister...[...]
> 2) This thread is the main one. It is trying to close a bunch of
> libraries, none of which are related to the thread above. However, when
> dlclose() is called, some code associated to the garbage collector is run
> and we enter a race condition.

It is very difficult to prevent 1) from happening, because the call to dyld
happens inside the garbage collector exit code, or somewhere in pthread's
library, I do not know.

I have tried wrapping dlopen() and dlclose() with
GC_call_with_alloc_lock(). The problem here is that the garbage collector
uses default mutexes and they are not recursive in OS X. The result is a

I would appreciate some solution.


Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://napali.hpl.hp.com/pipermail/gc/attachments/20120722/fac94531/attachment.htm

More information about the Gc mailing list