saleem-mirza / serilog-sinks-sqlite

A Serilog sink that writes to SQLite
Apache License 2.0
56 stars 44 forks source link

Error during database clean up #22

Closed FlorianWeikert closed 5 years ago

FlorianWeikert commented 5 years ago

Hi,

I'm developing a ASP.NET Core 2.2 Application, using Serilog.Sinks.SQLite version 4.5.0 from 2. january 2019. To avoid a unreadable file, I use the retentionPeriod and retentionCheckInterval. Period is set to 5 days, checkinterval is set to 24hours.

On a regular base, my application is crashing with this error:

Unhandled Exception before shutdown code = Busy (5), message = System.Data.SQLite.SQLiteException (0x800007AF): database is locked database is locked at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) at System.Data.SQLite.SQLiteDataReader.NextResult() at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave) at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery(CommandBehavior behavior) at Serilog.Sinks.SQLite.SQLiteSink.ApplyRetentionPolicy() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown --- at System.Threading.TimerQueueTimer.CallCallback() at System.Threading.TimerQueueTimer.Fire() at System.Threading.TimerQueue.FireNextTimers() System.AppDomain

Is there any possibility, to catch this error? Thanks and best regards.

saleem-mirza commented 5 years ago

HI @scr4py4rd, I have rolled out new beta version. https://www.nuget.org/packages/Serilog.Sinks.SQLite/5.0.0-dev-00086

Please check if issue still persists.

ZerOmNia commented 4 years ago

Hey @saleem-mirza , any idea when this fix will be released?

saleem-mirza commented 4 years ago

New version is released today.