serilog-contrib / serilog-sinks-splunk

A Serilog sink that writes to Splunk
https://splunk.com
Apache License 2.0
46 stars 47 forks source link

Fix deadlock when calling Dispose from the UI thread. #45

Closed diegofrata closed 7 years ago

diegofrata commented 7 years ago

Basically, if you call Dsipose from the UI thread, or any other thread that has a synchronization context, it blocks and waits for the Send to complete. But then _httpClient.SendAsync tries to complete in the original context, but it can't because it's already blocked. Since there's no timeout, it gets deadlocked forever.

Adding the ConfigureAwait(false) causes the _httpClient request to be completed in the thread pool instead, avoiding the deadlock.

merbla commented 7 years ago

LGTM!

merbla commented 7 years ago

@diegofrata try 2.1.3

diegofrata commented 7 years ago

Thanks a lot. Will update on Monday! On Sat, 4 Mar 2017 at 02:01, Matthew Erbs notifications@github.com wrote:

@diegofrata https://github.com/diegofrata try 2.1.3 https://www.nuget.org/packages/Serilog.Sinks.Splunk/2.1.3

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/serilog/serilog-sinks-splunk/pull/45#issuecomment-284117985, or mute the thread https://github.com/notifications/unsubscribe-auth/AASwT_mU11MkhDvCNyAzdzM9ku6VBNywks5riMYKgaJpZM4MSJ0D .