Description:
Plex Media Server becomes unresponsive when the Butler’s scheduled database backup task runs concurrently with an active library scan or credits detection job.
Observed behavior:
The backup thread captures all database sessions (observed up to session 18), creates a 0-byte temporary backup file, and then stops making progress. No error is logged. Concurrently running
threads (scanner, credits detection, metadata refresh) block waiting on database connections held by the backup thread. The server becomes unresponsive and never recovers — no further log lines are written. The WAL file grows unbounded (observed at ~168MB) because no checkpoint can occur while the backup holds open snapshots.
The only recovery is a service restart.
Sequence of events from logs:
- Library scanner is actively processing media (adding/deleting metadata items, writing to DB)
- Butler wakes up and starts the scheduled database backup task
- Backup thread captures all DB sessions (grabs connection pool)
- Backup thread creates the -tmp backup file (0 bytes) but never begins copying pages
- Scanner thread attempts further DB writes but blocks waiting for a connection from the pool
- Credits detection and other threads also block on DB connections
- Log reports: N threads are waiting on db connections held by threads: [backup thread ID repeated]
- No further activity occurs — server is deadlocked
Expected behavior:
The backup should either wait for active scans to complete before acquiring locks, or use a non-blocking mechanism (e.g., sqlite3_backup_step() with SQLITE_BUSY retry) that doesn’t hold the
connection pool while waiting on an active writer. At minimum, there should be a timeout that aborts the backup and releases the locks rather than deadlocking permanently.
Environment:
- Plex Media Server 1.43.0.10492-121068a07
- Linux (Debian), ext4 filesystem
- SQLite database in WAL mode
- ~170MB library database
This unlikely to be a platform-specific issue.