Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fatal error in GC: SuspendThread failed due to race condition #303

Open
tobil4sk opened this issue Feb 15, 2025 · 0 comments · May be fixed by #305
Open

Fatal error in GC: SuspendThread failed due to race condition #303

tobil4sk opened this issue Feb 15, 2025 · 0 comments · May be fixed by #305

Comments

@tobil4sk
Copy link
Member

From: #281 (comment)

It looks like this happens because the thread is deleted by DLLMain
https://github.com/ivmai/bdwgc/blob/2558568aceaf7fc5cc64cf87e244cbcfd7f9bd53/win32_threads.c#L3009

Somehow this happens at the same time as the GC_gcollect call within neko_gc_major() while neko is shutting down, which also tries to access the same thread to suspend it.

Can be reproduced by running this program repeatedly:

function main() {
	final lock = new sys.thread.Lock();
	sys.thread.Thread.create(function() {
		lock.release();
	});
	lock.wait();
}

Here is a minimal sample. For this to reproduce the following conditions must be met:

  • App must contain thread
  • Thread must complete before the main thread
  • DllMain call for detaching thread must be interleaved with a GC_gcollect call in neko_gc_major()

See: ivmai/bdwgc#704

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant