When I run an Optimize Database from the Plex UI, Plex becomes completely unresponsive, requiring a Plex server restart. I have seen several other posts and threads about this issue, but no actual fixes that apply to my situation/setup.
Including logs grabbed after an Optimize attempt and Plex restart. Any help would be greatly appreciated. Thanks!
@ChuckPa sorry to ping you, but I’ve seen you replying to other threads, and have been very helpful. I was hoping you could take a look into my logs and see if you can figure out what’s going on in my case. Thanks!
Optimizing the database will suspend all other operations currently in progress because of what it’s doing.
In order to safely clean out all the empty space in the database, the process must know that nothing is in the process of using a spot about to get removed Therefore, it exclusively locks the database for it’s sole use during that time.
Most of us put our metadata (only) on SSDs so that time is further limited.
Looking at your logs is fairly routine.
I see some media deletion (files moved ?) and playback tasks.
Hi @ChuckPa, thanks for your response. The database is on a high speed NVMe drive.
My problem is that it never seems to recover from the Optimize operation. I eventually have to restart the Plex server, otherwise it remains unresponsive.
The first time I noticed this was when the overnight scheduled task ran an Optimize, and the next morning when I woke up, the server was not reachable. At that point I restarted it and removed the Optimize from the scheduled tasks. But again, whenever I run it manually, it never recovers.
Can I ask you this … what actual sqlite operations are being performed by the Optimize routine? Is it the same as in this link: Repair a Corrupted Database | Plex Support? If so, I could write an external script to quit Plex, run those commands, then restart the server. That might be quicker than having it done while Plex is running. Thoughts?
Doing it with a script is certainly quicker, but you might be missing messages about a failed repair.
I recommend you to perform the “manual” repair procedure. Interactively, one command at a time.
I understand that the server will be unresponsive while the optimization task is being executed, but everyone seems to think that the optimization should be quick, but mine hangs for a long time and sometimes requires a docker restart. I’ve checked the logs, but can’t find where the optimization entries are.
How can I determine what’s going on with the optimization task and how to speed it up? My library is not large.