Closed ViRb3 closed 9 months ago
Your log output is probably blocking the write.
Could you please elaborate? A ton of other logs were successfully written to disk in the 5 minute interval, so the file was not locked.
If the output was a file, it is possible that some hardware storage issue or IO contention blocked your write on that file. The write on your output is the only thing that could block zerolog.
If you are using zerolog in the critical path, I would suggest to use a diode writer to make sure your log output performance does not impact your service.
This makes a lot of sense, I have applied your recommendation and will keep an eye out. Thanks a lot for the help!
I'm not sure if this is due to zerolog itself, the Go runtime/GC, or overall system resource starvation, but I was running a rather complex program and noticed that a critical goroutine blocked for about 5 minutes. When I looked at the logs produced by zerolog, it seems like it was stuck between two log print lines for the entire blocking duration.
Main function that initializes zerolog. I fork to both console and file:
The goroutine that got blocked:
The logs I found:
Any ideas are greatly appreciated, thank you!