Consistently getting Database Corrupted error/notification

Server Version#: 1.26.2.5797
The title pretty much describes it. I’m constantly getting a report of DB corruption from the various apps (iOS) that connect to the Media server (macOS). The hardware is an i7 Mini with SSD internal storage. Standard install using the Mac server app.

I’ve gone through the process to repair the DB a number of times and I don’t get the notice for a while. The real question is why is it happening and is there anything to resolve this?

I have no indication there is actual corruption in the “day to day” usage. It is just the notification from the Plex app on my phone as an example.

Power failure or AntiVira solutions scanning the database directory are the most common causes

I run no AV on this system and it is on an UPS. Last reboot was for updates which was controlled with a proper “quit” on PMS.

Then right after it happens again, post PMS Logs

Sure thing. Is there something I should grep through the logs for now?

I’m going to go through the process to repair the DB again now, but before I do I will dig through the logs if you would like.

No idea, since provided info is simply too little

Fair enough, any additional information I can provide you?

Logs would be a good start :wink:

https://turtle2472.com/an/PMSLogs_2022-05-25.zip

I should have added that at 0200 EDT the scheduled tasks run and at 0202 EDT I got the corrupted notice.

@turtle2472 Debug logging is disabled on your server. This makes it difficult to troubleshoot problems, as necessary information is not captured.

Check the box for DEBUG level logs in Settings → Server_Name → General.

Do not check the box for verbose level logs (Verbose generally provides too much information, which makes the logs difficult to read. It also causes the logs to wrap quickly, sometimes losing desired information.).

Restart Plex Media Server. This will let the logs capture the startup sequence and should force a scan of the libraries.

When you next see the notice, pull the logs and attach to the thread.

Note: Database corruption appears as SQLITE3 errors in Plex Media Server.log (and .1 to .5). The messages usually mention database corruption, a malformed database, or something similar.

Example:
Oct 20, 2019 10:25:27.220 [0x7fdc47447700] ERROR - SQLITE3:(nil), 11, database corruption at line 64817 of [bf8c1b2b7a]

1 Like

Thanks. I’ve enabled debugging but I’m going to have to sanitize these logs. So much information that I really don’t care to share in these logs.

RackMini:Plex Media Server turtle2472$ grep "SQLITE3" *.log* 
Plex Media Server.1.log:May 25, 2022 11:45:37.760 [0x7000029db000] INFO - [Database optimization/com.plexapp.plugins.library.db] SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.1.log:May 25, 2022 11:45:37.763 [0x7000029db000] INFO - [Database optimization/com.plexapp.plugins.library.db] SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.1.log:May 25, 2022 11:45:37.767 [0x7000029db000] INFO - [Database optimization/com.plexapp.plugins.library.db] SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.1.log:May 25, 2022 11:45:37.769 [0x7000029db000] INFO - [Database optimization/com.plexapp.plugins.library.db] SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.1.log:May 25, 2022 11:45:37.770 [0x7000029db000] INFO - [Database optimization/com.plexapp.plugins.library.db] SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.1.log:May 25, 2022 11:45:37.771 [0x7000029db000] INFO - [Database optimization/com.plexapp.plugins.library.db] SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.1.log:May 25, 2022 11:45:37.772 [0x7000029db000] INFO - [Database optimization/com.plexapp.plugins.library.db] SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.1.log:May 25, 2022 11:45:37.773 [0x7000029db000] INFO - [Database optimization/com.plexapp.plugins.library.db] SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.1.log:May 25, 2022 11:45:37.774 [0x7000029db000] INFO - [Database optimization/com.plexapp.plugins.library.db] SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.1.log:May 25, 2022 11:45:37.775 [0x7000029db000] INFO - [Database optimization/com.plexapp.plugins.library.db] SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.1.log:May 25, 2022 11:45:37.776 [0x7000029db000] INFO - [Database optimization/com.plexapp.plugins.library.db] SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.1.log:May 25, 2022 11:45:37.777 [0x7000029db000] INFO - [Database optimization/com.plexapp.plugins.library.db] SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.1.log:May 25, 2022 11:45:37.778 [0x7000029db000] INFO - [Database optimization/com.plexapp.plugins.library.db] SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.1.log:May 25, 2022 11:45:37.779 [0x7000029db000] INFO - [Database optimization/com.plexapp.plugins.library.db] SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.1.log:May 25, 2022 11:45:37.780 [0x7000029db000] INFO - [Database optimization/com.plexapp.plugins.library.db] SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.1.log:May 25, 2022 11:45:37.781 [0x7000029db000] INFO - [Database optimization/com.plexapp.plugins.library.db] SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.1.log:May 25, 2022 11:45:37.782 [0x7000029db000] INFO - [Database optimization/com.plexapp.plugins.library.db] SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.1.log:May 25, 2022 11:45:37.783 [0x7000029db000] INFO - [Database optimization/com.plexapp.plugins.library.db] SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.1.log:May 25, 2022 11:45:37.784 [0x7000029db000] INFO - [Database optimization/com.plexapp.plugins.library.db] SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.205 [0x70000412b000] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.206 [0x70000412b000] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.207 [0x70000412b000] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.208 [0x70000412b000] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.209 [0x70000412b000] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.210 [0x70000412b000] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.211 [0x70000412b000] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.212 [0x70000412b000] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.213 [0x70000412b000] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.214 [0x70000412b000] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.215 [0x70000412b000] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.216 [0x70000412b000] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.217 [0x70000412b000] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.218 [0x70000412b000] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.219 [0x70000412b000] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.220 [0x70000412b000] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.221 [0x70000412b000] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.222 [0x70000412b000] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.223 [0x70000412b000] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Plex Media Server.3.log:May 25, 2022 10:03:20.295 [0x70000412b000] ERROR - SQLITE3:(nil), 11, database corruption at line 66843 of [1b256d97b5]
Plex Media Server.3.log:May 25, 2022 10:03:20.295 [0x70000412b000] ERROR - SQLITE3:(nil), 11, database corruption at line 66993 of [1b256d97b5]
Plex Media Server.3.log:May 25, 2022 10:03:20.295 [0x70000412b000] ERROR - SQLITE3:(nil), 11, statement aborts at 2949: [ANALYZE] database disk image is malformed
Plex Media Server.5.log:May 25, 2022 02:04:16.229 [0x700007492000] ERROR - SQLITE3:(nil), 11, database corruption at line 66843 of [1b256d97b5]
Plex Media Server.5.log:May 25, 2022 02:04:16.229 [0x700007492000] ERROR - SQLITE3:(nil), 11, database corruption at line 66993 of [1b256d97b5]
Plex Media Server.5.log:May 25, 2022 02:04:16.229 [0x700007492000] ERROR - SQLITE3:(nil), 11, statement aborts at 5: [select id from blobs where linked_type='media_stream' and linked_id=693421 and blob_type=2] database disk image is malformed
Plex Media Server.5.log:May 25, 2022 02:04:25.790 [0x700007492000] ERROR - [Butler] SQLITE3:(nil), 11, database corruption at line 66843 of [1b256d97b5]
Plex Media Server.5.log:May 25, 2022 02:04:25.790 [0x700007492000] ERROR - [Butler] SQLITE3:(nil), 11, database corruption at line 66993 of [1b256d97b5]
Plex Media Server.5.log:May 25, 2022 02:04:25.790 [0x700007492000] ERROR - [Butler] SQLITE3:(nil), 11, statement aborts at 6: [select `blob` from blobs where linked_type='metadata_item' and linked_id=46242 and blob_type=7] database disk image is malformed

Of course, these are all before I did the repair this morning. So for now I’ll leave the debug logging on and see how it works. Assuming it corrupts again I’ll share the relevant logs.

Anything else I can look for on this?

Also check the com.plexapp.plugins.library.blobs.db database with the repair tool

$ "/Applications/Plex Media Server.app/Contents/MacOS/Plex SQLite" com.plexapp.plugins.library.blobs.db "PRAGMA integrity_check"
*** in database main ***
On tree page 890934 cell 7: Rowid 167110 out of order
On tree page 890934 cell 7: 2nd reference to page 890764
On tree page 890934 cell 6: 2nd reference to page 890758
On tree page 890934 cell 5: 2nd reference to page 890754
On tree page 890934 cell 4: 2nd reference to page 890749
On tree page 890934 cell 3: 2nd reference to page 890745
On tree page 890934 cell 2: 2nd reference to page 890739
On tree page 890934 cell 1: 2nd reference to page 890735
On tree page 890934 cell 0: 2nd reference to page 890731
On tree page 884261 cell 101: 2nd reference to page 890727
On tree page 884261 cell 97: 2nd reference to page 890716
On tree page 884261 cell 96: 2nd reference to page 890715
On tree page 884261 cell 95: 2nd reference to page 890714
On tree page 884261 cell 94: 2nd reference to page 890713
On tree page 884261 cell 93: 2nd reference to page 890712
On tree page 884261 cell 92: 2nd reference to page 890711
On tree page 884261 cell 91: 2nd reference to page 884653
On tree page 884261 cell 90: 2nd reference to page 884645
On tree page 884261 cell 89: 2nd reference to page 884640
On tree page 884261 cell 88: 2nd reference to page 884636
On tree page 884261 cell 87: 2nd reference to page 884622
On tree page 884261 cell 86: 2nd reference to page 884618
On tree page 884261 cell 85: 2nd reference to page 884613
On tree page 885899 cell 3: 2nd reference to page 891118
On tree page 885899 cell 32: 2nd reference to page 890978
On tree page 888104 cell 28: 2nd reference to page 891107
On tree page 888104 cell 27: 2nd reference to page 890970
On tree page 890044 cell 23: 2nd reference to page 891236
On tree page 890044 cell 22: 2nd reference to page 891051
Error: database disk image is malformed
$ "/Applications/Plex Media Server.app/Contents/MacOS/Plex SQLite" com.plexapp.plugins.library.blobs.db ".output recover.out" ".recover"

No news is good news I take it.
Edit: nope, recheck is the same. Gonna try the manual repair method now.

$ "/Applications/Plex Media Server.app/Contents/MacOS/Plex SQLite" com.plexapp.plugins.library.blobs.db ".read dump.sql"
Error: near line 85366: UNIQUE constraint failed: blobs.id
Error: near line 85367: UNIQUE constraint failed: blobs.id
Error: near line 85368: UNIQUE constraint failed: blobs.id
Error: near line 85369: UNIQUE constraint failed: blobs.id
Error: near line 85370: UNIQUE constraint failed: blobs.id
Error: near line 85371: UNIQUE constraint failed: blobs.id
Error: near line 85372: UNIQUE constraint failed: blobs.id
Error: near line 85373: UNIQUE constraint failed: blobs.id
Error: near line 85374: UNIQUE constraint failed: blobs.id
Error: near line 85375: UNIQUE constraint failed: blobs.id
Error: near line 85376: UNIQUE constraint failed: blobs.id
Error: near line 85377: UNIQUE constraint failed: blobs.id
Error: near line 85378: UNIQUE constraint failed: blobs.id
Error: near line 85379: UNIQUE constraint failed: blobs.id
Error: near line 85380: UNIQUE constraint failed: blobs.id
Error: near line 85381: UNIQUE constraint failed: blobs.id
Error: near line 85382: UNIQUE constraint failed: blobs.id
Error: near line 85383: UNIQUE constraint failed: blobs.id
Error: near line 85384: UNIQUE constraint failed: blobs.id
Error: near line 85385: UNIQUE constraint failed: blobs.id
Error: near line 85386: UNIQUE constraint failed: blobs.id
Error: near line 85387: UNIQUE constraint failed: blobs.id
Error: near line 85388: UNIQUE constraint failed: blobs.id
Error: near line 85389: UNIQUE constraint failed: blobs.id
Error: near line 85390: UNIQUE constraint failed: blobs.id
Error: near line 85391: UNIQUE constraint failed: blobs.id
Error: near line 85392: UNIQUE constraint failed: blobs.id
Error: near line 85393: UNIQUE constraint failed: blobs.id
Error: near line 85394: UNIQUE constraint failed: blobs.id
Error: near line 85395: UNIQUE constraint failed: blobs.id
Error: near line 85396: UNIQUE constraint failed: blobs.id
Error: near line 85397: UNIQUE constraint failed: blobs.id
Error: near line 85398: UNIQUE constraint failed: blobs.id
Error: near line 85399: UNIQUE constraint failed: blobs.id
Error: near line 85400: UNIQUE constraint failed: blobs.id

Still doesn’t like something in there.

Did you remember to remove/rename the original com.plexapp.plugins.library.blobs.db ?

   43  "/Applications/Plex Media Server.app/Contents/MacOS/Plex SQLite" com.plexapp.plugins.library.blobs.db "PRAGMA integrity_check"
   44  "/Applications/Plex Media Server.app/Contents/MacOS/Plex SQLite" com.plexapp.plugins.library.blobs.db ".output recover.out" ".recover"
   45  ls -lah
   46  "/Applications/Plex Media Server.app/Contents/MacOS/Plex SQLite" com.plexapp.plugins.library.blobs.db "PRAGMA integrity_check"
   47  "/Applications/Plex Media Server.app/Contents/MacOS/Plex SQLite" com.plexapp.plugins.library.blobs.db ".output dump.sql" ".dump"
   48  ls -lah
   49  rm -rvf com.plexapp.plugins.library.blobs.db
   50  "/Applications/Plex Media Server.app/Contents/MacOS/Plex SQLite" com.plexapp.plugins.library.blobs.db ".read dump.sql"
   51  ls -lah

Sure did.

Strange, and you are welcome to upload a zip with your databases somewhere, like dropbox, and then DM me the link so I can take a look, if needed

Done, please do have a look and let me know if you see something I can do on my side to resolve this.