StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.86k stars 1.5k forks source link

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

Closed NickCraver closed 9 months ago

NickCraver commented 9 months ago

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.