Plex Using 100+ GB of RAM during Schedule Tasks

Another update … another crash.
Plex Media Server 1.25.4.5487 was released yesterday

I installed it and I still crashed due to excessive RAM usage during scheduled tasks. I enabled the secret setting to log memory usage, so here’s my log files in hopes that something stands out for why this is happening.
Plex Media Server Logs_2022-02-02_14-01-36.zip (5.1 MB)

Here is a log from my server host showing Plex’s excessive RAM usage before the limiter is forced to kill my Plex process.
plex_oom_log.txt (19.3 KB)

Highlight from that log

Feb  2 13:20:57 rhea kernel: Tasks state (memory values in pages):
Feb  2 13:20:57 rhea kernel: [  pid  ]   uid  tgid total_vm      rss pgtables_bytes swapents oom_score_adj name
Feb  2 13:20:57 rhea kernel: [  49716]  1380 49716 25244938 16284663 130904064        0             0 PMS RunServer
Feb  2 13:20:57 rhea kernel: [  49905]  1380 49905    16812     8853   155648        0             0 Plex Script Hos
Feb  2 13:20:57 rhea kernel: [  50630]  1380 50630    14272     6405   135168        0             0 Plex Script Hos
Feb  2 13:20:57 rhea kernel: [  50688]  1380 50688    14031     6089   126976        0             0 Plex Script Hos
Feb  2 13:20:57 rhea kernel: [  50690]  1380 50690    13931     5975   131072        0             0 Plex Script Hos
Feb  2 13:20:57 rhea kernel: [  50930]  1380 50930    17093     9264   159744        0             0 Plex Script Hos
Feb  2 13:20:57 rhea kernel: [  34236]  1380 34236      640       21    40960        0             0 EasyAudioEncode
Feb  2 13:20:57 rhea kernel: oom-kill:constraint=CONSTRAINT_MEMCG,nodemask=(null),cpuset=/,mems_allowed=0-1,oom_memcg=/elusivezatchmo,task_memcg=/elusivezatchmo,task=PMS RunServer,pid=49716,uid=1380
Feb  2 13:20:57 rhea kernel: Memory cgroup out of memory: Killed process 49716 (PMS RunServer) total-vm:100979752kB, anon-rss:65138168kB, file-rss:484kB, shmem-rss:0kB, UID:1380 pgtables:127836kB oom_score_adj:0
Feb  2 13:21:07 rhea kernel: oom_reaper: reaped process 49716 (PMS RunServer), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
  • My OS is Gentoo.

  • My server host WhatBox uses OpenRC to install RPM versions of Plex.

  • Whatbox kills my Plex instance the moment it starts to use 100+ GB of RAM out of fairness to other uses on the server. This often results in the lack of a crash report generated by Plex.

  • My current database size is around 1.35 GB

  • I’ve doubled check that all my libraries are using the latest Plex scanners and Metadata agents

  • I’ve refreshed all of my libraries with the most current agents

  • I’ve cleaned up and optimized my DB nearly 100 times since the recent updates in hopes of bringing down the database size, but the size of my database remains unchanged.

  • I’ve used instructions provide on the Plex website to check my database for errors and corruption and repair.

  • I’ve updated preferences.xml to include memory usage in the logs to help diagnose the issue.

  • It’s been this way since the big database change over release.

  • It strictly only occurs during the window of scheduled tasks. It doesn’t happen during any playback or library refresh/scan run manually. If I change the scheduled task window, I’m able to change the time of the RAM burst.

  • I don’t wish to start over with a new database because I have a large amount of entries in TV, Movies, and Music that I either had to correct incredible mismatches by Plex or put in manually due to non-existence in Plex’s meta database and to start over would mean that these would then become lost in the library (since my library is quite big at this point).

  • I’m looking for either a fix to the crashing, or a way to export and then import my metadata back so that I don’t lose any of the hard work I’ve put into my server over the past several years.

Update 2/3/2022:
Once in a great while, Plex doesn’t use an excessive amount of RAM during scheduled tasks and doesn’t trigger the limiter. To me, there’s been no recognizable pattern for this, but since it didn’t blow up last night, here’s last night’s log file as a counter balance to the log files where it does blow up.
Plex Media Server Logs_2022-02-03_16-09-18.zip (5.3 MB)

Update 2/14/2022:
It appears to be related to detect intro; which is confusing to me because when new media is scanned in and new intros are scanned, it’s never had an issue. But for some reason, during scheduled tasks it’s exploding my RAM usage. I discovered this by turning off all scheduled tasks options and turning things off and on and running with only one setting selected on at a time.

If your host is killing your Plex process because of excessive ram usage then you need to get a new hosting provider with more ram or host it locally on your own machine. The scanning process will always use lots of ram in relation to the size of your database which is in relation to how much and what kind of media you have.

“Whatbox kills my Plex instance the moment it starts to use excessive amount of RAM out of fairness to other uses on the server”

How is whatbox killing your Plex process a Plex problem? Excessive amounts of ram is relative to the configuration of whatbox, not Plex.

The limiter that they use has always been in effect since I first started using them 4 years ago, it has only been recently that Plex has hit dangerous highs of RAM usage that it’s come into effect. Whatbox server is basically setup around Plex and Plex usage. Plex has been hitting ridiculously (and unnecessary) high amounts of RAM usage during scheduled tasks. If I scan my library manually, or any of the other processes manually, it does not hit that high of a RAM usage and does not trigger the Whatbox limiter. And this had only started happening when the database change over took effect.

I would also like to add that not all of the other users that are using Plex are having this issue and I know that some of them have larger libraries than mine (when it comes to the amount of entries in their database).

And the few Plex employees and team members that I’ve been able to have conversations with near the beginning of this post have gone over my database itself and have agreed that it shouldn’t be hitting the RAM usage that Plex is apparently hitting during scheduled tasks for my instance.

Thank you for the logs and your investigations

It appears that memory usage is climbing whilst scanning TV Shows during Scheuled tasks.
We may need a recent copy of your database and also full directory structure / tree down to files for the TV Library

The library that was being scanned at the time was one with media here /home/elusivezatchmo/Media/TV Shows/

I have referred the issue to the development team

I’ve DM’d you the requested data. Thank you so much for your help.

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

We have found an issue with Intro Detection that could lead to spikes in memory usage - A development build (1.29.1.6296) with the fix was sent to users that provided diagnostics in the past showing this problem.