Running Plex via Docker - Ocassionally Freezes and Drops media playback on devices

server-docker

#1

I am running plex in kubernetes within a docker container. About every 10 minutes devices that are playing a movie from the plex media server drop their connection and occasionally the plex media server is unresponsive for about 5 minutes (though does not crash). This happens on my local network and externally as well. I was wondering what steps I should do to start debugging this issue? There is no stdout/stderr from the executable. I am aware that there are many plex logs. Which ones should I look at first?


#2

I should also mention that I am using the official plex docker image plexinc/pms-docker:1.9.2.4285-9f65b88ae


#3

Same issue here, have been having it for a long time. Appreciate any debug information.

Setup: FreeNAS 11
Bhyve VM Ubuntu 16.04 Server with docker
Filesystem

/config : FreeNAS ---NFS---> Ubuntu --- docker volume --> plex docker image
/data : FreeNAS ---NFS---> Ubuntu --- docker volume --> plex docker image
/transcode : FreeNAS ---zvol---> Bhyve VM/Ubuntu --- docker volume --> plex docker image


#4

On very recent testing I get this error from the log file Plex Media Server.log

Oct 16, 2017 21:54:00.969 [0x7f6b35bf5700] ERROR - Caught exception trying to stream file: /transcode/Transcode/Sessions/plex-transcode-lfappcyhhah4w69rvmsha5t8-b4e9865b-2678-403a-b93d-042eccf94aa2/init-stream1.m4s,/transcode/Transcode/Sessions/plex-transcode-lfappcyhhah4w69rvmsha5t8-b4e9865b-2678-403a-b93d-042eccf94aa2/chunk-stream1-00073.m4s: write: protocol is shutdown

Versions:
Web Client Version 3.23.1
Server (fresh docker image pull with empty config dir) Version 1.9.4.4325

[Edit1: added logfile]
[Edit2: added versions references]


#5

Piling on here.. also having transcode errors in my logs. No idea what's going on.

PMS version 1.9.5.4339
Running inside a docker container on my Unraid server.

Logs attached

e.g. here's a snippet:

    Oct 22, 2017 15:03:32.540 [0x2b6b52604700] ERROR - Caught exception trying to stream file: /transcode/Transcode/Sessions/plex-transcode-520ca39ae7732b93-com-plexapp-android-92784e66-7c42-4244-934d-545880597462/media-00385.ts: write: protocol is shutdown
    Oct 22, 2017 15:14:01.815 [0x2b6b52202700] ERROR - Caught exception trying to stream file: /transcode/Transcode/Sessions/plex-transcode-520ca39ae7732b93-com-plexapp-android-92784e66-7c42-4244-934d-545880597462/media-00447.ts: write: protocol is shutdown
    Oct 22, 2017 15:15:32.199 [0x2b6b52001700] ERROR - Caught exception trying to stream file: /transcode/Transcode/Sessions/plex-transcode-520ca39ae7732b93-com-plexapp-android-92784e66-7c42-4244-934d-545880597462/media-00455.ts: write: protocol is shutdown
    Oct 22, 2017 15:17:03.412 [0x2b6b68801700] ERROR - Caught exception trying to stream file: /transcode/Transcode/Sessions/plex-transcode-520ca39ae7732b93-com-plexapp-android-92784e66-7c42-4244-934d-545880597462/media-00466.ts: write: protocol is shutdown
    Oct 22, 2017 15:19:13.549 [0x2b6b52202700] ERROR - Caught exception trying to stream file: /transcode/Transcode/Sessions/plex-transcode-520ca39ae7732b93-com-plexapp-android-92784e66-7c42-4244-934d-545880597462/media-00477.ts: write: protocol is shutdown
    Oct 22, 2017 15:20:53.359 [0x2b6b52604700] ERROR - Caught exception trying to stream file: /transcode/Transcode/Sessions/plex-transcode-520ca39ae7732b93-com-plexapp-android-92784e66-7c42-4244-934d-545880597462/media-00489.ts: write: protocol is shutdown
    Oct 22, 2017 15:25:21.095 [0x2b6b52202700] ERROR - Caught exception trying to stream file: /transcode/Transcode/Sessions/plex-transcode-520ca39ae7732b93-com-plexapp-android-92784e66-7c42-4244-934d-545880597462/media-00516.ts: write: protocol is shutdown
    Oct 22, 2017 15:30:12.024 [0x2b6b52604700] ERROR - Caught exception trying to stream file: /transcode/Transcode/Sessions/plex-transcode-520ca39ae7732b93-com-plexapp-android-92784e66-7c42-4244-934d-545880597462/media-00545.ts: write: protocol is shutdown
    Oct 22, 2017 15:31:49.528 [0x2b6b5f204700] INFO - Library section 1 (Movies) will be updated because of a change in /media-movies/movies/Dark.Tower,.The.(2017)
    Oct 22, 2017 15:32:32.981 [0x2b6b52202700] ERROR - Caught exception trying to stream file: /transcode/Transcode/Sessions/plex-transcode-520ca39ae7732b93-com-plexapp-android-92784e66-7c42-4244-934d-545880597462/media-00559.ts: write: protocol is shutdown
    Oct 22, 2017 15:39:52.495 [0x2b6b52604700] ERROR - Caught exception trying to stream file: /transcode/Transcode/Sessions/plex-transcode-520ca39ae7732b93-com-plexapp-android-92784e66-7c42-4244-934d-545880597462/media-00601.ts: write: protocol is shutdown

#6

I have been able to resolve my problems, I hope that what helped me can help you too.

The setup

So as I mentioned before my setup is a FreeNAS box with a Behyve VM running ubuntu which in trun runs docker (convoluted I know, but docker!). The sharing of the data from FreeNAS 11 to the ubuntu VM does happen via NFS shares from FreeNAS to the ubuntu VM over the network (loopback as it is the same machine). With this mechanism I had shared the media (/data) and the configuration (/config).

As I knew that transcoding is I/O intensive and I did not really care about persisting this data it was mapped to the local file system in the VM (FreeNAS zvol—> Bhyve VM/Ubuntu). The underlying physical disk was recently upgraded to an SSD.

The change

Now the big improvement happened when I decided to move the config (/config) to the local filesystem of the VM, i.e. not having it reside on the NFS share. From this point on I had no problems with streams being interrupted or seeking being a problem or chromecast suddenly dropping the stream.

A suspicion on the why

I encountered an article talking about that the plex DB (i.e. /config) should reside on a filesystem suppoting file locking. Unfortunately I do not have the link to the article that was talking about this, if I find it again I will try to post it.

What was also mentioned was that FreeNAS corral (Corral < 11) was using a special filesystem driver to expose the host datasets to the VMs and not NFS as I have replicated in the FreeNAS 11 setup. In that setup I had no problems but I had to migrate to FreeNAS 11 due to corral being downgraded to technical preview after release (big debacle…). It seems that the corral VM filesystem driver did not interfere as much as NFS with how plex expects it to work.

** Moral of the story **

Put your /config on the VM local storage, plex does not like having it on the network.
Pay attention to virtualization drivers to your VMs running docker, if you have options try them out.


#7

The /config needs locking because the database driver (sqlite) relies on locking for several of its operations. Corral used 9pfs, which natively support file locking across to the host's file system (a rare feature in network file systems). NFS, as you found out, does not do this. Some people have reported success using local posix locking with NFS, but I've personally seen database corruption using this technique so I would not recommend it.


#8

@gbooker02 Thanks for the detailed explanation and the reference to 9pfs which I was missing.


#9

@tmchow @costrouc did you manage to resolve your problem?


#10

Do you think AFP, iSCSI or NFSv4 would solve the file locking issue? I’ll try that soon. NFSv3 and SMB definitely have unsolvable problems.


#11

Docker isn’t my specialty but I saw you’re using NFSv3 and your Plex data is over NFS?

An absolute requirement with NFSv3 is local_lock=posix in the mount options and the NFS server must support posix locks. You must preserve the integrity of locks across the network layer. NFS doesn’t enable them by default


#12

I’m new to all this.
Can anyone explain to me how to move the config in order to solve the issue? I think i’m having the same problem.