Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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.

3 participants