Closed Aaronontheweb closed 3 years ago
Hi Aaron!
It looks like whatever is hooked up to SelfLog
is not thread-safe. Check out how TextWriter.Synchronized()
is used in the last example in:
https://github.com/serilog/serilog/wiki/Debugging-and-Diagnostics#selflog
HTH, let us know how you go :-)
Aha - did not know that. But yes, looking deeper at the app code here:
var serilogSelfLog = new StreamWriter(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, SeriLogSelfLog));
Serilog.Debugging.SelfLog.Enable(serilogSelfLog);
I'll see that we make the appropriate changes - thank you!
Version: Serilog.Sinks.PeriodicBatching 2.2. Serilog 2.8
Troubleshooting some errors from a logfile we were given that appear to originate with some code inside the Serilog sink stack:.
Looks to me like the issue is happening here:
https://github.com/serilog/serilog-sinks-periodicbatching/blob/313598fd6c0747489c0fdf3949238dd75e60dae0/src/Serilog.Sinks.PeriodicBatching/Sinks/PeriodicBatching/PeriodicBatchingSink.cs#L237-L240
an
Exception
gets thrown from inside thePeriodicBatchingSink
but the internal error-reporting tool called duringSelfLog.WriteLine("Exception while emitting periodic batch from {0}: {1}", this, ex);
throws a second, this time unhandled exception to be thrown within theAppDomain
.If I had to guess as to what's happening - unsafe access to a buffer somewhere down the callchain.
Any ideas what we can do to patch this or work-around it? I'd offer to patch the issue myself but I'm not sure where to look.