PLEX movie issue - CPU death spiral

I also tried deleting all collections, manual and pmm created. Removing sharing tags and redownloading metadata. No fix. Same 15 second delay. Will try legacy scanner and see what happens.
I started trying to get counts of tags and taggings in the db. I am comparing item counts in a fresh install vs my existing install to see if anything is different.

I also run PMM with 10’s of collections in each movie library. I initially removed them and tried a fresh PMS without ever adding the collections and the issue was the same.

Based on your other thread, I’m trying the legacy agent on the smaller movie library I have. But no great hopes. I’ll avoid ‘upgrade library.’ and report back.

I am binhex-plexpass, 7k movies, 1000 shows maybe 30k episodes. Use pmm, transcode to /dev/shm, quadro p400. So standard ‘power user’ perhaps.

These same 4 libraries do not have the delay on xml load on an ubuntu vm, scanning the same 4 libraries. On the same code version and that vm is hosted on the same unraid server my prod docker instance runs.

I haven’t enabled thumbnails yet on the test env. That is a difference, and the library is a first scan and ‘fresh’ instead of years of crud.

I also need to double check my page_size and cache_size in both environments. I will admit to having futzed with it and may be at 4096 instead of the default 1024.

No difference back at page_size 1024. The lookups are maybe 7 sec on related after my change to legacy agent. Maybe a sec or 2 faster. I think they were at 8-10 seconds before.

Did you perform a metadata refresh for the entire library you changed? The legacy agent XML’s load nearly instantly for me.

On the small library 900 item library I changed to legacy and refreshed. No change in xml load time.

What about a new movie added after the scanner switch; Does that xml load any faster?

My tv series xml (not using the plex movie scanner of course) load very quickly(milliseconds). Movies are hit or miss, but about 2-10 seconds. The “problem” ones are sometime over 5 mins (using large amounts of CPU on my 24 cores during that time). Though they speed up to the 2-10 second range if I refresh the metadata… but locating them is very difficult and they can bring the server down repeatedly till you find them as someone is trying to play them (with nothing in the logs for a hint)

I feel like I’m repeating myself :sob:

Plex Employees are responding to other threads, seems like our issue may be dead.

Changed to legacy, scanned library, cleaned bundles, optimized, restarted plex, refreshed metadata, same xml load time.
Added 4 more movies to that environment. Which were added with the legacy scanner. Still not instant but maybe a few seconds faster.

Here’s a weird one. The movies with the most recent ‘date added’ load by view xml a bit quicker than the ones with the oldest added date. Tags cruft from multiple years of metadata munging? This is a non scientific verbal count.
As far as plex employee response newer and most common issues get the most traction but I feel like we have found something legit in it’s repeatability and I certainly don’t want to regenerate thumbnails for all of these and start from scratch.
Maybe a few of us with this issue could pm or do a vid chat to see configs and brainstorm? I feel like shared poking directly in the filesystems, gui’s and databases might help reveal some insights. We could also share zipped db’s to chuck all at once.

I don’t think there’s much we can do by ourselves.

We just have to hope @anon18523487 and/or @ChuckPa grace us with their presence :crossed_fingers:

I don’t know what I can provide in addition to MovieFan but I can offer a likely improvement to the database performance problems I’m seeing reported.

“SLOW QUERY” is indicative of a few things:

  1. The host is hammering the DB adding / updating media/metadata and the CPU can’t clear it fast enough.
  2. The CPU is busy with other things (like transcoding/tone mapping) can running out of resources
  3. The I/O is too slow (unlikely)
  4. The database is fragmented or maybe even damaged.

From what I see as I come down through the thread.

  1. Being able to play a movie after “fix match” – that’s a DB problem my tool (unofficial) has helped others with
  2. SLOW QUERY – when nothing else is happening on the server – definitely can help with that.

The tool I have is intended for Linux (Workstation and NAS) and MacOS. There is discussion of making an app for all platforms (EARLY discussion).

For now, I have a BAT file which does the core functions of my tool in a pre-programmed single-pass style.

It has fixed databases with problems like this on other systems.
It’s always provided substantial performance improvement.

Might this be of help ?

@ChuckPa Is this different from the DBrepair.sh script? Both @Quick010 and I have run that several times. We have more of the xml slow lookup with IncludeRelated=1 and I have no serious playback death spiral.

I’m downloading my currentdb and will pm a google share link.
Quick observation, of my prod and test instance which are reading the same 4 media folders 1 has “Similar id=” entries in my xml file while the faster responding server doesn’t. Is that from me disabling media hubs where I could or because I rolled back to the older agent?
If you pm me, I have a share link for my db.

I’m treading very lightly here. This is a Windows thread and hence outside my core knowledge.

Yes, I’m speaking to my DBRepair.sh tool which does that full export, drop damaged, import, and reindex process for you.

On Windows, there exists a BAT file (for now)

I think its only speculation that this is a db query causing the issue (would seem to make sense though) I’m not getting slow query logs when this happens though. There are actually no logs on the issue, just very high cpu usage. That being said I have run your DB tool and it did not help for the specific movies that cause the cpu issue. Refreshing the metadata on the item is the only thing that resolves it. The issue also does not happen if using the legacy movie agent. Also as stated above if you make an api call for the metadata with the includeRelated=0 query option (disabling it essentially) then the result if fast, even for the “problem” movies. If we could have some insight into what that query param actually changes when running the db query or an example of the query we can run manually that could be useful if the plex devs truly can’t recreate the issue even with copies of our db’s.

FWIW I believe that @Quick010 was able to replicate the issue when starting from a fresh database though.

Refresh metadata doesn’t fix it for me. I have the same includeRelated delay on all films even after refresh bulk or individual.

I joined this thread not because of windows but because the playback symptoms and look up symptoms with includeRelated match almost perfectly. Didn’t even notice it was windows tagged. I sent my db link to @anon18523487 but if you pm me I can send my db.

FWIW I’m on macOS (not windows either)

I’ll spin up a server to test this. I should have enough dummy/test files

To replicate what you’re seeing, I need to simply

  1. Define other section(s)
  2. Create movie section
    – Plex Movie
    – Check the box “Include Related”

Any other prerequisites ?

I get fast response when I have includeRelated off. Same with both Plex Move and legacy.

Should there be movie entries in the metadata_items_views table? My tv episodes and music have a a grandparent_title bu a bunch of movies don’t.

all the database-ness aside.

What do I need to do in order to recreate this.

When creating a new Movies or TV shows section, the only ‘include’ I’m seeing is for Adult content.

(remember, I’m just the systems guy)

In my experience after a fresh install the issues start to appear within a week.

I wrote a short little script that attempts to load the XML of each item, and if it fails it will reload the item. https://pastebin.com/rqhyMeWT (python3 includeRelated.py server1 “Movies - 4K”)
I also had a version that skipped the reload and instead logged the affected files but I seem to have misplaced it.

Also, FWIW I’m running Ubuntu 20.04 with the official PMS docker.

Also, here’s my original post that contains more information if you need more background. "View XML" and playback of certain items makes Plex unresponsive. "includeRelated=1"

I wish I had a broken library to test with but I’ve migrated to the legacy agents until the new agents work for me again.