file descriptor leak on Linux PMS

Re: https://forums.plex.tv/discussion/217084/error-couldnt-accept-new-tls-connection-too-many-open-files

I posted this question only a day ago but I’m looking to see if there’s anything I can do to collect more state from the system before I take steps to (hopefully) get back to a working Plex system. It’s been unusable for days and even after a few PMS service restarts.

TIA,
Brett

Didn’t hear back so I cleaned things up after snapshotting the Logs directory.

I now see why the restart didn’t address the problem…the service restarts never actually killed the running Plex Media Server process. I tried sending SIGQUIT first (after the service stop was ineffective)–that didn’t help. Finally had to kill -9 it to get it stopped. At time of kill it had a consistent ~86,000 open files.

After kill I upgraded to the latest plexmediaserver_0.9.16.6.1993-5089475_amd64.deb and things were working again. However, I still seem to be leaking file descriptors, unless it’s normal to have ~9,000 open without any Plex client activity.

Should I be contacting support directly some other way?

The forum is the only way. Unfortunately, it’s unpredictable if/when anyone from Plex will respond.

I’m on it now.

Are you still on 0.9.16.4?

Current is 0.9.16.6. My first recommendation is to come up to current. There have been a number of fixes.

Thanks for looking into this. I’m on 16.6 now (as of my last message above). Let me know what you need to look into this. Open file count right now is ~9,500.

How do you have Plex/Web set?

Allow Fallback to Insecure Connections “Never”, “On the same network”, or “Always”.

If set to “Never”, a currently open issue, if you run into it, will permit access only from the server console (127.0.0.1:32400/web)

I suggest, you also relax this incrementally to ‘Always’ so a baseline may be established.

It was set to Never. I’ve now changed it to Always.

You probably are seeing the issue. I’ve only seen it on Ubuntu distros at this point.

After running a bit, If you see no errors in the log, step it up to On the same network.

Thanks @ChuckPa. I restarted PMS almost 5h ago just to start with a clean slate. I’m sitting at ~4,900 open files now and my log looks like:

May 04, 2016 15:55:28 [0x7f40797fe700] INFO - Plex Media Server v0.9.16.6.1993-5089475 - ubuntu PC x86_64 - build: linux-ubuntu-x86_64 ubuntu
May 04, 2016 15:55:28 [0x7f40797fe700] INFO - Linux version: 3.13.0-37-generic (#64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014)
May 04, 2016 15:55:28 [0x7f40797fe700] INFO - Processor         Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
May 04, 2016 15:55:29 [0x7f40767ff700] INFO - Successfully retrieved OCSP response
May 04, 2016 15:55:35 [0x7f40717fc700] WARN - Sync: sync list 6229729 belonging to user 1 (icycle) has died of old age, ignoring
May 04, 2016 15:55:35 [0x7f40717fc700] WARN - Sync: sync list 6991189 belonging to user 1 (icycle) has died of old age, ignoring
May 04, 2016 15:55:36 [0x7f40717fc700] INFO - Sync: downloaded 0 sync list(s) with 0 sync items(s): 0 new, 0 updated, 0 deleted
May 04, 2016 15:55:36 [0x7f406efff700] ERROR - Network Service: Error in browser handle read: 125 (Operation canceled) socket=-1
May 04, 2016 15:55:36 [0x7f406efff700] INFO - Network Service: Abandoning browse socket, it was closed.
May 04, 2016 15:55:36 [0x7f4067bff700] INFO - AutoUpdate: no updates available
May 04, 2016 15:55:36 [0x7f40623fe700] WARN - MyPlex: Invalid response when mapping state (code=422):  
May 04, 2016 15:55:41 [0x7f4073ffe700] INFO - Refreshing paths watched by LibraryUpdateManager
May 04, 2016 15:55:58 [0x7f40697ff700] ERROR - XML: namespace 
May 04, 2016 15:55:58 [0x7f40697ff700] ERROR - XML: error : 
May 04, 2016 15:55:58 [0x7f40697ff700] ERROR - XML: xmlns:ms: ' urn:microsoft-com:wmc-1-0' is not a valid URI
May 04, 2016 15:55:58 [0x7f40697ff700] ERROR - XML:   xmlns:ms=" urn:microsoft-com:wmc-1-0"
May 04, 2016 15:55:58 [0x7f40697ff700] ERROR - XML:                                        ^
May 04, 2016 17:55:34 [0x7f40777fe700] ERROR - handle_stream_read error 104 Connection reset by peer
May 04, 2016 20:11:03 [0x7f4077fff700] ERROR - handle_stream_read error 113 No route to host

which doesn’t look like anything I need to worry about. If you have more info on the error(s) I should be looking for please advise and/or point me to the existing issue you referenced.

The error at the bottom is nothing to worry about.

When the client disappears suddenly, Plex will report it this way. I believe that is being changed to be informative and not an error.

Im getting this, but when nobody is connected and it’s causing PMS to crash.

Help?

I’ve started having this issue as well in Ubuntu 14.04 LTS. Plex runs for around 2 days, then gets slower and slower.

@geekcroft said:
Im getting this, but when nobody is connected and it’s causing PMS to crash.

Help?

My apologies for missing this post. Does the problem persist? If so, please collect all the log files before restarting PMS. Attach them here in a zip file with your post. It will let us see the last thing it was doing.

@zenjabba said:
I’ve started having this issue as well in Ubuntu 14.04 LTS. Plex runs for around 2 days, then gets slower and slower.

Quantify & qualify “slower” please?

Log files please?

When it first starts from a fresh reboot, it takes ~3 seconds to start streaming a movie. After about 2 days time it can take around 10 seconds to start the same movie, and sometimes it simply fails to play the file.

I’ve turned on debug logging, and will zip up the logs when it starts failing again.

As long as it’s Debug-only… Please don’t use Verbose. Too much data would be lost. We would miss the ‘big picture’.

Honestly though, I think it really is something else in the system. My PMS runs for weeks on end and never has an issue.

and so did mine till I upgraded to version 1. I’m migrating the system over to Centos (as it doesn’t seem to have the problem)

When you do the migration, If you, as root,

cd /var/lib/plexmediaserver
tar cfz /path/to/someplace/safe.tar ./Library

When you’re done, you can come back and put PMS right where it was. I use /home/chuck for OS upgrades

I ended up writing a script to reboot the computer when it fails, and I run it every 10 mins via CRONTAB.

I’ve included it here

#!/bin/sh
 
if curl -sL -w "%{http_code}\

" “https://localhost:32400/web” -m 60 -k -o /dev/null | grep 000 > /dev/null; then
echo “found string”
/sbin/reboot
else
echo “not found”
fi

I got the same problem on Debian (Jessie). I running plex version 1.0.3.2461.
Log says:

Aug 30, 2016 22:30:48.813 [0x757b833d0700] ERROR - Couldn't accept new TLS connection: Too many open files
Aug 30, 2016 22:30:48.813 [0x757b82af2700] ERROR - Couldn't accept new TLS connection: Too many open files
Aug 30, 2016 22:30:48.813 [0x757b833d0700] ERROR - Couldn't accept new TLS connection: Too many open files
Aug 30, 2016 22:30:48.813 [0x757b82af2700] ERROR - Couldn't accept new TLS connection: Too many open files
Aug 30, 2016 22:30:48.813 [0x757b833d0700] ERROR - Couldn't accept new TLS connection: Too many open files
Aug 30, 2016 22:30:48.813 [0x757b82af2700] ERROR - Couldn't accept new TLS connection: Too many open files
Aug 30, 2016 22:30:48.813 [0x757b833d0700] ERROR - Couldn't accept new TLS connection: Too many open files
Aug 30, 2016 22:30:48.813 [0x757b82af2700] ERROR - Couldn't accept new TLS connection: Too many open files
Aug 30, 2016 22:30:48.813 [0x757b833d0700] ERROR - Couldn't accept new TLS connection: Too many open files
Aug 30, 2016 22:30:48.813 [0x757b82af2700] ERROR - Couldn't accept new TLS connection: Too many open files