Plex docker crashing (unhealthy) 1-3 times per day

Server Version#: 1.29.0.6244
Running in docker on debian server.

Lately, I’ve been experiencing an extremely unstable plex server with plex crashing several times a day - and docker is left in unhealthy state when I check.

Stopping and restarting the docker fixes it for a few hours.
Tutualli runs in a seperate docker - but this docker is unaffected.

I’ve provided logs saved shortly after docker was restarted.
Debug logging enabled - verbose logging disabled.

Worth to mention: I am doing a raid rebuild currently, it MIGHT be related, but I’d want someone to take a look at the logs to see if there’s another reason.

RAID rebuild is completed, but server still crashes. (Only lasted 6,5 hours this time).

I’ve enclosed new logs for todays crash.
syslog says this when I do | grep docker

Oct 4 22:01:12 P2 dockerd[1380]: time=“2022-10-04T22:01:12.042220008+02:00” level=warning msg=“Health check for container b5173c8c2e95d7785c9dfe1d4a0fcf49334d96872dd64709a310239dc143a06e error: context deadline exceeded”

Edit: 1.29.1.6276 seems NOT to have fixed this issue. Docker lasted for 3 days, then roughly 7-8 hours upon restart.

Logs from todays two crashed enclosed.
Are anyone interested in looking at them, or even trying to point me to a possible fix?
Plex Media Server Logs_2022-10-08_15-06-19.zip (4.9 MB)
Plex Media Server Logs_2022-10-08_23-21-48.zip (6.6 MB)

2 hours after

Plex Media Server Logs_2022-10-09_01-13-52.zip (5.0 MB)

Doesn’t look so much like the server is crashing but it’s told to shutdown.
Could be some external trigger or maybe some restriction of your container (e.g. running out of RAM?).

Oct 09, 2022 01:12:59.210 [0x7fd664d3cb38] DEBUG - Shutting down with signal 15 (Terminated)
Oct 09, 2022 01:12:59.210 [0x7fd664d3cb38] DEBUG - Ordered to stop server.
Oct 09, 2022 01:12:59.210 [0x7fd66886b6f0] DEBUG - Stopping server...
Oct 09, 2022 01:12:59.210 [0x7fd66886b6f0] DEBUG - HttpServer: Stopping server.
Oct 09, 2022 01:13:00.210 [0x7fd66886b6f0] WARN - Timed out waiting for server to finish.
Oct 09, 2022 01:13:00.210 [0x7fd66886b6f0] DEBUG - Server stopped.
Oct 09, 2022 01:13:00.210 [0x7fd66886b6f0] DEBUG - NetworkService: Stopping advertisement.
Oct 09, 2022 01:13:00.210 [0x7fd66886b6f0] DEBUG - Killing plug-ins.

If those are the last ones before re-initiating, it probably comes from stopping the docker since it was in an unhealthy state

docker ps
docker stop plex
docker start plex
etc

Plex Media Server Logs_2022-10-09_14-43-04.zip (5.4 MB)
plexinc/pms-docker:plexpass “/init” 14 months ago Up 13 hours (unhealthy)

Im suffering the same issue, looking for a fix aswel.

1 Like

I ended up just writing a script that checks syslog for crashes every 5 minutes, and if crash is present in the log, it restarts the docker.

This is a poor fix, since it doesn’t really fix anything but minimizing downtime.

If anyone can tell me a way to implement a output of logs from docker in a script, I could add that as well. It seems quite random what time the server crashes, so I’m guessing there is something that triggers it.

Traditionally, these sorts of bugs has been introduced with a new version of plex, and then they dont care about it for a couple of months. If there’s no response within the next couple of days, I guess the solution will be to downgrade a couple of months back.

I also added a logging function for when the script restarts the container;

cat plex.crashlog.log
ERROR in plex - Mon 10 Oct 2022 03:30:01 PM CEST
ERROR in plex - Mon 10 Oct 2022 03:35:01 PM CEST
ERROR in plex - Mon 10 Oct 2022 07:10:02 PM CEST
ERROR in plex - Mon 10 Oct 2022 07:15:01 PM CEST
ERROR in plex - Mon 10 Oct 2022 07:40:01 PM CEST
ERROR in plex - Mon 10 Oct 2022 07:45:01 PM CEST
ERROR in plex - Mon 10 Oct 2022 08:00:02 PM CEST
ERROR in plex - Mon 10 Oct 2022 09:05:01 PM CEST

The messages within 5 minutes of eachother is my fault, as the script ran every 5 minutes, and checked the last 5 minutes of the log - thus restarting the docker twice in a row.
The script now runs in crontab every 6 minutes instead.

All but 2 of the crashes I’ve seen are the database.
Fix the DB and problem solved.

(PMS will run with a damaged DB… until it does the nose dive on the damaged DB)

Fixing the DB requires:

  1. The user is good with Plex SQLite
    -or-
  2. I automate it via script

I have a tool already in existence for workstation Linux and NAS boxes.

Doing in while a container is running – I need to understand how.

Can the container be active with PMS stopped ?

I have ran the Database cleanup integrated.

However, it seems plex can be stopped within the docker container;

  1. Login to the docker container docker exec -it {plexcontainername} /bin/bash
  2. There’s a bash file in the root dir, plex_service.shthat is a short wrapper for the -s6-svc commands for plex. So to bring the service down: ./plex_service.sh -d -u for up, or -r for restart.

cat plex_service.sh
#!/bin/bash

if [ “$#” -eq 1 ]; then
s6-svc “$1” /var/run/s6/services/plex
else
echo “No argument supplied; must be -u, -d, or -r.”
fi

The data dir for plex is also available outside the container, as it resides on its own drive, and is only mounted to the docker.

@stevencas

Thank you. That’s what I was missing. :slight_smile:

It looks like this:

 
      (DEVELOPMENT) Plex Media Server Database Repair Utility (Docker)
 
Select
 
  1. Check database
  2. Vacuum database
  3. Reindex database
  4. Attempt database repair
  5. Replace current database with newest usable backup copy
  6. Undo last successful action (Vacuum, Reindex, Repair, or Replace)
  7. Show logfile
  8. Exit
 
Enter choice:

I’ll send you a PM with the tool in it.

It’s nothing really fancy. It automates all the customizing and typing.
It figures out the current host and then sets up the variables.

Fixed the database about 9 hours ago. It’s already crashed once again while I was away. Current uptime for docker is 4 hours.

Is there a way to automate pulling logs when I restart the docker? (Its done by a script)

Alternatively how do I “properly” downgrade.
I’m currently running the docker with plexinc/pms-docker:plexpass

This has automatically updated to latest version upon restart of the container.
Will i retain plexpass priveleges if I put a specific version number without the plexpass toggle there?

To run a specific version of the code, specify the appropriate tag.

For example, to run version 1.29.0.6244 use the following:

plexinc/pms-docker:1.29.0.6244-819d3678c

A list of all the available images is here:

https://hub.docker.com/r/plexinc/pms-docker/tags/

The availability of Plexpass privileges and features is determined when the server is signed in, not by the tag used to create the container.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.