Plex Becomes Unresponsive - DB Locked / Busy logged while unresponsive - pragma integrity_check ok

Server Version#: 1.32.6.7557
Player Version#: N/A, server side issue, web player is at 4.108.0

Plex is preiodically becoming unresponsive. I cannot tell why from the logs myself but I have posted the timeframe from all logs using Promtail → Loki → Grafana scraping the Plex Logs folder. Let me know if you need more from a different timeframe.

Things seem to be running fine until I start seeing “busy database; giving up” and “database is locked” in the logs. I ran a pragma integrity_check which returned ok on the db and blob so it doesn’t seem corrupted. It seems like a thread is locking the database and then dying and never releasing the lock but I’m not sure how to determine that from the logs.

First DB Busy:

2023-09-28 21:53:27.154    
Sep 28, 2023 21:53:27.037 [23299443452728] ERROR - [Req#1abb7a] Waited over 10 seconds for a busy database; giving up.

First DB Locked:

2023-09-28 21:53:51.475    
Sep 28, 2023 21:53:51.410 [23299253861176] ERROR - Got exception from request handler: sqlite3_statement_backend::loadOne: database is locked

Logs:
Plex-logs-from-grafana-2023-09-29 11_04_28.txt (530.5 KB)

Only thing I see is this error before everything locks up:

2023-09-28 21:50:33.660	
Sep 28, 2023 21:50:33.635 [23299243313976] ERROR - [CreditsDetectionManager] BufferingLineReader: failed to read line (error: -1)

Any chance this left my database in a locked state?

Bump.

I’ve been having similar issue with plex ‘crashing’ or becoming non-responsive.

You can check out the thread I started last month.

PMS Crashing and Crashing, etc Help with Logs - Plex Media Server / Desktops & Laptops - Plex Forum

Maybe more users with this issue can help resolve the problem quicker (with more data).

Thanks for the comment! I left things setup tonight like they were when the issue happened. I’ll see if I can reproduce it and fine and simularities in the log.

1 Like

Good luck!

My PMS can work without crashing for 3-6 days and then crash/become unresponsive 6x within 4 hours.

my windows plex player will randomally freeze/circle spin until I close it and reload it and it works fine, that did start like a month ago… wonder if it’s releated

I also get this error: Waited over 10 seconds for a busy database; giving up. I have tried the DB repair tool, reverting to previous docker versions of plex and deleting the db blobs but still to no avail. I have 5 folders, TV, Movies, TV 4K, Movies 4k, and anime. All folders scan fine EXCEPT TV, which when checking logs has the error:

Waited over 10 seconds for a busy database
and
Saving activity history aborted with soci exception: sqlite3_statement_backend::loadOne: database is locked

Once these errors pop up, i cannot open any libraries in plex. This is annoying as I want to add more TV shows but seems I can’t…

I wasn’t able to reproduce the issue last night but it’ll surly happen again as it’s fairly consistent.

Usually hits when Plex Meta Manager is applying overlays. They suggested I jack up my db cache then someone Reddit suggested I tone it down to 100MB since too much cache can be a bad thing. I’ve got plenty of RAM and SSD space so not sure what to set that to, currently at 1024MB.

It was also suggested that I try GitHub - ChuckPa/PlexDBRepair: Database repair utility for Plex Media Server databases. People say this tool makes a big difference in DB performance though my server is like two weeks old so I can’t imagine how crusty the db could have gotten. I started fresh instead of importing things from my old server.

If you look in the troubleshooting section of the WebUI there are a couple compact database/empty trash/clean bundles options. Since you are adding a large volume of media you can leverage those options.

I had ran these:

image

Still havn’t tried the special script that I linked here GitHub - ChuckPa/PlexDBRepair: Database repair utility for Plex Media Server databases but I will if I run into trouble again. The only thing I can think of is that Plex Meta Manager was doing a TON of overlays at first and that in conjunction with something like a credit scan that Plex does hit a deadlock in the database and hung the server application. Now all of my stuff has overlays and PMM is only doing a minumal amount of what has been added / changed since the last time it has ran and I am less likely to hit the issue. I will keep checking back each morning after maintenance and PMM run together and see if if it’s hung.

1 Like

I’ve reverted to a previous build of plex (… 49 the one I was on before) and the issue seems to have carried over :((

1 Like

Keeping this alive. It happened again to me. I configured PMM to use an obscure value for a Plex timeout so I could easily see when it happened. I woke up yesterday and Plex was unresponsive again. I didn’t have a chance to look at it until now, logs are gone but I still have some in Loki.

Here is the first hit I got from the 5th. It kept timing out calls for an hour or so before the script finished running:

2023-10-05 06:19:43.785 | urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(redacted): Read timed out. (read timeout=63) |

What is different this time is the timeouts happen every 7 minutes. The end is PMM logging all of the timeouts, the little blocks evenly spaced are the 7 minute timeouts:

Here is Plex complaining about “busy database” over the same timeframe:

I pulled the PMS logs around the big spike of database is busy error messages. I can’t tell what what was going on that would cause that but I can see it’s scanning new content.

Errors start around here:

2023-10-05 06:49:36.722 Oct 05, 2023 06:49:36.497 [22716651576120] ERROR - Waited over 10 seconds for a busy database; giving up.

Explore-logs-2023-10-05_06_49.zip (108.0 KB)

Is there a more formal way to submit issues to Plex for review? The logs read like something is locking the database indefinetly and when that happens it brings down the entire server because nothing can interact with the database. This would be an issue on Plex’s side, not properly cleaning up whatever resource is hung with the database locked (or dead). Would be good to get their opionion on what is going on in the logs. My first set of logs is a bit more complete. I can pull small chunks from Grafana for a wide time range but my file system only seems to hold about a half of days worth with whatever the roll over policy is configured for:

image

Thanks!

1 Like

This seemed to have fuzzled out so I will probably open a new thread if I want to reproduce the issue. I’ve had good luck only using PMM to manage playlists & collections in an automated fashion. If I want to add overlays or do anything with posters and ratings mass operations I wait until Plex isn’t scanning anything and run the operation. So far so good but Plex shouldn’t lock up the way it is and I’d appreciate some support since it’s a product that we do pay for.

1 Like

I don’t use PMM but I use my own Python scripts with the API and if I change any files in the library while I’m running my scripts it causes crashes and/or long-lasting database locks. I can edit the metadata for a single file and when the Plex Scanner runs concurrently with API scripts, the next API call fails with a timeout and the web interface becomes mostly unresponsive. Sometimes I can see the “Waited x whole second for a busy database” messages but sometimes even console crashes. I can’t really find a pattern but it all started when they replaced the scanning engine (last year?). Typically the status message in Plex Web is “Scanning Music: whatever file I changed” and is stuck at 100% of the progress wheel. Following in case I can help with some logs.

1 Like

Same issue here. I’m running Linuxserver container on Unraid, version 1.32.6.7557. Anecdotally, It seems to only happen when there is at least one person watching something (may just not have enough data to confirm if otherwise) - if a new movie is added to my library, it will scan up to 99.99% (The circle in the dashboard looks completely closed) and just stay there and say “scanning insert movie name”. It will generate credits and chapter thumbnails, but the application will hang. I won’t be able to go into any media library and I can’t play any files on any Plex Client until I restart the container.

If I don’t restart the server, the console will repeatedly say “Waited over 10 seconds for a busy database; giving up.” I could leave it for as long as I want and it will never fix itself. This is very frustrating because I just transferred my server to Unraid. All my drives are good, my appdata is on its own nvme, the database was built from scratch, it passes all integrity checks, and I have done all the things you can do with Plex SQLite but nothing fixes this issue. Hopefully, this gets addressed in the next update because it’s borderline unusable unless I’m constantly monitoring.

1 Like

Bump, this is SUPER annoying!!!

2 Likes

Same issues here. Windows Plex app.

PLEX WE NEED ANSWERS / A SOLUTION pleaaaaase!

3 Likes

Just want to add that I have the same problem happening.

It wasn’t happening on prior versions and there hasn’t been any change in my library size (nothing major anyway) or what’s running on the server.

Seems like it freezes every time the credits detection runs … and then I have to run the optimize database script to get things back in order.

There were release notes saying that they fixed what was causing this but I installed the latest version and the issue persists.