Re: [Gc] GetThreadContext failed

Ivan Maidanski ivmai at
Mon Jun 7 08:05:56 PDT 2010


1. Is this the main thread for which GetThreadContext() is failed? (The problem might be with the thread created by CreateRemoteThread.)
2. It's interesting to insert SuspendThread() and retry GetThreadContext() after the later failed (will it fail again or complete normally). (The problem might be that some one resumes the thread (setting suspend counter to 0) between GC_suspend() and GC_push_stack_for().)

Mon, 7 Jun 2010 16:08:04 +0200 Henning Makholm <makholm at>:

> 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.
> The users having problems all seem to be using 64-bit Windows,
> running our 32-bit application (built with MS Visual Studio 8)
> as a WOW64 process. Most are using Windows 7, but we also have
> independent reports of the errors from 64-bit Windows XP.
> We have been unable to reproduce the condition locally, but we
> got one of the users to run a special build where I instrumented
> GC_abort() to display the value of GetLastError(). This turns out
> to be 0x1F, which is ERROR_GEN_FAILURE ("A device attached to the
> system is not functioning").
> I'm kind of stumped here. Does anybody on the list have similar
> experiences, and/or ideas for what could make GetThreadContext()
> fail with this error code?
> The MSDN documentation for GetCurrentThread warns that
> "THREAD_GET_CONTEXT may not be present" if we're "impersonating
> security contexts". I'm fairly sure that our program is not doing
> anything to do that, but I'm unsure whether our process can be
> interiting such a state from the Javascript wrapper that starts
> it. In any case, ERROR_GEN_FAILURE would be a strange symptom of
> a permission problem.
> --
> Henning Makholm
> Octoshape ApS

More information about the Gc mailing list