Transcoder fails when `/transcode` is on a network share

@yows

I’m pretty much the dev teams eyes and ears in the Linux forums and extra Linux hands as needed.

I’ve thought about how to solve problems like this a great deal. Where I run into a problem is:

  1. PMS runs as user plex, which doesn’t have sudo permission to modify sysctl.conf . Yes, a ‘hack’ could be created but doing so would violate the reason PMS runs as a non-privileged user. When I have to use windows, I don’t like services making system-wide changes. I have a really difficult time breaking the rule of “applications are applications ONLY”.
  2. Even if it did, it doesn’t know what else you use on your system. Each user_watch takes up 540 bytes of non-pageable kernel memory. While not a lot, on small memory systems, it will add up quick.
  3. PMS doesn’t know what value to set until after your library is all built.

That having been said,

Should it be better documented? Oh heck yes.
Would it be nice if PMS had a ‘Major errors’ warning mechanism? Again, yes.
Would it be really swoopy if you could tell it what you wanted to watch out for? oh yeah. would love to. Care to help code it? :smiley:

I’m not shutting you down in any way. There’s only so much which can be done in the free time between 2 and 3am when we get to sleep.
Also, Linux isn’t Windows and you will find I’m a strong advocate for preserving the distinction.

@ChuckPA

Thank you for the answer! I appreciate that you guys follow up on our ranting :slight_smile:

First, I’m running a 64 bit system, so each inotify takes up 1kB of unswappable memory (kernel mem) in my system. So, with the setting put at 25000, I’m using (if they all are used) ~25 MB of RAM. It’s negligible.

Furthermore, using inotify north of 200000 is not problematic on modern systems. But since I don’t know the inner workings of how Plex keeps track of them, it’s not safe to say that modern systems with ~4-8GB of memory would suffice. You will have to verify that.

Of course one should not “hack” some solution for this, and keep the application safely away from kernel business. I’m just asking the team if they could consider making the application more accessible;

~/.config/plex/pms.conf

would be great, where we could specify directories, server settings and more. As it stands now, I need to use ´ln -s´ for everything directory wise, which is cool, but not loved. And we need to use the web interface to set everything else (from a novice user-perspective).

I would also love to see a refactor of ´Library/Application \Support/´ and some man pages for the server, transcoder and scanner et. al.

Helping to code/make documentation is something I would have to consider, I’m doing my masters in Computer Science over the next two years, so time is of essence (not sure if you meant that tho). In any case, I would have to spend some time getting to know your codebase first.

Edit: I understand that this comment may be in the wrong part of the forum, it was a response to a previous reply on the issue at hand - I promise! :expressionless:

Hi,
I’m still having this issue using the latest docker container from plex.
I don’t think I can make the “fs.inotify.max_user_watches” change in /etc/sysctl

When you restart the container, it will re-download a fresh image, overwriting any changes I make that aren’t exposed outside the container.
If I try to apply the setting on an already started container via sysctl --system, I get “Read-only file system” spam which I assume means it’s not loading my changes.

What can I do to stop this issue from reappearing every few days?

Apr 20, 2018 13:48:34.006 [0x7f36efbfe700] ERROR - [Transcoder] Error while decoding stream #0:1: Input/output error
Apr 20, 2018 13:48:37.002 [0x7f36de3ff700] ERROR - [Transcoder] [eac3_eae @ 0x3425ae0] EAE timeout! EAE not running, or wrong folder? Could not read '/tmp/pms-1592e0d1-65a1-43b8-91b4-660dbf6650ab/EasyAudioEncoder/Convert to WAV (to 8ch or less)/csm0rn2pehd9i5luuoryaw5s_36619-1-1.wav'
Apr 20, 2018 13:48:37.004 [0x7f36efbfe700] ERROR - [Transcoder] [eac3_eae @ 0x3425ae0] error reading output
Apr 20, 2018 13:48:37.006 [0x7f369ffff700] ERROR - [Transcoder] Error while decoding stream #0:1: Input/output error
Apr 20, 2018 13:48:40.002 [0x7f36efbfe700] ERROR - [Transcoder] [eac3_eae @ 0x3425ae0] EAE timeout! EAE not running, or wrong folder? Could not read '/tmp/pms-1592e0d1-65a1-43b8-91b4-660dbf6650ab/EasyAudioEncoder/Convert to WAV (to 8ch or less)/csm0rn2pehd9i5luuoryaw5s_36619-1-2.wav'
Apr 20, 2018 13:48:40.004 [0x7f369ffff700] ERROR - [Transcoder] [eac3_eae @ 0x3425ae0] error reading output
Apr 20, 2018 13:48:40.006 [0x7f36de3ff700] ERROR - [Transcoder] Error while decoding stream #0:1: Input/output error
Apr 20, 2018 13:48:43.002 [0x7f369ffff700] ERROR - [Transcoder] [eac3_eae @ 0x3425ae0] EAE timeout! EAE not running, or wrong folder? Could not read '/tmp/pms-1592e0d1-65a1-43b8-91b4-660dbf6650ab/EasyAudioEncoder/Convert to WAV (to 8ch or less)/csm0rn2pehd9i5luuoryaw5s_36619-1-3.wav'
Apr 20, 2018 13:48:43.004 [0x7f36de3ff700] ERROR - [Transcoder] [eac3_eae @ 0x3425ae0] error reading output
Apr 20, 2018 13:48:43.006 [0x7f36efbfe700] ERROR - [Transcoder] Error while decoding stream #0:1: Input/output error
Apr 20, 2018 13:48:44.640 [0x7f36f37ff700] DEBUG - handleStreamRead code 335544539: short read ```

fs.inotify.max_user_watches is done at the host level, not in a container. The container draws from the host’s resources which are being exhausted. Increase in the host first and the container will have access to those resources upon restart

gotcha, thanks Chuck!

I ran into this problem today and increasing my watches seems to have fixed it.

[root@drew-metal Logs]# cat /proc/sys/fs/inotify/max_user_watches
8192
[root@drew-metal Logs]# sudo sysctl fs.inotify.max_user_watches=524288
fs.inotify.max_user_watches = 524288
[root@drew-metal Logs]# echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
fs.inotify.max_user_watches=524288
[root@drew-metal Logs]# sudo sysctl -p
fs.inotify.max_user_watches = 524288
[root@drew-metal Logs]# cat /proc/sys/fs/inotify/max_user_watches
cat /proc/sys/fs/inotify/max_user_watches
524288

I had been meaning to do this for a while anyway, but I really think that this should be a KB or something and be linked in the section of the UI where it says that there’s a limit on the number of Linux filesystem watches, because I would have done this a lot sooner, long before I ever ran into this problem. Just my two cents.

@RulerOf said:
I ran into this problem today and increasing my watches seems to have fixed it.

[root@drew-metal Logs]# cat /proc/sys/fs/inotify/max_user_watches
8192
[root@drew-metal Logs]# sudo sysctl fs.inotify.max_user_watches=524288
fs.inotify.max_user_watches = 524288
[root@drew-metal Logs]# echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
fs.inotify.max_user_watches=524288
[root@drew-metal Logs]# sudo sysctl -p
fs.inotify.max_user_watches = 524288
[root@drew-metal Logs]# cat /proc/sys/fs/inotify/max_user_watches
cat /proc/sys/fs/inotify/max_user_watches
524288

I had been meaning to do this for a while anyway, but I really think that this should be a KB or something and be linked in the section of the UI where it says that there’s a limit on the number of Linux filesystem watches, because I would have done this a lot sooner, long before I ever ran into this problem. Just my two cents.

https://forums.plex.tv/discussion/290621/increase-the-number-of-directories-linux-can-monitor-notify

1 Like

Hi there

Is this a fix… Not working here. Even set the dirs to 100k.
I have a test movie that i run. Sometimes i can see it and sometimes i dont.
Then if i restart pms it works. And sometimes it dont.
Almost all movies work. But its only a few that has this problem.

Is there no quick fix on this?. I even made plex as sudo also.

File locking, which the transcoder needs, is not supported by all network protocols.

If you do not have POSIX file locking, nothing is guaranteed. Running any part of PMS over the LAN, with exception of reading your source media, is therefore ill advised.

Hi again

What you mean by that?
This pms is runned on the normal debian dist.

I mean exactly what I said.
To paraphrase,

  1. Mount the remote share using POSIX file locking
  2. Verify the resultant mount is indeed indicative of locking active