Plex server crash on Mac OS (SQLite migration)

Server Version#: 1.23.4.4805 and higher

Platform: Mac OS 12.1 (Monterey)
Application: Plex server app
1.23.3.4707 - works
1.23.4.4805 - not works, crashing with logs below

Looks like some improvements in db migration performance by up to 70% cause a crash (#13541)

Crash logs:

Jun 19, 2022 21:37:08.387 [0x70000dd8f000] INFO - Plex Media Server v1.23.4.4805-186bae04e - Apple Mac x86_64 - build: darwin-x86_64 macos - GMT 03:00

Jun 19, 2022 21:37:08.387 [0x70000dd8f000] INFO - MacOSX version: 12.1, language: en-US

Jun 19, 2022 21:37:08.387 [0x70000dd8f000] INFO - Processor Intel(R) Core™ i3-10105F CPU @ 3.70GHz

Jun 19, 2022 21:37:08.387 [0x70000dd8f000] INFO - Compiler is - Clang 11.0.1 (https://plex.tv e0c29d5827bc4eaaa2ceb882cbeed224b0960173)

Jun 19, 2022 21:37:08.387 [0x70000dd8f000] INFO - /Applications/Plex Media Server.app/Contents/MacOS/Plex Media Server

Jun 19, 2022 21:37:08.483 [0x70000df18000] DEBUG - BPQ: [Idle] → [Starting]

Jun 19, 2022 21:37:08.483 [0x70000df18000] DEBUG - FeatureManager: Using cached data for features list

Jun 19, 2022 21:37:08.485 [0x70000df18000] DEBUG - Opening 20 database sessions to library (com.plexapp.plugins.library), SQLite 3.35.5, threadsafe=1

Jun 19, 2022 21:37:08.508 [0x70000df18000] DEBUG - Running migrations. (EPG 0)

Jun 19, 2022 21:37:08.508 [0x70000df18000] DEBUG - Running forward migration 20201103130000.

Jun 19, 2022 21:37:08.508 [0x70000df18000] DEBUG - Captured session 0.

Jun 19, 2022 21:37:08.508 [0x70000df18000] DEBUG - Captured session 1.

Jun 19, 2022 21:37:08.508 [0x70000df18000] DEBUG - Captured session 2.

Jun 19, 2022 21:37:08.508 [0x70000df18000] DEBUG - Captured session 3.

Jun 19, 2022 21:37:08.508 [0x70000df18000] DEBUG - Captured session 4.

Jun 19, 2022 21:37:08.509 [0x70000df18000] DEBUG - Captured session 5.

Jun 19, 2022 21:37:08.509 [0x70000df18000] DEBUG - Captured session 6.

Jun 19, 2022 21:37:08.509 [0x70000df18000] DEBUG - Captured session 7.

Jun 19, 2022 21:37:08.509 [0x70000df18000] DEBUG - Captured session 8.

Jun 19, 2022 21:37:08.509 [0x70000df18000] DEBUG - Captured session 9.

Jun 19, 2022 21:37:08.509 [0x70000df18000] DEBUG - Captured session 10.

Jun 19, 2022 21:37:08.509 [0x70000df18000] DEBUG - Captured session 11.

Jun 19, 2022 21:37:08.509 [0x70000df18000] DEBUG - Captured session 12.

Jun 19, 2022 21:37:08.509 [0x70000df18000] DEBUG - Captured session 13.

Jun 19, 2022 21:37:08.509 [0x70000df18000] DEBUG - Captured session 14.

Jun 19, 2022 21:37:08.509 [0x70000df18000] DEBUG - Captured session 15.

Jun 19, 2022 21:37:08.509 [0x70000df18000] DEBUG - Captured session 16.

Jun 19, 2022 21:37:08.509 [0x70000df18000] DEBUG - Captured session 17.

Jun 19, 2022 21:37:08.509 [0x70000df18000] DEBUG - Captured session 18.

Jun 19, 2022 21:37:08.509 [0x70000df18000] DEBUG - Captured session 19.

Jun 19, 2022 21:37:08.961 [0x70000df18000] ERROR - SQLITE3:0x10f317458, 11, database corruption at line 81887 of [1b256d97b5]

Jun 19, 2022 21:37:08.961 [0x70000df18000] ERROR - SQLITE3:0x10f317458, 11, statement aborts at 11: [SELECT media_item_id, media_streams.extra_data FROM media_streams join media_items on media_items.id=media_streams.media_item_id where media_streams.extra_data like ‘%colorTrc%’ and me

Jun 19, 2022 21:37:08.961 [0x70000df18000] ERROR - Exception inside transaction (inside=1) (/data/jenkins/server/1788679104/Library/DatabaseMigrations.cpp:235): sqlite3_statement_backend::loadRS: database disk image is malformed

Jun 19, 2022 21:37:08.962 [0x70000df18000] ERROR - Exception thrown during migrations, aborting: sqlite3_statement_backend::loadRS: database disk image is malformed

Jun 19, 2022 21:37:09.022 [0x70000df18000] DEBUG - ChangestampAllocator: initialized to 2018079650626901721

Jun 19, 2022 21:37:09.022 [0x70000df18000] ERROR - SQLITE3:0x10f317458, 1, no such table: activities in “update activities set finished_at=started_at where finished_at is null”

Jun 19, 2022 21:37:09.022 [0x70000df18000] ERROR - Database corruption: sqlite3_statement_backend::prepare: no such table: activities for SQL: update activities set finished_at=started_at where finished_at is null

The Plex Media Server database is corrupt.

You’ve three options:

  1. Repair
  2. Restore from backup.
  3. Delete & start over.

The repair process is covered in Repair a Corrupted Database.

To restore from a backup, see Restore a Database Backed Up via ‘Scheduled Tasks’.

It is not possible to tell when the corruption occurred. The backup copies of the database may also be corrupt. After loading a backup and restarting Plex, check the Plex Media Server.log file for SQLITE3 errors (any log entry with ERROR - SQLITE3).

If repairing or restoring does not work, the last option is to delete the database and start over. This will not touch your media files. You will have to re-create your libraries, re-share them with any other users, etc.

From the Repair a Corrupted Database support article:
Note : You can also simply delete the com.plexapp.plugins.library.db database file while the Plex Media Server is not running. Restarting the server will then restore your server to a nearly-fresh install state. (i.e. You will lose your existing libraries and need to recreate them , but you won’t be affecting your content itself.)

Typo fixed.

FYI, there is a typo on the Repair a Corrupted Database document.

PRAGMA integrity_check should be PRAGMA integrity_check;
VACUUM should be VACUUM;
REINDEX should be REINDEX;

The commands won’t execute without the semicolon at the end.

The typo has been mentioned to Plex. Updating the thread in case you run the commands before the support document is updated.

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