Transcoding Memory Leak?

I’m using the official docker on unRAID.

Any time I transcode a file, the temporary bits are kept in \Transcode\Sessions folder. Which is fine.

However, I’m also noticing the same size of that folder is also being committed to system memory.

For example, one current transcode folder could be 3GB, but the plex docker is also using up 3GB of RAM. This increases as the folder size increases. Eventually, about halfway through the movie plex eats up the entire 8GB of RAM in the machine and causes it to become unresponsive.

It’s almost like Plex is storing the temporary files in both RAM and on the cache drive. Is there any way to turn this off? I haven’t changed any advanced settings and transcoding is set to “Make my CPU Hurt”.

This sounds more like an docker on unraid problem. Unless you are one of those who took the misguided advice of putting the transcode temp in a RAM disk, there’s no reason this should be occurring. You should dig further to see which proc is actually consuming memory.

I’ve actually seen this happen twice now within the past week (so presumably since updating to PMS 1.13.2.5154, though that may be unrelated). Both times it was transcoding the same source file. I have a native Plex install in Ubuntu just using ext4 partitions with an SSD for transcode temp. The source file plays fine directly.

The size of the process is roughly equal to the size of the transcode and it just keeps growing as the transcode progresses. The first time I had to kill the process to stop the swap storm. After I killed the process and the user resumed playing, presumably after an error, the new transcoder didn’t have any memory problems. The 2nd time the trancode was to a much smaller version that could fit in RAM after I killed an unrelated memory hogging process (at least it fits in RAM so far… it’s going on right now).

It’s definitely the transcoder process using the memory. Here’s the initial memory mappings of the Plex Transcoder process:

0000000000400000  12640K r-x-- Plex Transcoder
0000000001257000    440K rw--- Plex Transcoder
00000000012c5000   1312K rw---   [ anon ]
000000000208e000 2606824K rw---   [ anon ]

and then here they are a minute or two later:

0000000000400000  12640K r-x-- Plex Transcoder
0000000001257000    440K rw--- Plex Transcoder
00000000012c5000   1312K rw---   [ anon ]
000000000208e000 2717856K rw---   [ anon ]

That 2nd anonymous memory region just continues to grow as the transcode progresses - and that memory is definitely part of the RSS.

Here’s the relevant portion of the Plex Media Server log: https://pastebin.com/raw/4ybGfAkV
(the slow query and such are from before I killed a different process to free up RAM and stop the small swap storm)

If it helps here’s the transcoder command:

/usr/lib/plexmediaserver/Plex Transcoder -codec:0 h264 -codec:1 truehd_eae -eae_prefix:1 9690b5b9d05fe83d09c53ce003a526a4_ -i /mnt/Movies/TR.2018.mkv  -filter_complex [0:0]scale=w=1280:h=720[0];[0]format=pix_fmts=yuv420p|nv12[1] -filter_complex [0:1] aresample=async=1:ocl='7.1':osr=48000[2] -map [1] -codec:0 libx264 -crf:0 23 -maxrate:0 3351k -bufsize:0 6702k -r:0 23.9759999999

I have the “Plex Transcoder Statistics.log” if useful.

Update: I ended up having to kill the Transcoder process from the 2nd event because I was going to run out of RAM. Then when I checked on things some time later the new Transcoder was consuming over 1GB of RAM and growing at a faster pace than the transcode size (which in total was <400MB at this point) so there may not be a connection to the transcode size.

I tried transcoding this file myself and again the memory continued to climb and climb. A PMS debug log of me playing it (first as direct, then as transcode) is here: https://nopaste.xyz/?91aff3c07a2d7f3a#UCwPcqHboKAHxqZ3I2fBn+AnHCG/yLIUdX7VVSGGnX4=

Did you ever resolve this issue I’m getting the same issue?