PMS crashes at startup and database repair fails

Server Version#: v1.15.2.793-782228f99
Player Version#:

After updating my Mac to Mojave i noticed that PMS crashed after startup. The logs showed me this:

Mar 19, 2019 22:41:41.988 [0x700004564000] INFO - Plex Media Server v1.15.2.793-782228f99 - Apple Mac x86_64 - build: darwin-x86_64 macos - GMT 01:00
Mar 19, 2019 22:41:41.990 [0x700004564000] INFO - MacOSX version: 10.14, language: en-BE
Mar 19, 2019 22:41:41.990 [0x700004564000] INFO - Processor Intel® Core™ i5-3210M CPU @ 2.50GHz
Mar 19, 2019 22:41:41.990 [0x700004564000] INFO - /Applications/Plex Media Server.app/Contents/MacOS/Plex Media Server
Mar 19, 2019 22:41:42.347 [0x700004876000] DEBUG - BPQ: [Idle] -> [Starting]
Mar 19, 2019 22:41:42.356 [0x700004876000] DEBUG - FeatureManager: Using cached data for features list
Mar 19, 2019 22:41:42.370 [0x700004876000] DEBUG - Opening 20 database sessions to library (com.plexapp.plugins.library), SQLite 3.26.0, threadsafe=1
Mar 19, 2019 22:41:42.488 [0x700004876000] DEBUG - Running migrations. (EPG 0)
Mar 19, 2019 22:41:42.494 [0x700004876000] DEBUG - Running forward migration 20180501000000.
Mar 19, 2019 22:41:42.495 [0x700004876000] DEBUG - Captured session 0.
Mar 19, 2019 22:41:42.495 [0x700004876000] DEBUG - Captured session 1.
Mar 19, 2019 22:41:42.495 [0x700004876000] DEBUG - Captured session 2.
Mar 19, 2019 22:41:42.495 [0x700004876000] DEBUG - Captured session 3.
Mar 19, 2019 22:41:42.495 [0x700004876000] DEBUG - Captured session 4.
Mar 19, 2019 22:41:42.495 [0x700004876000] DEBUG - Captured session 5.
Mar 19, 2019 22:41:42.495 [0x700004876000] DEBUG - Captured session 6.
Mar 19, 2019 22:41:42.496 [0x700004876000] DEBUG - Captured session 7.
Mar 19, 2019 22:41:42.496 [0x700004876000] DEBUG - Captured session 8.
Mar 19, 2019 22:41:42.496 [0x700004876000] DEBUG - Captured session 9.
Mar 19, 2019 22:41:42.496 [0x700004876000] DEBUG - Captured session 10.
Mar 19, 2019 22:41:42.496 [0x700004876000] DEBUG - Captured session 11.
Mar 19, 2019 22:41:42.496 [0x700004876000] DEBUG - Captured session 12.
Mar 19, 2019 22:41:42.496 [0x700004876000] DEBUG - Captured session 13.
Mar 19, 2019 22:41:42.496 [0x700004876000] DEBUG - Captured session 14.
Mar 19, 2019 22:41:42.496 [0x700004876000] DEBUG - Captured session 15.
Mar 19, 2019 22:41:42.496 [0x700004876000] DEBUG - Captured session 16.
Mar 19, 2019 22:41:42.496 [0x700004876000] DEBUG - Captured session 17.
Mar 19, 2019 22:41:42.496 [0x700004876000] DEBUG - Captured session 18.
Mar 19, 2019 22:41:42.496 [0x700004876000] DEBUG - Captured session 19.
Mar 19, 2019 22:41:43.970 [0x7000049ff000] DEBUG - Job running: ‘/Applications/Plex Media Server.app/Contents/MacOS/CrashUploader’ ‘–directory=/Users/tmussche/Library/Application Support/Plex Media Server/Crash Reports/1.15.2.793-782228f99’ ‘–version=1.15.2.793-782228f99’ ‘–platform=MacOSX’ ‘–platformVersion=10.14’ ‘–serverUuid=4027ad86f6b9295ad8de4a870a28dc0058f0a899’ ‘–userId=tmussche@gmail.com’ ‘–sentryUrl=https://sentry.io/api/1233455/minidump’ ‘–sentryKey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’ ‘–vendor=Apple’ ‘–model=x86_64’ ‘–device=Mac’
Mar 19, 2019 22:41:43.971 [0x7000049ff000] DEBUG - Jobs: Starting child process with pid 1801
Mar 19, 2019 22:41:44.021 [0x70000497c000] DEBUG - Jobs: ‘/Applications/Plex Media Server.app/Contents/MacOS/CrashUploader’ exit code for process 1801 is 0 (success)
Mar 19, 2019 22:41:44.072 [0x700004876000] ERROR - SQLITE3:0x10d9b6118, 11, database corruption at line 64757 of [bf8c1b2b7a]
Mar 19, 2019 22:41:44.073 [0x700004876000] ERROR - SQLITE3:0x10d9b6118, 11, database corruption at line 64798 of [bf8c1b2b7a]
Mar 19, 2019 22:41:44.073 [0x700004876000] ERROR - SQLITE3:0x10d9b6118, 11, statement aborts at 19: [CREATE INDEX ‘index_title_sort_naturalsort’ ON ‘metadata_items’ (‘title_sort’ COLLATE naturalsort)] database disk image is malformed
Mar 19, 2019 22:41:44.075 [0x700004876000] ERROR - Exception inside transaction (inside=1) (…/Library/DatabaseMigrations.cpp:204): sqlite3_statement_backend::loadOne: database disk image is malformed
Mar 19, 2019 22:41:44.078 [0x700004876000] ERROR - Exception thrown during migrations, aborting: sqlite3_statement_backend::loadOne: database disk image is malformed
Mar 19, 2019 22:41:44.297 [0x700004876000] ERROR - SQLITE3:0x10d9b6118, 11, database corruption at line 64757 of [bf8c1b2b7a]
Mar 19, 2019 22:41:44.297 [0x700004876000] ERROR - SQLITE3:0x10d9b6118, 11, database corruption at line 64798 of [bf8c1b2b7a]
Mar 19, 2019 22:41:44.297 [0x700004876000] ERROR - SQLITE3:0x10d9b6118, 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
Mar 19, 2019 22:41:44.299 [0x700004876000] ERROR - Database corruption: sqlite3_statement_backend::loadOne: database disk image is malformed
Mar 19, 2019 22:41:44.299 [0x700004876000] ERROR - Error: Unable to set up server: sqlite3_statement_backend::loadOne: database disk image is malformed (N4soci10soci_errorE)

After some googling i found the instructions to repair a corrupt database. The

sqlite3 com.plexapp.plugins.library.db “DROP index ‘index_title_sort_naturalsort’”

line gave the error:

Error: no such index: index_title_sort_naturalsort

If I continue with the repair i get a com.plexapp.plugins.library.db file of size 0. Obviously plex also crashes with that db file.

I also noticed the latest backup of the .db file is almost a year old, while i had setup to regularly take a backup of the db. I see that i have a recent backup (?) of the com.plexapp.plugins.library.blobs.db file,

Anything i can try before i rebuild my entire Library (or restore a year-old one)?

Thanks!
Tim

1 Like

A backup is attempted every 3 days during Scheduled Tasks but if the database fails the integrity check then the backup aborts. Sounds like there may have been corruptions for a while. Corruptions tend to cause serious issues when the Plex Media Server is upgraded and there is a database schema update - in such case all database tables and data needs to be accessed and any old corruptions would stop that

You could zip the db files (.db/.wal/shm) and send me by private message and will see the extent of the corruption

If repair fails and there is no usable backup then the only option is to recreate the server from scratch

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