Plex Tuner Service is not stopping, preventing shut down of Plex service

server-freebsd

#1

Description

When I try to stop the plex service, it (rc.d) hangs indefinitely waiting for Plex Tuner Service to close. PTS is unresponsive to kill, and I have to kill -9 it to shut it down.

Version

I'm running plexmediaserver-1.5.7.4016 on FreeBSD-10.3-p19. I'm seeing the same behaviour on all 4 of my servers so hopefully this is easy to reproduce, but if not let me know and I'll try out different combinations!

By the way, I've been seeing it for a few versions of Plex now. I think it's been happening ever since Plex Tuner Service was introduced, but I'm not certain.

Steps to reproduce

When plex is started, run:

sudo service plexmediaserver stop

Check there are no plex processes left running, e.g. ps aux | grep -i plex

Expected

Plex shuts down and no plex processes are running.

Actual

The service command hangs indefinitely waiting for plex processes to shut down:

$ sudo service plexmediaserver stop
Stopping plexmediaserver.
Waiting for PIDS: 5892.
Cleaning up leftover child processes.
Waiting for PIDS: 5918 5917 5916 5896

If I kill it and check for processes, I see the Plex Tuner Service:

$ ps aux | grep -i plex | less
plex          5917   0.0  0.1 90552 6560  -  I    Sun12AM      0:06.31 /usr/local/share/plexmediaserver/Plex Tuner Service /usr/local/share/plexmediaserver/Resources/Tuner/Private /usr/local/share/plexmediaserver/Resources/Tuner/Shared 1.5.7.4016-25d94bad9 32600 /waitmutex

sudo kill 5917 doesn't help, it goes away with sudo kill -9 5917


#2

Thank U, I have the save situation when trying to restart. I'm using plexmediaserver-1.7.5.4035 from ports. May be it will be fixed soon?


#3

I have had this same issue ever since the Tuner service was added. I wish there was a way to completely disable the service as I do not have a tuner nor do I plan on buying one anytime soon.


#4

Feature request - Option to disable Plex Tuner Service when DVR not configured


#5

This isn't quite the same as disabling it, although I suppose that would probably also fix that problem. The process appears to be completely locked up, as it won't respond to a polite request to quit, so presumably it wouldn't work for people who do want it on this system configuration either?


#6

I have the exact same issue. I created a script to check for a new version of plex. If a new version is available and no one is streaming from plex, the script goes ahead and download the new version and shutdown plex before updating to the new version and starting plex again. Sadly every time its stuck trying to shutdown the tuner service and I have to connect to the server an kill it with kill -9.


#7

Same here. The issue is still present in version 1.8.1.4139.


#8

It's been doing it since introduction of the useless tuner service. I don't have a tuner, I don't want the service. I wrote a wrapper script to kill Plex.

#!/usr/local/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin
ps $(cat /var/run/plex/plex.pid) &>/dev/null || { echo "Plex does not appear to be running";exit; }
echo "Applying the hammer to Plex"
bash -c 'sudo nohup /usr/local/etc/rc.d/plexmediaserver_plexpass stop &>/dev/null &'
sleep 5
sudo pkill -9 -f .*Tuner.*

#9

@zofrex said:
This isn't quite the same as disabling it, although I suppose that would probably also fix that problem. The process appears to be completely locked up, as it won't respond to a polite request to quit, so presumably it wouldn't work for people who do want it on this system configuration either?

Until today, I was in the situation of not using the tuner so didn't worry about having to kill a few process every one in a while but, now I can confirm that it does lock up the tuner.

Version 1.9.2.4285

Thanks to the OP for saving me the trouble to writing this up as I would love to actually get the tuner fixed now that I have paid the $s to the Plexpass and a tuner... any news or hopes on this front?

Does anyone have the Tuner working in FreeBSD? I am currently on 10.3.


#10

Same issue here


#11

This is still an issue in the latest version. I have to force kill the tuner service anytime I shutdown or restart plex.


#12

This is still an ongoing issue.

You don't notice until you see that it's not recording your shows, find that that you can't watch live TV, or are trying to shut down the service.

This seems like it would be a priority to fix since it breaks the entire tuner portion of the software on a regular basis.

Version 1.11.0.4666 on Fedora Server 26.


#13

Anyone heard any further on this from Plex? Still seeing this issue - I'm running version 1.12.2.4929 on FreeBSD.

I'm not sure I even need the Tuner Service running as I don't use any DVR features....(unless there are other PLex processes/services depending on it


#14

This has been almost a year now and we still no solution.

Here are the steps i’ve taken to band-aid this issue:

In the /usr/local/etc/rc.d/plexmediaserver file change your plex_stop_postcmd() to look like mine below

Change from this:

plex_stop_postcmd()
{
        echo "Cleaning up leftover child processes."
        _PLEX_CHILDREN=$(pgrep -g ${_PLEXPID})
        kill $sig_stop ${_PLEX_CHILDREN}
        wait_for_pids ${_PLEX_CHILDREN}
}

and make it look like this:

plex_stop_postcmd()
{
        echo "Force killing 'Plex Tuner Service'"
        _TUNER_SERVICE=$(pgrep -f "Plex Tuner Service" -g ${_PLEXID})
        kill -9 ${_TUNER_SERVICE}
        wait_for_pids ${_TUNER_SERVICE}


        echo "Cleaning up leftover child processes."
        _PLEX_CHILDREN=$(pgrep -g ${_PLEXPID})
        kill $sig_stop ${_PLEX_CHILDREN}
        wait_for_pids ${_PLEX_CHILDREN}
}

Edit:

  • Corrected spelling mistake
  • Added a wait so the leftover processes wont pick up the tuner still
  • Added a message letting you know that it’s killing the tuner.