Nzbdrone.db constant corruption [docker]

Hi Markus, (sorry)

I’m using the linuxserver.io flavor of sonarr. Recently I’ve had consistent issues with my nzbdone.db becoming corrupt (see log below). I’ve done most of the normal suggestions, such as dumping the data and creating it again using sqlite. But that only appears to work until the next time I restart it.

Any assistance would be appreciated, I’m at the point where I’m considering blowing away my DB and starting over. Though that is drastic and I would prefer to determine the root cause of the corruption. Thanks

[Info] Bootstrap: Starting Sonarr - /opt/NzbDrone/NzbDrone.exe - Version 2.0.0.5085 
[Info] AppFolderInfo: Data directory is being overridden to [/config] 
[Info] Router: Application mode: Interactive 
[Info] MigrationLogger: *** Migrating data source=/config/nzbdrone.db;cache size=-10485760;datetimekind=Utc;journal mode=Wal;pooling=True;version=3 *** 


[Fatal] ConsoleApp: EPIC FAIL! 

[v2.0.0.5085] NzbDrone.Core.Datastore.CorruptDatabaseException: Database file: /config/nzbdrone.db is corrupt, restore from backup if available. See: https://github.com/Sonarr/Sonarr/wiki/FAQ#i-am-getting-an-error-database-disk-image-is-malformed ---> System.Data.SQLite.SQLiteException: locking protocol
locking protocol
  at System.Data.SQLite.SQLite3.Prepare (System.Data.SQLite.SQLiteConnection cnn, System.String strSql, System.Data.SQLite.SQLiteStatement previous, System.UInt32 timeoutMS, System.String& strRemain) [0x0033c] in <61a20cde294d4a3eb43b9d9f6284613b>:0 
  at System.Data.SQLite.SQLiteCommand.BuildNextCommand () [0x000f6] in <61a20cde294d4a3eb43b9d9f6284613b>:0 
  at System.Data.SQLite.SQLiteCommand.GetStatement (System.Int32 index) [0x00008] in <61a20cde294d4a3eb43b9d9f6284613b>:0 
  at (wrapper remoting-invoke-with-check) System.Data.SQLite.SQLiteCommand.GetStatement(int)
  at System.Data.SQLite.SQLiteDataReader.NextResult () [0x0011e] in <61a20cde294d4a3eb43b9d9f6284613b>:0 
  at System.Data.SQLite.SQLiteDataReader..ctor (System.Data.SQLite.SQLiteCommand cmd, System.Data.CommandBehavior behave) [0x00090] in <61a20cde294d4a3eb43b9d9f6284613b>:0 
  at (wrapper remoting-invoke-with-check) System.Data.SQLite.SQLiteDataReader..ctor(System.Data.SQLite.SQLiteCommand,System.Data.CommandBehavior)
  at System.Data.SQLite.SQLiteCommand.ExecuteReader (System.Data.CommandBehavior behavior) [0x0000c] in <61a20cde294d4a3eb43b9d9f6284613b>:0 
  at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery (System.Data.CommandBehavior behavior) [0x00006] in <61a20cde294d4a3eb43b9d9f6284613b>:0 
  at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery () [0x00006] in <61a20cde294d4a3eb43b9d9f6284613b>:0 
  at System.Data.SQLite.SQLiteConnection.Open () [0x00959] in <61a20cde294d4a3eb43b9d9f6284613b>:0 
  at FluentMigrator.Runner.Processors.GenericProcessorBase.EnsureConnectionIsOpen () [0x0000e] in C:\Users\Mark\Source\Repos\fluentmigrator\src\FluentMigrator.Runner\Processors\GenericProcessorBase.cs:54 
  at FluentMigrator.Runner.Processors.SQLite.SQLiteProcessor.Exists (System.String template, System.Object[] args) [0x00000] in C:\Users\Mark\Source\Repos\fluentmigrator\src\FluentMigrator.Runner\Processors\SQLite\SQLiteProcessor.cs:78 
  at FluentMigrator.Runner.Processors.SQLite.SQLiteProcessor.TableExists (System.String schemaName, System.String tableName) [0x00000] in C:\Users\Mark\Source\Repos\fluentmigrator\src\FluentMigrator.Runner\Processors\SQLite\SQLiteProcessor.cs:47 
  at FluentMigrator.Runner.VersionLoader.get_AlreadyCreatedVersionTable () [0x00000] in C:\Users\Mark\Source\Repos\fluentmigrator\src\FluentMigrator.Runner\VersionLoader.cs:124 
  at FluentMigrator.Runner.VersionLoader.LoadVersionInfo () [0x00028] in C:\Users\Mark\Source\Repos\fluentmigrator\src\FluentMigrator.Runner\VersionLoader.cs:160 
  at FluentMigrator.Runner.VersionLoader..ctor (FluentMigrator.Runner.IMigrationRunner runner, FluentMigrator.Infrastructure.IAssemblyCollection assemblies, FluentMigrator.IMigrationConventions conventions) [0x00077] in C:\Users\Mark\Source\Repos\fluentmigrator\src\FluentMigrator.Runner\VersionLoader.cs:50 
  at FluentMigrator.Runner.MigrationRunner..ctor (FluentMigrator.Infrastructure.IAssemblyCollection assemblies, FluentMigrator.Runner.Initialization.IRunnerContext runnerContext, FluentMigrator.IMigrationProcessor processor) [0x00167] in C:\Users\Mark\Source\Repos\fluentmigrator\src\FluentMigrator.Runner\MigrationRunner.cs:102 
  at FluentMigrator.Runner.MigrationRunner..ctor (System.Reflection.Assembly assembly, FluentMigrator.Runner.Initialization.IRunnerContext runnerContext, FluentMigrator.IMigrationProcessor processor) [0x00000] in C:\Users\Mark\Source\Repos\fluentmigrator\src\FluentMigrator.Runner\MigrationRunner.cs:72 
  at NzbDrone.Core.Datastore.Migration.Framework.MigrationController.Migrate (System.String connectionString, NzbDrone.Core.Datastore.Migration.Framework.MigrationContext migrationContext) [0x000b5] in M:\BuildAgent\work\3a352f0853732683\src\NzbDrone.Core\Datastore\Migration\Framework\MigrationController.cs:58 
  at NzbDrone.Core.Datastore.DbFactory.Create (NzbDrone.Core.Datastore.Migration.Framework.MigrationContext migrationContext) [0x00048] in M:\BuildAgent\work\3a352f0853732683\src\NzbDrone.Core\Datastore\DbFactory.cs:84 
   --- End of inner exception stack trace ---
  at NzbDrone.Core.Datastore.DbFactory.Create (NzbDrone.Core.Datastore.Migration.Framework.MigrationContext migrationContext) [0x00121] in M:\BuildAgent\work\3a352f0853732683\src\NzbDrone.Core\Datastore\DbFactory.cs:116 
  at NzbDrone.Core.Datastore.DbFactory.Create (NzbDrone.Core.Datastore.Migration.Framework.MigrationType migrationType) [0x00000] in M:\BuildAgent\work\3a352f0853732683\src\NzbDrone.Core\Datastore\DbFactory.cs:56 
  at NzbDrone.Core.Datastore.DbFactory.RegisterDatabase (NzbDrone.Common.Composition.IContainer container) [0x00000] in M:\BuildAgent\work\3a352f0853732683\src\NzbDrone.Core\Datastore\DbFactory.cs:36 
  at NzbDrone.Host.NzbDroneServiceFactory.Start () [0x00037] in M:\BuildAgent\work\3a352f0853732683\src\NzbDrone.Host\ApplicationServer.cs:60 
  at NzbDrone.Host.Router.Route (NzbDrone.Host.ApplicationModes applicationModes) [0x0007b] in M:\BuildAgent\work\3a352f0853732683\src\NzbDrone.Host\Router.cs:47 
  at NzbDrone.Host.Bootstrap.Start (NzbDrone.Host.ApplicationModes applicationModes, NzbDrone.Common.EnvironmentInfo.StartupContext startupContext) [0x0003d] in M:\BuildAgent\work\3a352f0853732683\src\NzbDrone.Host\Bootstrap.cs:78 
  at NzbDrone.Host.Bootstrap.Start (NzbDrone.Common.EnvironmentInfo.StartupContext startupContext, NzbDrone.Host.IUserAlert userAlert, System.Action`1[T] startCallback) [0x00075] in M:\BuildAgent\work\3a352f0853732683\src\NzbDrone.Host\Bootstrap.cs:41 
  at NzbDrone.Console.ConsoleApp.Main (System.String[] args) [0x0000e] in M:\BuildAgent\work\3a352f0853732683\src\NzbDrone.Console\ConsoleApp.cs:29 

Press enter to exit...

Still Markus with a k :wink:

I’d take a look at the host and try to figure out what’s going on there that’s causing the DB to corrupt, failing disk, incompatible storage location, such as this issue with docker for Windows:

I’m using a sonarr docker container on CoreOS, would this still apply?

Depends how volumes are mapped, I’d assume they aren’t mapped over SMB like windows does, but I have no idea.

Hi Markus,

Just wanted to update this post should anyone else have similar experiences.

First, I’m using NFS, I had been using version 3. After working with a friend and doing some reading, I started using version 4, as well as updating my NFS options as follows:

    [Mount]
    What=<hostname>:/path/to/content
    Where=/mnt/something
    Type=nfs4
    Options=rw,hard,nointr,rsize=65536,wsize=65536,bg,proto=tcp,lazytime,minorversion=1

Hopefully these prove handy should anyone else need them

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.