[Gc] Problem with GC on FreeBSD

Petter Urkedal urkedal at nbi.dk
Wed Apr 18 17:18:00 PDT 2012


On 2012-04-19, Vitaly Magerya wrote:
> Petter Urkedal <urkedal at nbi.dk> wrote:
> >> > I'll focus on this part first, since it's most directly related to the
> >> > code I wrote.  It seems the thread local freelists are the problem,
> >> > maybe they are not initialized.  The thread local key should be working
> >> > now with -D USE_PTHREAD_SPECIFIC, right?
> 
> Right.
> 
> >> > But I'm wondering whether
> >> > GC_init_thread_local gets called.
> 
> It is (via GC_init => GC_init_parallel => GC_init_thread_local).

That covers the main thread.

> >> > It may be worth trying to change
> >> > pthread_create to GC_pthread_create in disclaim_test.c
> 
> Just tried that, got the same crash (with slightly different numbers,
> but basically the same).

Thanks for testing it.  So, it seems was wrong about this.
> 
> Note that I don't always get the crash in the debugger; sometimes it
> just hangs (especially if I don't disable SIGUSR1 & SIGUSR2 interception).
> 
> >> > (or insert a call
> >> > to GC_unregister_my_thread inside the thread call-back). If it makes a
> >> > difference, this might be relevant for the above segfault, as well.
> >
> > Corr: "GC_unregister_my_thread" should read "GC_register_my_thread".
> 
> Doesn't seem to change anything (i.e. the same crash).
> 
> Is this the correct way to call it?
> 
>     /* main thread */
>     GC_allow_register_threads();
> 
>     /* subthreads */
>     GC_call_with_stack_base(GC_register_my_thread, NULL);

Ah, I'm actually using GC_pthread_create myself, but this looks right
according to the documentation.

Anyway, I can reproduce the issue occasionally with when I
--enable-gc-assertions, so I can take the disclaim_test-issue from here.


More information about the Gc mailing list