[Gc] Re: GetThreadContext failed

Henning Makholm makholm at octoshape.com
Fri Aug 20 01:08:29 PDT 2010

On June 7 I wrote:

> We use version 6.8 of the GC, with minor local patches that should
> be irrelevant here, in the client-side part of our product
> (Octoshape Streaming Services).
> Recently a growing number of end-users are reporting that the
> program crashes with a "GetThreadContext failed" message box from
> the GC. This massage is generated by GC_push_all_stacks() in
> win32_threads.c.

Problem solved!

(Or at least we solved ONE problem that can produce this behavior).

If a new thread is being started exactly while another thread is
stopping the world, the new tread may call GC_new_thread() to
enter the new thread in thread table *after* GC_stop_world
has run, but *before* GC_push_all_stacks() reads the thread table
and tries to read its stack. Since the new thread is not suspended
(it is looping 20-ms sleeps while it waits for GC_please_stop
to become false) GetThreadContext will fail.

This does not affect the 7.2 series, because GC_new_thread() is
now always called with the lock held.

In our 6.8 case, adding a check for thread->suspended in
GC_push_all_stacks() appears to fix it.

Henning Makholm
Octoshape ApS

More information about the Gc mailing list