-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Prevent race condition in LoggingService #11284
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
Prevent race condition in LoggingService #11284
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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()
?
95adccd
to
3611f9a
Compare
50d0c8c
to
74a1a74
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's discuss this one
0322d36
to
2cae31a
Compare
84bb22b
to
b87fe20
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
The solution isn't ideal, but it allows to avoid "System.IO.IOException: 'The handle is invalid.'" exception. |
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