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

Deadlock with the non buffered SumoLogic Serilog sink #91

Open
StefanBilliet opened this issue Nov 28, 2019 · 2 comments
Open

Deadlock with the non buffered SumoLogic Serilog sink #91

StefanBilliet opened this issue Nov 28, 2019 · 2 comments

Comments

@StefanBilliet
Copy link

Installed product versions

  • SumoLogic.Logging.Serilog: 1.0.1.1

Description

After I make a RPC call via remoting and a timeout exception is thrown, when I log the exception using Log.Error, I get stuck in a deadlock.

Steps to recreate

  1. Set up Serilog with non buffered sumo logic sink
  2. Make an RPC call with remoting; this call throws an exception leading to a timeout exception
  3. Log the exception with Log.Error

Current behavior

After I noticed the above, I wrapped the Log.Error in a Task.Factory.StartNew which fixed the deadlock issue. I also tried using the buffered sink with a max messages of 5, this also did not deadlock.
I took the liberty of looking at the code because we've had something similar in our own code a little while ago and I saw that you're using GetAwaiter().GetResult() to make an async task synchronous.
This article makes a case of why this is a bad idea and provides a helper class to do this in a safer way.
I realise this is not really an actionable issue because it's terribly hard to reproduce without having our code, but I thought that that article and the AsyncUtil helper class might be of help to you.

Expected behavior

Not deadlock

@snakefoot
Copy link
Contributor

snakefoot commented Nov 28, 2019

#89 resolves this issue by using ConfigureAwait(false) when doing async operations (Allowing the continuation to complete on different synchronization context).

@snakefoot
Copy link
Contributor

@StefanBilliet SumoLogic.Logging.Serilog: 1.0.1.2 has been released. Can you check if it fixes your issued?

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

No branches or pull requests

2 participants