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

Logging: fix race in disposal of a passed-in TextWriter #2581

Merged
merged 1 commit into from
Oct 30, 2023

Conversation

NickCraver
Copy link
Collaborator

Occasionally we'd see chunkLength errors from StringWriter .ToString() calls after connecting. I think we've isolated this (via test stress runs) down to a write happening post-lock on the TextWriterLogger disposal. This lock in dispose ensures we're not trying to write to a writer we should have fully released at the end of a .Connect()/.ConnectAsync() call.

Occasionally we'd see `chunkLength` errors from `StringWriter` `.ToString()` calls after connecting. I think we've isolated this (via test stress runs) down to a write happening post-lock on the `TextWriterLogger` disposal. This lock in dispose ensures we're not trying to write to a writer we should have fully released at the end of a `.Connect()`/`.ConnectAsync()` call.
@NickCraver NickCraver merged commit 4a13caf into main Oct 30, 2023
7 checks passed
@NickCraver NickCraver deleted the craver/logging-race branch October 30, 2023 14:47
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