PMS has been crashing daily

Server Version#: 1.29.0.6219
Player Version#: 4.91.2

PMS had been crashing overnight for a few weeks now. I’ve been busy, and haven’t dug into the matter, hoping a new release would fix the problem. It now seems that it is crashing during the day now too. It has not required a reboot to remedy, as simply restarting PMS works.

Any ideas? Is this a known problem?

Thank you!

Pull debug level logs that capture the crash and post to the thread.

https://support.plex.tv/articles/201643703-reporting-issues-with-plex-media-server/

Plex Media Server Logs_2022-09-23_16-13-26.zip (3.7 MB)

Here are the logs.

First, unless you need it, disable verbose logging. It is not needed for most troubleshooting and causes the log files to wrap quickly, possibly losing desired information. You’ll need to restart Plex Media Server for the change to take effect.

Second, the database on your system is corrupt.

Sep 23, 2022 09:58:27.940 [18408] ERROR - SQLITE3:0xd7372335, 11, database corruption at line 81887 of [1b256d97b5]

You’ve three options:
a) Repair: Repair a Corrupted Database. Run all the steps, including Low-Level Database Recovery.
b) Restore: Restore a Database Backed Up via ‘Scheduled Tasks’. Given that the system has been crashing for a few weeks, the backups may also be corrupt. You can use the steps in the Repair article to check the backup for corruption.
c) Delete and start over. You will have to re-create your libraries. You media is not affected. See the Repair document. Basically, stop Plex; remove all the files in the Databases directory; restart Plex.

Thank you for the valuable info. While I’m discouraged that the database got corrupted somehow, I believe I may have an easier way to repair it - and I welcome your input on this. I periodically perform an image backup of my system drive using Macrium Reflect. I last performed one in late June (long before I started encountering any issues). Therefore, I could restore any or all of my PMS folders and files with uncorrupted data. Naturally there will be a lot of metadata that will be lost, as I’ve added a lot of media since then. However, I’m sure Plex will rebuild that in short order.

What do you think of that approach - and which files/folders should I restore?

Thank you.

That could work.

Was Plex Media Server stopped when you took the image backup?

PMS needs to be stopped so the database files are closed when the backup is taken. If PMS was running, and the db files open, there is a good chance the files will not work. You can always try them and see what happens.

If the backup includes the db backups make by Plex, the ones with yyyy-mm-dd appended, then you could use those files. Plex Media Server closes the database before making those backups, so they should be valid.

The files to restore are com.plexapp.plugins.library.db and com.plexapp.plugins.library.blobs.db.

The location of the database files is %LOCALAPPDATA%\Plex Media Server\Plug-in Support\Databases. On Windows systems, %LOCALAPPDATA% is usually C:\Users\your_user_name\AppData\Local.

The error message is from Plex Media Server.log. Any SQLITE error message indicates a problem with the database. INFO and WARN messages are OK.

If you use the months old backup, Plex will have to migrate the database to match the current schema. This may take some time - minutes, tens of minutes, hours - depending on the size of your db. Plex will be unresponsive while this happens. You may see a 503 error in the web browser saying Plex is performing maintenance. Do not interrupt the process. Let it complete. Otherwise a) it may corrupt the database, and b) it will start over from the beginning when resumed. Reference: The db on my server is 88.5 MB and it migrated in under two minutes. This is on a Synology NAS with a Celeron CPU. Others, with much larger databases, also on Celeron based systems, reported the migration took 2+ hours.

Process:

  1. Run Plex Media Server using current db.
    In Settings → Library, deselect Empty trash automatically after every scan and save changes. Will re-enable later.

  2. Stop Plex Media Server

  3. Make a backup copy of the current Databases folder, then delete all the files in the Databases folder.

  4. Copy the desired backups to the Databases folder: com.plexapp.plugins.library.db and com.plexapp.plugins.library.blobs.db. If you use the backups made by Plex, remove -yyyy-mm-dd from the file names.

  5. Start Plex Media Server.
    Wait for Plex to update the database.

  6. See if Plex works OK - scan libraries, refresh metadata, play some media, etc.

  7. Pull the log files, look in Plex Media Server.log (or .1.log to .5.log) for any SQLITE errors.

If necessary, repeat steps 4 - 7 using other backups, etc. until you find one that works.

Once Plex Media Server is running and stable (see pic below):

  1. Scan all Libraries
  2. Empty Trash
  3. Clean Bundles ← also in Settings → Troubleshooting
  4. Optimize the Database ← also in Settings → Troubleshooting

Restore any Plex Media Server settings, such as Empty Trash automatically.

In Settings → Scheduled Tasks, make sure Backup database every three days is selected.

dance

Yes, PMS was positively stopped when the image was created. Thank you for the detailed instructions! This may take a while for me, as my database file is 1.06GB. Looks like a fun afternoon project! :slight_smile:

I’ll let you know how I make out.

Thanks again. Much appreciated!

Actually there are a bunch of database files in the “Databases” folder. Shouldn’t I replace all of them? Seems like things might progress easier if all the database files correlate to the same date.

What do you think?

The only files you need are the two I mentioned.

Any files with -wal and -shm are temporary files. They are present only when Plex Media Server is running. If they are present when PMS is stopped, they can be deleted.

Any files ending with a date (ex: com.plexapp.plugins.library.db-2022-09-22) are backups. They are not used when PMS is running. Those are made during the maintenance window (Settings → Scheduled Tasks).

Thanks for the picture.

I don’t have the dlna, itunes, or tv.plex.providers.epg.cloud fiels on my system. I do not use the DLNA server, import from iTunes, or the LiveTV/DVR capability (I think that is the epg stuff).

For “regular” Movie/TV Show/etc libraries (DVD rips, downloads, etc), all you need are the two db files I mentioned.

However, it won’t hurt to give it a try.

Plex was stopped when you made the backup, so the files should be good.

Don’t worry about the -shm, -wal, or ones with dates. Restore the rest and see what happens.

From my Synology with Plex Media Server stopped.

I do have the DLNA db file. However, I don’t have the DLNA server enabled. It won’t have any info regarding your libraries. If you don’t use the DLNA server in Plex, then I would not worry about it.

Screenshot (1476)

If manually running “Clean Bundles” crashes it, you have the same problem that many of us do.

Manually cleaning bundles does not crash the server.

So here is the update on the overnight crashing problem with PMS. After restoring the database files with known-good versions from image backups from June, it still continued to crash overnight. - every night. HOWEVER, after installing the two new PMS versions (dated 12/14 and 12/15) my server has not crashed since! Can anyone explain that?
PMS Versions

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