Zombie Processes

Server Version#: 1.41.1.9057-af5eaea7a
Player Version#: n/a
Linux: debian bookworm (6.10.11+bpo-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.10.11-1~bpo12+1 (2024-10-03) x86_64 GNU/Linux)
cifs-utils: 2:7.0-2

I’m running PMS via the apt packages. My libraries are on a remote volume mounted via SMB; /var/lib/plexmediaserver is local.

When the scanner runs and finds a new TV series, it stalls and the task never completes. If I use systemctl stop plexmediaserver.service to stop the server, the command hangs. When I look at the processes I see this:

# ps xau|grep plex
plex      118152  1.5  0.0      0     0 ?        Zsl  Oct24  14:43 [Plex Media Serv] <defunct>
plex      274611  0.0  0.0      0     0 ?        Z    14:34   0:00 [CrashUploader] <defunct>

It’s always the server and the CrashUploader that are zombies. OK, fine, zombies are just leftover entries in the process table.

But when I restart the service with systemctl start plexmediaserver and check the status, I get this:

# systemctl status plexmediaserver.service
● plexmediaserver.service - Plex Media Server
     Loaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; preset: enabled)
     Active: deactivating (stop-sigterm) (Result: exit-code) since Fri 2024-10-25 14:41:36 UTC; 15s ago
    Process: 275774 ExecStartPre=/bin/sh -c /usr/bin/test -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" || /bin/mkdir -p "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" (code=exited, status=0/SUCC>
    Process: 275776 ExecStart=/bin/sh -c  export PLEX_MEDIA_SERVER_INFO_VENDOR="$(grep ^NAME= /etc/os-release | awk -F= "{print \$2}" | tr -d \" )";  export PLEX_MEDIA_SERVER_INFO_MODEL="$(uname -m)">
   Main PID: 275776 (code=exited, status=255/EXCEPTION)
      Tasks: 3 (limit: 18831)
     Memory: 10.5G
        CPU: 100ms
     CGroup: /system.slice/plexmediaserver.service
             └─118152 "[Plex Media Serv]"

Oct 25 14:41:36 k3s-home-03 systemd[1]: Starting plexmediaserver.service - Plex Media Server...
Oct 25 14:41:36 k3s-home-03 systemd[1]: plexmediaserver.service: Found left-over process 118152 (Plex Media Serv) in control group while starting unit. Ignoring.
Oct 25 14:41:36 k3s-home-03 systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
Oct 25 14:41:36 k3s-home-03 systemd[1]: Started plexmediaserver.service - Plex Media Server.
Oct 25 14:41:36 k3s-home-03 systemd[1]: plexmediaserver.service: Main process exited, code=exited, status=255/EXCEPTION

No plex processes are running (the zombies are still there, of course). A systemctl list-units shows:

  UNIT                                    LOAD   ACTIVE SUB       DESCRIPTION
● plexmediaserver.service                 loaded failed failed    Plex Media Server

And the main, zombie PMS process is keeping a file open on the remote share:

# lsof -n | grep -i plex
[snip]
Plex\x20M 118152 142277 PMS\x20Li             plex   95u     IPv4            2105957       0t0                  TCP 10.0.1.236:38008->54.74.134.212:https (CLOSE_WAIT)
Plex\x20M 118152 142277 PMS\x20Li             plex   96u     IPv4            2105960       0t0                  TCP 10.0.1.236:60908->104.18.36.51:https (CLOSE_WAIT)
Plex\x20M 118152 142277 PMS\x20Li             plex  119u     IPv4             854169       0t0                  TCP 10.0.1.236:32400->192.168.0.201:51119 (ESTABLISHED)
Plex\x20M 118152 142277 PMS\x20Li             plex  124u     IPv4             852830       0t0                  TCP 10.0.1.236:32400->192.168.0.201:51150 (ESTABLISHED)
Plex\x20M 118152 142277 PMS\x20Li             plex  131r      DIR               0,50         0 13221876824798896960 /var/lib/plexmedia/TV/[redacted]
Plex\x20M 118152 142277 PMS\x20Li             plex  138r  a_inode               0,16         0                   53 inotify

My only recourse is to power off the machine (reboot hangs) to get rid of the zombie processes. After it reboots, it scans the files normally and continues running. This is not ideal.

I just changed the SMB mount to be read-only, in the hopes that that might relieve some low-level locking issue, but I doubt it will make a difference.

Any ideas? What other information would be helpful?

Small update: I added soft,cache=loose to the cifs mount options. From what I’ve seen it may be an SMB problem; I guess we’ll see. If it SMB, I’ll change the mount to NFS and see if that’s better.

You’re using Linux.

Have you considered NFS? it does work a lot better as it’s native to Linux.

I’ve never used SMB on Linux with a Linux file server.

I’ve changed the mount point to use NFS instead of SMB and it seems to be working well. I’ve been adding a ton of content and so far no issues; it’s happily scanning everything and doesn’t seem to be hung up yet.

Food for thought.

If you’re adding a lot of new content… You might want to give the DB a proper cleanup when done.

This works better than what’s built in because it works with PMS shutdown (DB is quiescent)

1 Like

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