`Log.CloseAndFlush()` deadlock on AWS Lambda
See original GitHub issueLog.CloseAndFlush()
seems to be deadlocking when run in AWS Lambda and my Seq server instance goes down for some (irrelevant) reason making Seq a single point of failure for the whole microservice gang. This is how it looks like in the logs:
This only happens when running in AWS Lambda environment. In a console app execution continues after a graceful timeout of ~4 seconds. I suspect it might be related to this and followed this advice to make it behave better:
...
finally
{
Task.Run(Log.CloseAndFlush).Wait(1000);
}
It works but still looks like a hack.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Bug in v7.1.0 with CloseAndFlush hanging app during exit.
When calling Log.CloseAndFlush() my application hangs. Stack trace when hitting pause in a debug session: mscorlib.dll!System.Threading.
Read more >Why are some Serilog events from AWS lambda not ...
Before your lambda function completes try calling Log.CloseAndFlush(); to ensure any buffered events are processed before the application exits.
Read more >Concurrency deadlock | Amazon CodeGuru, Detector Library
A deadlock can occur when two distinct threads try to acquire two locks in reverse order. Detector ID. java/concurrency-deadlock@v1.0. Category. Security.
Read more >AWS Lambda function logging in Java
This page describes how to produce log output from your Lambda function's code, or access logs using the AWS Command Line Interface, the...
Read more >Parsing logs and structured logging - AWS Lambda
Many developers use unstructured logging in their Lambda functions by using commands such as Python's print function. This creates human-readable output ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @DarkMio; v5.2.0 is out now and includes this fix. I’ll close the ticket as completed but if you notice any ongoing issues please let us know!
Hi @DarkMio - thanks for reaching out. Starting work on a proper fix for this now via https://github.com/serilog/serilog/pull/1750.