Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

i#2600: fix race between detach and new thread #2602

Merged
merged 2 commits into from
Aug 8, 2017

Conversation

derekbruening
Copy link
Contributor

Adds a counter uninit_thread_count which is incremented in UNIX just prior
to a new thread being created. Synchall will keep looping while this
counter is positive, ensuring we avoid races with threads created but not
yet initialized during a detach synchall which then use DR resources after
detach, causing crashes.

Leaves the counter at 0 on Windows where we can't distinguish external vs
internal thread creation, but Windows does have the init_apc_go_native flag
which eliminates some races.

Adds a test. To more reliably hit the race (about half the time) I locally
added a 50ms sleep at the top of dynamo_thread_init().

Fixes #2600

Adds a counter uninit_thread_count which is incremented in UNIX just prior
to a new thread being created.  Synchall will keep looping while this
counter is positive, ensuring we avoid races with threads created but not
yet initialized during a detach synchall which then use DR resources after
detach, causing crashes.

Leaves the counter at 0 on Windows where we can't distinguish external vs
internal thread creation, but Windows does have the init_apc_go_native flag
which eliminates some races.

Adds a test.  To more reliably hit the race (about half the time) I locally
added a 50ms sleep at the top of dynamo_thread_init().

Fixes #2600
@derekbruening derekbruening merged commit 830ab47 into master Aug 8, 2017
@derekbruening derekbruening deleted the i2600-detach-race branch August 8, 2017 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant