For a while now, I’ve been running into some frustrating trouble. I run my server off a Synology DS418Play, and often when I or friends/family members attempt to connect to my Plex, we see the client hang for several seconds before it gives us “There was an unexpected error loading this library” and the option to retry. We retry and then it works without trouble.
Why is this happening? I’ve also noticed on iOS the same thing happening, which means often I have to wait an extra minute or so whenever I make a new selection.
I don’t know if it’s related, but I get a notification from my iPad around 3-4am each morning that the database is corrupted, when very clearly I can keep using it.
If it helps, it’s worth noting that this error still pops up if I’m on the same network.
I’ve included the logs below. Any help would be appreciated, thanks!
From the Plex Media Server.log file (repeats 9000+ times):
Jan 29, 2020 08:22:40.887 [0x7f83e9a8b700] ERROR - SQLITE3:(nil), 11, database corruption at line 79051 of [bf8c1b2b7a]
Jan 29, 2020 08:22:40.887 [0x7f83e9a8b700] ERROR - SQLITE3:(nil), 11, statement aborts at 9: [select statistics_bandwidth.id as 'statistics_bandwidth_id', statistics_bandwidth.account_id as 'statistics_bandwidth_account_id', statistics_bandwidth.device_id as 'statistics_bandwidt
Jan 29, 2020 08:22:40.887 [0x7f83e9a8b700] ERROR - Thread: Uncaught exception running async task which was spawned by thread 0x7f84255c6700: sqlite3_statement_backend::loadOne: database disk image is malformed
So it definitely looks like the issue is with a corrupt database. Okay, this is very helpful and a great start!
My next question is that it looks like the linked instructions to repairing a corrupt database require command line/terminal. Does anyone have any experience doing this through Synology?
I know it’s a linux-based platform and that there’s a way through control panel to enable SSH connection ala terminal… though my experience of Terminal is limited to a little directory command/execution when spending a few weeks learning python.
It sounds like Synology’s DSM control panel enables this work to be done from a different computer; any way to follow the instructions through the quickconnect interface? As in, is there an app that lets me run command line directly through the DSM desktop?
Or is there some other, Synology-specific way to attempt these repairs?
Thanks for the replies so far!
Oh also, I don’t know if there’s a good idea in attempting to restore a previous database. It’s been like this for a few months and I have no idea how far back I’d have to go to get a *clean iteration of the database. There’s mention that simply removing the com.plexapp.plugins.library.dbfile could get it to fix; I could definitely do that without going command line, should I just do that? I’m okay if my Plex needs several hours (or days…?) to rebuild the entire database.
Though it is worth noting that I also use filebot. I don’t know if any of you are familiar w/ it, but essentially it batch renames/sorts files to plex format, grabs subtitles, relevant cover art, backgrounds, etc. Would rebuilding the database undo all that? My assumption of the database is that it just looks at what the files actually are and just aligns all that data for the server/client to read and present accurately.
For many CLI operations you need to be root. To become root, use the sudo command. After logging in with your userid, issue the command sudo -i. You’ll be prompted for the administrative password. Once entered, you’ll be root. Use exit or logout to return to your normal userid.
login as: User
User@host's password:
User@host:~$ sudo -i
Password:
root@host:~#
That’s why I would wait for Chuck. He seems to be the point man for Synology here on the forums. He’s helped lot’s of folks. Looks like @FordGuy61 also has some good links for you. Good Luck!
As an aside, is your NAS on a battery backup? If not, a sudden power outage could be the source of your corrupt database. I’m a believer in battery backups for servers at least.
Also, shutdown PMS before performing a DSM upgrade. I saw on another thread (probably written by @ChuckPa), that the DSM upgrade does not gracefully shutdown running applications, it just sends them a kill signal. That can also lead to database corruption.
Your assumption is correct. Plex pulls metadata from the files and/or online sources and stores it in the database.
Some or all of the information in your database might (will) be lost during a recovery/rebuild. So, Plex will have to rescan your media and redownload data from online sources. However, it will not modify your files.
If you want to try repairing the database first, this post mentions copying the db file to another platform - Windows/Mac/etc - to attempt the repair.
That would let you work in an environment more familiar than Synology CLI.
Sorry for the delay. I was completely preoccupied with PMS packaging for Debian/Ubuntu
The database is corrupt.
Jan 29, 2020 08:22:40.892 [0x7f8413a23700] DEBUG - Streaming Resource: Usage: 0kbps of WAN bandwidth, 0 streaming transcode slots, and 0 static transcode slots across 0 sessions
Jan 29, 2020 08:22:40.892 [0x7f83ea067700] ERROR - Thread: Uncaught exception running async task which was spawned by thread 0x7f84255c6700: sqlite3_statement_backend::loadOne: database disk image is malformed
Jan 29, 2020 08:22:40.892 [0x7f8413735700] ERROR - Thread: Uncaught exception running async task which was spawned by thread 0x7f84255c6700: sqlite3_statement_backend::loadOne: database disk image is malformed
Jan 29, 2020 08:22:40.893 [0x7f8412bfc700] ERROR - SQLITE3:(nil), 11, database corruption at line 79051 of [bf8c1b2b7a]
This looks incredibly comprehensive, thank you! And thanks to the rest for all your help, I’ll try this when I get home tonight.
One last question I hope you can answer for me: How do I properly shut down the PMS through DSM? Do I just kill the process? The app doesn’t really do anything beyond telling me that I can’t use it through DSM.
I have also been experiencing database corruption since I upgraded Plex Server on my Synology NAS (currently on 1.18.5.2309, but I believe it started occurring on the prior release):
Feb 09, 2020 12:01:51.394 [0x7f6b2c02b700] INFO - Plex Media Server v1.18.5.2309-f5213a238 - Synology DS713+ x86_64 - build: linux-x86_64 synology - GMT -05:00
Feb 09, 2020 12:01:51.394 [0x7f6b2c02b700] INFO - Linux version: DSM 6.2.2.24922-4, language: en-US
Feb 09, 2020 12:01:51.394 [0x7f6b2c02b700] INFO - Processor Intel(R) Atom(TM) CPU D2701 @ 2.13GHz
Feb 09, 2020 12:01:51.394 [0x7f6b2c02b700] INFO - /var/packages/Plex Media Server/target/Plex Media Server
Feb 09, 2020 12:01:55.983 [0x7f6b366cf740] INFO - SQLITE3:(nil), 283, recovered 979 frames from WAL file /volume2/Plex/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db-wal
Feb 09, 2020 12:01:59.325 [0x7f6b366cf740] ERROR - SQLITE3:(nil), 11, database corruption at line 64883 of [bf8c1b2b7a]
Feb 09, 2020 12:01:59.325 [0x7f6b366cf740] ERROR - SQLITE3:(nil), 11, statement aborts at 10: [select max(max(metadata_items.changed_at),max(metadata_items.resources_changed_at)) from metadata_items] database disk image is malformed
Feb 09, 2020 12:01:59.520 [0x7f6b366cf740] ERROR - Database corruption: sqlite3_statement_backend::loadOne: database disk image is malformed
Feb 09, 2020 12:01:59.520 [0x7f6b366cf740] ERROR - Error: Unable to set up server: sqlite3_statement_backend::loadOne: database disk image is malformed (N4soci10soci_errorE)
At the time I updated to the latest release and found the corrupt database message, I restored from a backup (following the directions posted above) and was able to start the server, but a few days later it crashed again.