-
Notifications
You must be signed in to change notification settings - Fork 197
Bug in v7.1.0 with CloseAndFlush hanging app during exit. #226
Comments
You are correct, it should certainly not hang, but make sure all buffered events are flushed inside the sinks and then dispose of the logger. Is there any logging in the Selflog of Serilog or in the Elasticsearch server? |
@mivano My apologies I only just noticed this. I had to roll back the version as this was a production system so I'm afraid I can't help with further logs. |
Then I m afraid that it is pretty hard to support this issue. Closing for now, feel free to reopen when you have more details. |
@mivano Totally understood thanks. FYI I did a quick local test and did not have the problem so perhaps it was a conflict with another package that I have since upgraded. |
Great. When it happens again, make sure to enable the selflog of Serilog. The sink will write any exceptions to there. |
I have been seeing this behaviour ever since DurableSink started flushing to elastic on shutdown. The problem is rather obvious: void CloseAndFlush()
{
/* ... */
OnTick().GetAwaiter().GetResult();
}
/* ... */
protected virtual async Task OnTick()
{
/* ... */
} The void CloseAndFlush()
{
/* ... */
Task.Run(OnTick).Wait();
} |
Thanks for the pointer. We will most likely get rid of the durable mode here soon. Causing more issues then actually delivering value #254 |
What version of Serilog.Sinks.Elasticsearch is affected? Please list the related NuGet package.
v7.1.0
What is the target framework and operating system?
4.7.1
Please describe the current behavior?
When calling Log.CloseAndFlush() my application hangs.
Stack trace when hitting pause in a debug session:
Please describe the expected behavior?
I would expect the previous behavior, or a small extra delay to ensure a flush occurs, but not a hang.
The text was updated successfully, but these errors were encountered: