Sonarr version (exact version): 2.0.0.4949 (various really)
Mono version (if Sonarr is not running on Windows): 3.10
OS: FreeNAS 9.x
((Debug logs)):
(Make sure debug logging is enabled in settings and post the full log to hastebin/pastebin/dropbox/google drive or something similar, do not post them directly here)
Description of issue: Random periodic crashes since I started using Sonarr a few years ago. Underlying causes are many and varied, can almost always be triggered with a large amount of tracked content combined with large download queue. If it has been awhile since I noticed it crashed it will take two or three rounds of things crashing unable to cope with updating all the series and RSS updates. Crash often leaves status endpoint responding, sometimes other endpoints in the UI will return results if cached.
While a fix would be great I’m not sure I think is one issue let alone one bug to fix here. There are other web-ui based apps that look like they are probably built on the same .Net framework and have similar stability issues and it feels like the underlying DB could be a contention point as well. Really, a pluggable sql db like Maria might be a better choice or at least a configurable option for one. But devs don’t have all the time in the world for a project like this and I don’t have the time to help so I’ll leave my armchair analysis at that.
I’m working on a very simple bandaid stuffed in a cronjob that kills any errant processes and restarts the app. Initial issue started here https://github.com/Sonarr/Sonarr/issues/2200 stating what I’m doing (essentially wget and scrapping for the ApiKey). Unfortunately, at some point within about 72hrs of a fresh start a state occurs where the app does not otherwise seem to function (no new downloads based on calendar, updates to db, or to logs) but is able to respond to this request!
Update 10/03/2017 Since 10/01 in addition to “/usr/local/bin/wget http://10.10.0.13:8989/system/status --no-cache -q -T1 -O - | /usr/bin/grep ApiKey” I’m also stating nzbdrone.db-shm and making sure it has been updated within the last 15min (This file appears to be updated more frequently than the nzbdrone.db but that might be ‘good enough’). So far this seems to be working well. I just run the check every minute and Sonarr has always been up and responsive when I’ve needed it.
As you can see below, this is dramatically better than blindly restarting every 30min or a long period like 4hrs that potentially leaves Sonarr hung for 3:45 of it. There are obviously some issues in there with checks overlapping restarts but that just means I need a locking mechanism and really isn’t related to Sonarr.
Sun Oct 1 22:46:01 2017 - Restarting Sonarr, unable to stat db file...
Sun Oct 1 23:18:01 2017 - Restarting Sonarr, unable to stat db file...
Mon Oct 2 00:45:00 2017 - Restarting Sonarr, unable to stat db file...
Mon Oct 2 01:05:01 2017 - Restarting Sonarr, unable to stat db file...
Mon Oct 2 01:37:00 2017 - Restarting Sonarr, unable to stat db file...
Mon Oct 2 01:38:00 2017 - Restarting Sonarr, unable to get API key...
Mon Oct 2 02:41:00 2017 - Restarting Sonarr, unable to stat db file...
Mon Oct 2 03:43:00 2017 - Restarting Sonarr, unable to stat db file...
Mon Oct 2 04:09:00 2017 - Restarting Sonarr, unable to stat db file...
Mon Oct 2 04:51:00 2017 - Restarting Sonarr, unable to stat db file...
Mon Oct 2 05:12:00 2017 - Restarting Sonarr, unable to stat db file...
Mon Oct 2 07:56:00 2017 - Restarting Sonarr, db not accessed in 15min.time ius 1506948060 atime is 1506948008..
Mon Oct 2 11:58:01 2017 - Restarting Sonarr, unable to stat db file...
Mon Oct 2 15:27:00 2017 - Restarting Sonarr, unable to stat db file...
Mon Oct 2 15:28:00 2017 - Restarting Sonarr, unable to get API key...
Mon Oct 2 15:58:00 2017 - Restarting Sonarr, unable to stat db file...
Mon Oct 2 16:07:00 2017 - Restarting Sonarr, unable to stat db file...
Mon Oct 2 16:29:00 2017 - Restarting Sonarr, unable to stat db file...
Mon Oct 2 16:36:00 2017 - Restarting Sonarr, unable to stat db file...
Mon Oct 2 16:54:00 2017 - Restarting Sonarr, db not accessed in 15min.time ius 1506980340 atime is 1506980324..
Mon Oct 2 16:55:02 2017 - Restarting Sonarr, unable to stat db file...
Tue Oct 3 02:57:01 2017 - Restarting Sonarr, unable to stat db file...
Tue Oct 3 02:59:05 2017 - Restarting Sonarr, unable to get API key...