Sonarr crash with: unable to open database file

Sonarr version (exact version): 2.0.0.5163
Mono version (if Sonarr is not running on Windows): 5.10.1.47
OS: Ubuntu
Description of issue: Service crashed with the following in the log within 24 hours:

Task Error: unable to open database file

System.Data.SQLite.SQLiteException (0x80004005): unable to open database file
  at System.Data.SQLite.SQLite3.Open (System.String strFilename, System.Data.SQLite.SQLiteConnectionFlags connectionFlags, System.Data.SQLite.SQLiteOpenFlagsEnum openFlags, System.Int32 maxPoolSize, System.Boolean usePool) [0x00074] in <61a20cde294d4a3eb43b9d9f6284613b>:0 
  at System.Data.SQLite.SQLiteConnection.Open () [0x00959] in <61a20cde294d4a3eb43b9d9f6284613b>:0 
  at Marr.Data.DataMapper.OpenConnection () [0x00024] in <df579eae740742b8a97f4c5d56007dcf>:0 
  at Marr.Data.DataMapper.Query[T] (System.String sql, System.Collections.Generic.ICollection`1[T] entityList, System.Boolean useAltName) [0x00065] in <df579eae740742b8a97f4c5d56007dcf>:0 
  at Marr.Data.QGen.QueryBuilder`1[T].ToList () [0x00052] in <df579eae740742b8a97f4c5d56007dcf>:0 
  at NzbDrone.Core.Datastore.BasicRepository`1[TModel].All () [0x0000b] in <9b8bbe29888f49229914613e26af4aa5>:0 
  at NzbDrone.Core.Jobs.TaskManager.GetPending () [0x00000] in <9b8bbe29888f49229914613e26af4aa5>:0 
  at NzbDrone.Core.Jobs.Scheduler.ExecuteCommands () [0x0000b] in <9b8bbe29888f49229914613e26af4aa5>:0 
  at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in <9bbab8f8a2a246e98480e70b0839fd67>:0 
  at System.Threading.Tasks.Task.Execute () [0x00010] in <9bbab8f8a2a246e98480e70b0839fd67>:0 

I keep having to restart the service but I don’t have debugging enabled. I will be enabling debugging so this is to follow. If anyone has any idea’s why it would be appreciated.

Additionally, I have Radarr installed on the same box and don’t get this issue.

Thanks,

Not enough context in the logs to know for sure, but if Sonarr is starting then failing later it’s not likely a permissions issue, but could be a corrupt DB.

Thanks, I’ll hopefully get some more information tomorrow. Is there anyway to easily rebuild the DB?

I have logs, however there is a lot of personal data in here so I’m reluctant to post everything. However, I originally though this was something to ignore, but I don’t think it is, I get alot of the following:

SignalR exception thrown by Task: System.AggregateException: One or more errors occurred. ---> System.IO.IOException: Unable to write data to the transport connection: Connection reset by peer. ---> System.Net.Sockets.SocketException: Connection reset by peer
  at System.Net.Sockets.Socket.Send (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.Net.Sockets.SocketFlags socketFlags) [0x00016] in <2740d7148e184840ad6689888c90a56d>:0 
  at System.Net.Sockets.NetworkStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x0009b] in <2740d7148e184840ad6689888c90a56d>:0 
   --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x000e2] in <2740d7148e184840ad6689888c90a56d>:0 
  at System.Net.ResponseStream.InternalWrite (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x0001b] in <2740d7148e184840ad6689888c90a56d>:0 
  at System.Net.ResponseStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x0009c] in <2740d7148e184840ad6689888c90a56d>:0 
  at Microsoft.Owin.Host.HttpListener.RequestProcessing.ExceptionFilterStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x00024] in <208c8ef8a4ba4b878f0e4420d5960bea>:0 
  at Microsoft.AspNet.SignalR.Owin.ServerResponse.Write (System.ArraySegment`1[T] data) [0x0001b] in <31ec208bbb994a119f97a8f64d884792>:0 
  at Microsoft.AspNet.SignalR.Infrastructure.BinaryTextWriter+<>c.<.ctor>b__0_0 (System.ArraySegment`1[T] data, System.Object state) [0x00000] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Infrastructure.BufferTextWriter+ChunkedWriter.Flush (System.Byte[] byteBuffer, System.Boolean flushEncoder) [0x00035] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Infrastructure.BufferTextWriter+ChunkedWriter.Flush (System.Boolean flushEncoder) [0x00008] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Infrastructure.BufferTextWriter+ChunkedWriter.Flush () [0x00000] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Infrastructure.BufferTextWriter+ChunkedWriter.Write (System.ArraySegment`1[T] data) [0x00000] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Infrastructure.BinaryTextWriter.Write (System.ArraySegment`1[T] data) [0x00006] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Transports.PersistentResponse.WriteMessages (System.IO.TextWriter writer, Newtonsoft.Json.JsonTextWriter jsonWriter) [0x0006b] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Transports.PersistentResponse.Microsoft.AspNet.SignalR.Json.IJsonWritable.WriteJson (System.IO.TextWriter writer) [0x000f5] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Json.JsonNetSerializer.Serialize (System.Object value, System.IO.TextWriter writer) [0x0000a] in <116a5b546e994fda931777d7e7546533>:0 
  at NzbDrone.SignalR.Serializer.Serialize (System.Object value, System.IO.TextWriter writer) [0x0001f] in <3f7b0f644582448f9d502028f0ca7c1a>:0 
  at Microsoft.AspNet.SignalR.Transports.LongPollingTransport.PerformSend (System.Object state) [0x000a1] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Transports.LongPollingTransport+<>c.<Send>b__43_0 (System.Object state) [0x00000] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Infrastructure.TaskQueue.<Enqueue>b__14_0 (System.Func`2[T,TResult] next, System.Object nextState) [0x00000] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.TaskAsyncHelper.FromMethod[T1,T2] (System.Func`3[T1,T2,TResult] func, T1 arg1, T2 arg2) [0x00000] in <116a5b546e994fda931777d7e7546533>:0 
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.IO.IOException: Unable to write data to the transport connection: Connection reset by peer. ---> System.Net.Sockets.SocketException: Connection reset by peer
  at System.Net.Sockets.Socket.Send (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.Net.Sockets.SocketFlags socketFlags) [0x00016] in <2740d7148e184840ad6689888c90a56d>:0 
  at System.Net.Sockets.NetworkStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x0009b] in <2740d7148e184840ad6689888c90a56d>:0 
   --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x000e2] in <2740d7148e184840ad6689888c90a56d>:0 
  at System.Net.ResponseStream.InternalWrite (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x0001b] in <2740d7148e184840ad6689888c90a56d>:0 
  at System.Net.ResponseStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x0009c] in <2740d7148e184840ad6689888c90a56d>:0 
  at Microsoft.Owin.Host.HttpListener.RequestProcessing.ExceptionFilterStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x00024] in <208c8ef8a4ba4b878f0e4420d5960bea>:0 
  at Microsoft.AspNet.SignalR.Owin.ServerResponse.Write (System.ArraySegment`1[T] data) [0x0001b] in <31ec208bbb994a119f97a8f64d884792>:0 
  at Microsoft.AspNet.SignalR.Infrastructure.BinaryTextWriter+<>c.<.ctor>b__0_0 (System.ArraySegment`1[T] data, System.Object state) [0x00000] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Infrastructure.BufferTextWriter+ChunkedWriter.Flush (System.Byte[] byteBuffer, System.Boolean flushEncoder) [0x00035] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Infrastructure.BufferTextWriter+ChunkedWriter.Flush (System.Boolean flushEncoder) [0x00008] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Infrastructure.BufferTextWriter+ChunkedWriter.Flush () [0x00000] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Infrastructure.BufferTextWriter+ChunkedWriter.Write (System.ArraySegment`1[T] data) [0x00000] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Infrastructure.BinaryTextWriter.Write (System.ArraySegment`1[T] data) [0x00006] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Transports.PersistentResponse.WriteMessages (System.IO.TextWriter writer, Newtonsoft.Json.JsonTextWriter jsonWriter) [0x0006b] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Transports.PersistentResponse.Microsoft.AspNet.SignalR.Json.IJsonWritable.WriteJson (System.IO.TextWriter writer) [0x000f5] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Json.JsonNetSerializer.Serialize (System.Object value, System.IO.TextWriter writer) [0x0000a] in <116a5b546e994fda931777d7e7546533>:0 
  at NzbDrone.SignalR.Serializer.Serialize (System.Object value, System.IO.TextWriter writer) [0x0001f] in <3f7b0f644582448f9d502028f0ca7c1a>:0 
  at Microsoft.AspNet.SignalR.Transports.LongPollingTransport.PerformSend (System.Object state) [0x000a1] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Transports.LongPollingTransport+<>c.<Send>b__43_0 (System.Object state) [0x00000] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.Infrastructure.TaskQueue.<Enqueue>b__14_0 (System.Func`2[T,TResult] next, System.Object nextState) [0x00000] in <116a5b546e994fda931777d7e7546533>:0 
  at Microsoft.AspNet.SignalR.TaskAsyncHelper.FromMethod[T1,T2] (System.Func`3[T1,T2,TResult] func, T1 arg1, T2 arg2) [0x00000] in <116a5b546e994fda931777d7e7546533>:0 <---

In the debug file I also see:

18-5-11 00:24:38.4|Debug|Api|[GET] /api/queue?sort_by=timeleft&order=asc: 200.OK (2 ms)
18-5-11 00:24:38.0|Error|CommandExecutor|Error occurred while executing task CheckForFinishedDownload

[v2.0.0.5163] System.Data.SQLite.SQLiteException (0x80004005): database is locked
database is locked
  at System.Data.SQLite.SQLite3.Step (System.Data.SQLite.SQLiteStatement stmt) [0x00088] in <61a20cde294d4a3eb43b9d9f6284613b>:0 
  at System.Data.SQLite.SQLiteDataReader.NextResult () [0x0016b] 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 Marr.Data.QGen.UpdateQueryBuilder`1[T].Execute () [0x00046] in <df579eae740742b8a97f4c5d56007dcf>:0 
  at NzbDrone.Core.Datastore.BasicRepository`1[TModel].SetFields (TModel model, System.Linq.Expressions.Expression`1[System.Func`2[TModel,System.Object]][] properties) [0x000c1] in <9b8bbe29888f49229914613e26af4aa5>:0 
  at NzbDrone.Core.Messaging.Commands.CommandRepository.End (NzbDrone.Core.Messaging.Commands.CommandModel command) [0x00124] in <9b8bbe29888f49229914613e26af4aa5>:0 
  at NzbDrone.Core.Messaging.Commands.CommandQueueManager.Update (NzbDrone.Core.Messaging.Commands.CommandModel command, NzbDrone.Core.Messaging.Commands.CommandStatus status, System.String message) [0x00081] in <9b8bbe29888f49229914613e26af4aa5>:0 
  at NzbDrone.Core.Messaging.Commands.CommandQueueManager.Complete (NzbDrone.Core.Messaging.Commands.CommandModel command, System.String message) [0x00000] in <9b8bbe29888f49229914613e26af4aa5>:0 
  at NzbDrone.Core.Messaging.Commands.CommandExecutor.ExecuteCommand[TCommand] (TCommand command, NzbDrone.Core.Messaging.Commands.CommandModel commandModel) [0x000f6] in <9b8bbe29888f49229914613e26af4aa5>:0 
  at (wrapper dynamic-method) System.Object.CallSite.Target(System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,NzbDrone.Core.Messaging.Commands.CommandExecutor,object,NzbDrone.Core.Messaging.Commands.CommandModel)
  at NzbDrone.Core.Messaging.Commands.CommandExecutor.ExecuteCommands () [0x0008c] in <9b8bbe29888f49229914613e26af4aa5>:0 

18-5-11 00:26:08.4|Debug|SabnzbdProxy|Url: http://(removed/localhost):8080/api?mode=queue&start=0&limit=0&apikey=(removed)&output=json
18-5-11 00:26:08.4|Debug|SabnzbdProxy|Url: http://(removed/localhost):8080/api?mode=history&start=0&limit=30&category=tv&apikey=(removed)&output=json
18-5-11 00:26:08.5|Debug|Api|[GET] /api/queue?sort_by=timeleft&order=asc: 200.OK (3 ms)

The debug log ends with:

18-5-11 00:41:40.1|Fatal|NzbDroneErrorPipeline|Request Failed. GET /api/queue

[v2.0.0.5163] System.Data.SQLite.SQLiteException (0x80004005): unable to open database file
unable to open database file
  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 Marr.Data.DataMapper.OpenConnection () [0x00024] in <df579eae740742b8a97f4c5d56007dcf>:0 
  at Marr.Data.DataMapper.Query[T] (System.String sql, System.Collections.Generic.ICollection`1[T] entityList, System.Boolean useAltName) [0x00065] in <df579eae740742b8a97f4c5d56007dcf>:0 
  at Marr.Data.QGen.QueryBuilder`1[T].ToList () [0x00052] in <df579eae740742b8a97f4c5d56007dcf>:0 
  at Marr.Data.QGen.SortBuilder`1[T].ToList () [0x00000] in <df579eae740742b8a97f4c5d56007dcf>:0 
  at Marr.Data.QGen.SortBuilder`1[T].op_Implicit (Marr.Data.QGen.SortBuilder`1[T] builder) [0x00000] in <df579eae740742b8a97f4c5d56007dcf>:0 
  at NzbDrone.Core.Download.Pending.PendingReleaseRepository.WithoutFallback () [0x0007c] in <9b8bbe29888f49229914613e26af4aa5>:0 
  at NzbDrone.Core.Download.Pending.PendingReleaseService.GetPendingQueue () [0x00018] in <9b8bbe29888f49229914613e26af4aa5>:0 
  at NzbDrone.Api.Queue.QueueModule.GetQueueItems () [0x0000b] in <4f8da191197f4881ab901af5fd83aaa2>:0 
  at NzbDrone.Api.Queue.QueueModule.GetQueue () [0x00000] in <4f8da191197f4881ab901af5fd83aaa2>:0 
  at NzbDrone.Api.REST.RestModule`1[TResource].<set_GetResourceAll>b__32_0 (System.Object options) [0x00006] in <4f8da191197f4881ab901af5fd83aaa2>:0 
  at (wrapper dynamic-method) System.Object.CallSite.Target(System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,System.Func`2<object, object>,object)
  at Nancy.Routing.Route+<>c__DisplayClass4.<Wrap>b__3 (System.Object parameters, System.Threading.CancellationToken context) [0x00049] in <63c44d6f8d7e4f339a987bf9eb94d931>:0 

18-5-11 00:41:40.2|Debug|Api|[GET] /api/queue?sort_by=timeleft&order=asc: 500.InternalServerError (64 ms)

Lastly in the log I see the following just before I get spammed with the “Task Error: unable to open database file”.

image
and
image

Thank you for anyone looking at this.

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