-
-
Notifications
You must be signed in to change notification settings - Fork 13.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plex.service always coredumps when stopped #173338
Comments
In my testing I have come to believe this is due to bubblewrap not forwarding kill signals to child processes. Plex additionally has a shutdown service that takes sometime, but quits this process if the parent process is terminated:
I was able to work around these issues by writing a script
|
I improved @hurricanehrndz solution a bit by actually checking if the plex service has been shutdown. This is achieved by checking the existence of the PID file instead of the flat 5 second sleep: systemd.services.plex.serviceConfig = let
pidFile = "${config.services.plex.dataDir}/Plex Media Server/plexmediaserver.pid";
in {
KillSignal = lib.mkForce "SIGKILL";
Restart = lib.mkForce "no";
TimeoutStopSec = 10;
ExecStop = pkgs.writeShellScript "plex-stop" ''
${pkgs.procps}/bin/pkill --signal 15 --pidfile "${pidFile}"
# Wait until plex service has been shutdown
# by checking if the PID file is gone
while [ -e "${pidFile}" ]; do
sleep 0.1
done
${pkgs.coreutils}/bin/echo "Plex shutdown successful"
'';
PIDFile = lib.mkForce "";
};
`` |
Describe the bug
Every time the
plex.service
systemd service is stopped, it coredumps. It does this because the service is set to send SIGQUIT, which looks like it was changed to do in #24900.Steps To Reproduce
Steps to reproduce the behavior:
services.plex.enable = true;
systemctl stop plex
systemctl status plex
, and check the exit code and logsExpected behavior
The plex service should be terminated with sigterm and systemd should consider it to have exited successfully.
Additional context
This was originally done to prevent database corruption, but doing my own tests, by running
systemctl start plex ; sleep 20 ; systemctl kill --signal=SIGTERM plex
repeatedly, it doesn't seem like plex corrupts the database, it still functions as expected, and the logs (jouralctl andplex/Plex Media Server/Logs/PMS Plugin Logs/com.plexapp.system.log
) don't reveal any unusual errors. I think at this point, it's probably safer to kill plex with SIGTERM than SIGQUIT.I'd appreciate input from @pjones, if you remember what specifically the original problem was. If we can't switch back to using the default SIGTERM stop signal, maybe we could add a
SuccessExitStatus
to the service so it doesn't show as failed when it's stopped.Notify maintainers
@pjones
@thoughtpolice
@Forkk
@MayNiklas
@maxeaubrey
Metadata
The text was updated successfully, but these errors were encountered: