Plex hanging/stalling/time out when scanner is running

Server Version: 1.31.3.6819 (Problem persisted before this version)

When Plex is adding new media, and a scanner activity is running, Plex basically “stalls” and will time out.

This happens on a fresh install, fully wiped, new database and everything. Once everything is rebuilt all current media has been added (No slowdown during this time), and then new media is attempted to be added, it’ll just hang and time out if you click on a TV show to view seasons for example.

Debug logs show the following errors during this time:

Mar 26, 2023 13:08:42.633 [11380] WARN - Held transaction for too long (E:\jenkins\server\4157542834\Library\MetadataCollection.cpp:481): 34.843750 seconds
Mar 26, 2023 13:08:42.633 [11380] DEBUG - Collections: Refreshed attributes for 0 collections in section 4 in 33023ms.
Mar 26, 2023 13:08:42.633 [1784] WARN - Took too long (21.578125 seconds) to start a transaction on E:\jenkins\server\4157542834\Statistics\StatisticsManager.cpp:301
Mar 26, 2023 13:08:42.633 [1784] WARN - Transaction that was running was started on thread 11380 at E:\jenkins\server\4157542834\Library\MetadataCollection.cpp:306

accompanied by several Mar 26, 2023 13:08:27.163 [4152] ERROR - [Req#946f] Waited over 10 seconds for a busy database; giving up. which would be the attempt to view the media in question.

I’ve been plagued with this problem for a while, happy to supply full logs, anything to get to the bottom of this issue and fix it.

I have this as well! I thought PMM had broke my Plex DB, so i deleted my entire plex installation and started adding media into a fresh library. Same errors still.
Then I moved the Plex data to entire separate NVMe drive. Still same errors
Have used DBRepair and changed cache size to 2G. It only happens when the scanner is running.

I’m wondering if this is the same thing I’m getting.

So I managed to fix mine, BUT, the cause was so bizarre I didn’t mention it here at the time because honestly? It’s not a fix, if what was causing it for me, was causing such an issue in general, I feel like more people would be posting about it.

Smart Collections.

I had Smart collections set up for a few things on Plex like TV Networks, maybe, 20 of them in total, some with 100+ items in them. Upon removing these Smart Collections, Plex now behaves totally fine. I recreated those collections in PMM as just regular collections rather than Smart collections, and zero issues.

When something is added to Plex, it’s clearly checking those against the Smart Collection filters, but how it runs that query, I don’t know.

But yeah, for the both of you, there was my fix. Removing Smart Collections totally, and using PMM instead. Now when scanning, there’s 0 slowdown, and 0 issues with things in the log timing out due to delay.

I do have some questions.

1.- can you see the ram usage of the machine? I had a similar issue (posted 1h before your post) where plex would eat up 60gb (I kid you not) of ram, most of it going into the pagefile. I’d like to know how high this gets for you around 1-5 minutes after the background maintenance task starts

2.- do you just so happen to have a TON of music on Plex? If so, you might be getting hit in the face by the Generating Loudness Data.

3.- do you have anything running besides Plex? I also have Docker running, eating up quite a bit of vmmem, which also didn’t really help plex.

The PC Plex is on, has 64gb, and I’ve never noticed any spikes to Plex usage that would cause me any alarm (or even get close to capping it out).

I have 0 music, 3406 Movies, 2322 TV Shows (79,114 Episodes). Video Thumbnails, Credit (Intro/Outro) Detection, and Extras, are all disabled.

The Computer handling Plex, also handles Deluge, Sonarr, Radarr, TitleCardMaker, and PlexMetaManager. None of which are in docker containers.

I do not have any smart collections. In fact due to pure desperation i have now started with a fresh Plex installation and library.

Therefore I am in the process off importing media and i’m getting bombarded by theese:
image
Plex Media Server.log (73.7 KB)