Prevent race condition in LoggingService - #11284
Merged
YuliiaKovalova merged 12 commits intoFeb 11, 2025
Merged
Conversation
rainersigwald
left a comment
Member
There was a problem hiding this comment.
I don't think I understand how this helps. Isn't there still a race between thread 1 seeing that it's non-null and calling into it and thread 2 calling Dispose()?
YuliiaKovalova
marked this pull request as draft
January 24, 2025 09:36
YuliiaKovalova
force-pushed
the
dev/ykovalova/better_handle_event_reset
branch
from
January 24, 2025 10:08
95adccd to
3611f9a
Compare
YuliiaKovalova
force-pushed
the
dev/ykovalova/better_handle_event_reset
branch
from
January 27, 2025 09:18
50d0c8c to
74a1a74
Compare
JanKrivanek
reviewed
Jan 30, 2025
YuliiaKovalova
force-pushed
the
dev/ykovalova/better_handle_event_reset
branch
from
February 6, 2025 14:47
0322d36 to
2cae31a
Compare
YuliiaKovalova
force-pushed
the
dev/ykovalova/better_handle_event_reset
branch
from
February 6, 2025 16:41
84bb22b to
b87fe20
Compare
YuliiaKovalova
marked this pull request as ready for review
February 10, 2025 10:56
JanProvaznik
approved these changes
Feb 11, 2025
JanProvaznik
left a comment
Member
There was a problem hiding this comment.
It improves the situation, but please update the description. I wouldn't say it's a double check pattern, it 1. prevents a race to set a field null and then use it and 2. catches a dispose race.
Member
Author
|
The solution isn't ideal, but it allows to avoid "System.IO.IOException: 'The handle is invalid.'" exception. |
This was referenced Jun 24, 2026
This was referenced Jul 1, 2026
This was referenced Jul 10, 2026
This was referenced Jul 20, 2026
This was referenced Jul 27, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/2320135/
Context
Reset()method invocation sometimes causes exceptionSystem.IO.IOException: 'The handle is invalid.'.Very likely it happens on application shutdown.
The assumption is:
Changes Made
Testing
N/A