This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Repository navigation
Fix race condition on Windows - #118
Merged
Merged
Conversation
as-cii
force-pushed
the
as-fix-race-condition
branch
2 times, most recently
from
January 31, 2017 13:04
80f3499 to
58f6630
Compare
as-cii
force-pushed
the
as-fix-race-condition
branch
2 times, most recently
from
February 1, 2017 12:48
6a6a4ea to
7fbefa7
Compare
This commit fixes an Access Violation exception that was occurring on Windows when closing a file handle while a `WaitForMultipleObjects` call was still in progress. As specified on MSDN, "if one of the handles is closed while the wait is still pending, the function's behavior is undefined.". This was causing hard crashes on packages like the tree-view where a lot of I/O is performed in the tests. This commit fixes it by always closing the file handle after WaitForMultipleObjects returns. Now, when the user calls `.unwatch()`, we will mark the handle as "canceled", wake up `PlatformThread`, wait until it finishes waiting on all the handles (i.e. when `WaitForMultipleObjects` returns) and then delete the desired file handle in the main thread.
as-cii
force-pushed
the
as-fix-race-condition
branch
from
February 1, 2017 12:50
7fbefa7 to
92b07f7
Compare
Contributor
|
Wow, nice job tracking this down. |
13 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request fixes an Access Violation exception that was occurring on Windows when closing a file handle while a
WaitForMultipleObjectscall was still in progress. As specified on MSDN, «if one of the handles is closed while the wait is still pending, the function's behavior is undefined». This was causing hard crashes on packages like the tree-view where a lot of I/O is performed in the tests.This pull request fixes it by always closing the file handle after
WaitForMultipleObjectsreturns. Now, when the user calls.unwatch(), we will mark the handle as "canceled", wake upPlatformThread, wait until it finishes waiting on all the handles (i.e. whenWaitForMultipleObjectsreturns) and then delete the desired file handle in the main thread.