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

Serilog.Extensions.Hosting.dll Corrupted with Null Bytes During Unplanned Shutdown #83

Closed
LeeDawsonUK opened this issue Dec 20, 2023 · 2 comments

Comments

@LeeDawsonUK
Copy link

LeeDawsonUK commented Dec 20, 2023

We are using Serilog in an application that runs as a Windows Service. One of our customers has recently experienced unexpected shutdowns of their machines. Upon restarting, our Service fails to start and we find that Serilog.Extensions.Hosting.dll has been completely overwritten with NUL bytes:

image

The size and last modified date of the file remain the same. The customer can fix the problem by running a Repair of the installation via Add/Remove Programs. This has happened several times and this is the only file affected.

I have found reports of this issue online (link, link) except that these relate to files which were being written at the time of the power loss. I do not know why this would be the case for a .NET assembly.

I have re-emphasised to our customer the importance of preventing sudden unplanned shutdowns, and have also asked them to exempt our application from anti-virus scanning. However I am asking here whether there is anything special about Serilog.Extensions.Hosting.dll, or perhaps in the way we are using it, that would make it prone to this kind of corruption?

We are using v5.0.1 of the Serilog.Extensions.Hosting package and v2.12.0 of Serilog.

I include our Serilog setup code for completeness:

Log.Logger = new LoggerConfiguration()                        
                        .MinimumLevel.Override("Microsoft.AspNetCore", LogEventLevel.Warning)
                        .Enrich.FromLogContext()
                        .WriteTo.File(Paths.LogFilePath, rollingInterval: RollingInterval.Day)
                        .WriteTo.File(Paths.ErrorLogFilePath, restrictedToMinimumLevel: LogEventLevel.Warning)
#if DEBUG
                        .WriteTo.Console(Serilog.Events.LogEventLevel.Debug, outputTemplate: SerilogOutputTemplate)                        
#endif
                        .CreateLogger(); 
@nblumhardt
Copy link
Member

My bet is that the file is on some kind of network/virtualized storage with a flaky driver, or some other theme along those lines. Very, very unlikely to be anything to do with the DLL itself; would be happy to help if I could, but really nothing I can add, here. Good luck with it!

@nblumhardt
Copy link
Member

Closing as I don't think there's anything to action in this one, currently.

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