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

[8.x] Wait until race condition fix #727

Merged
merged 4 commits into from
Mar 28, 2020

Conversation

ikesyo
Copy link
Member

@ikesyo ikesyo commented Mar 28, 2020

Cherry-picks #721 into 8.x-branch.

AnthonyMDev and others added 4 commits March 28, 2020 10:31
This fixes a race condition that resulted in the main RunLoop locking up, halting all tests indefinitely.

This occured sometimes when `done()` was called asynchronously on a background thread.
We are checking if the result for the test is complete (ie. `done()` has been called) on line 258, then running the `RunLoop`. If the background thread marks the test complete between the check on line 258 and the running of the `RunLoop` on line 260, it stops the `RunLoop` **prior** to the `RunLoop` being started instead of after. This means the `RunLoop` is never stopped and the test hangs forever. This ensures that the completion of the test and the stopping of the `RunLoop` is called serially on the main thread, which prevents the race condition.

Unit test is included to verify the fix.
@ikesyo ikesyo force-pushed the 8.x-waitUntil-race-condition-fix branch from 6210b4d to c7db238 Compare March 28, 2020 01:54
@ikesyo ikesyo merged commit b93b829 into 8.x-branch Mar 28, 2020
@ikesyo ikesyo deleted the 8.x-waitUntil-race-condition-fix branch March 28, 2020 02:13
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.

2 participants