Unexplained Server Crash

Hey All,

We just had a random, rare server crash last night while watching a movie. The server had been working okay earlier during the evening.

The QNAP was direct streaming to a Shield. Was a 4K file. Usually you can restart the app on the QNAP and server will return, however in this instance I had to reboot the QNAP entirely.

I have attached logs from the time. Server crashed @23:13. I can see that a crash log was sent at the time to Plex.

QNAP is a TVS1282T running on a 1Gb wired network. Client was a NVIDIA Shield.

Plex Media Server Logs_2018-06-29_23-46-27.zip (2.3 MB)

Bad database, from the looks of it

Jun 29, 2018 23:13:51.046 [0x7f0b94124800] ERROR - SQLITE3:0x10, 15, locking protocol
Jun 29, 2018 23:13:51.046 [0x7f0b94124800] ERROR - Database corruption: sqlite3_statement_backend::prepare: locking protocol for SQL: PRAGMA cache_size=2000

See: https://support.plex.tv/articles/202485658-restore-a-database-backed-up-via-scheduled-tasks/

So the next question is, how do I check the backups for corruption before I restore?

See this post:

To add to response from @dane22

To try to repair

cd /share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Library/Plex Media Server/Plug-in Support/Databases/

The repair sequence (modified from the support article to allow for recent changes)

sqlite3 com.plexapp.plugins.library.db "DROP index 'index_title_sort_naturalsort'"
sqlite3 com.plexapp.plugins.library.db "DELETE from schema_migrations where version='20180501000000'"
sqlite3 com.plexapp.plugins.library.db .dump > dump.sql
mv com.plexapp.plugins.library.db com.plexapp.plugins.library.db.original
sqlite3 com.plexapp.plugins.library.db < dump.sql

Prior to restarting your Plex Media Server, you should also delete or backup and move elsewhere the following two files if they exist alongside the original database:

com.plexapp.plugins.library.db-shm
com.plexapp.plugins.library.db-wal

Scheduled Backups would not be produced if the database is corrupt - so no need to test backups

But sequence to check a db is now

sqlite3 com.plexapp.plugins.library.db "DROP index 'index_title_sort_naturalsort'"
sqlite3 com.plexapp.plugins.library.db "DELETE from schema_migrations where version='20180501000000'"
sqlite3 com.plexapp.plugins.library.db "PRAGMA integrity_check"
1 Like

Thanks for the help guys.

I just checked and an auto DB backup was done yesterday. Going by what sa2000 said it shouldn’t have backed up if the DB was corrupt?

We do an integrity_check before the scheduled backup is started and would not start one if it fails.
Anyway - no harm in trying to restore from it

Okay, thanks. I will do an integrity check on the current DB before doing any restores just to make sure.

If it does show that the DB is okay, any other ideas on the crash? I was the only user accessing the server at the time.

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