PMS stopped honoring temporary directory setting. Now uses /tmp

Plex uses the /tmp directory by default. It’s always been this way.

I do not know where the idea of being able to set EAE_ROOT came from but it is not user-facing. It comes from PLEX_MEDIA_SERVER_TMPDIR.

If the system doesn’t have enough ram, given /tmp is usually tmpfs (from ram) on Linux, assigning it to a HDD location makes sense.

The idea came from me because I noticed it in the log file.

The override.conf didn’t work. It is still using /tmp. I used the prescribed method for overriding the contents of a .service file. The systemctl show plexmediaserver shows that it is picking up the ENV variables from the override.conf:

systemctl show plexmediaserver|grep Env
Environment=[unprintable] PLEX_MEDIA_SERVER_HOME=/usr/lib/plexmediaserver PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6 PLEX_MEDIA_SERVER_TMPDIR=/plex/tmp LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 EAE_ROOT=/plex/tmp

Plex seems to ignore it and EAE_ROOT still shows /tmp in the log files.

1 Like

As I stated above:

  1. It’s an internal variable PMS generates , per transcode session, for the transcoder to use

  2. There is no user-facing variable.

Re: point 2 I think the request is if one can be exposed.

It may have always used /tmp in the past, and that’s fine, but something in the last version update has changed, which is negatively affecting the Operating System. If Plex needs a large tmp volume then that should be checked in the installation to make sure its large enough, or used an alternative directory that is large enough. Using /tmp and blowing up and leaving the partition full when it’s done is an unreasonable outcome, other services and the OS depend on having adequate /tmp space.
I haven’t found anywhere where tmp space size is specified for Plex.

I realize that EAE_ROOT is internal, but you stated that:

I read that to mean that EAE_ROOT is not exposed, but would honor PLEX_MEDIA_SERVER_TMPDIR since that var IS user facing (it is in the .service file). If this isn’t the case, then my request would be that EAE_ROOT uses PLEX_MEDIA_SERVER_TMPDIR.

1 Like

EAE_ROOT is generated from the TMPDIR variable.

Now, if there is something with the size of /var which needs to be taken into consideration when installing then

You’re talking to the right guy. I do the installation scripting.

Most OS installations create 64GB partitions for root AFAIK.
If I’m outdated, please educate me. It’s impossible to keep track.

How much space is currently available on / ?

Chuck, you know where I’m headed… :slight_smile:

What’s considered to be an appropriate size available for ${TMPDIR}? Yes, I know, that’s an unfair question.

Oh, now that’s interesting… somewhere along the line, Transcoder temporary directory has been set to a null/default value. It should have been pointing to a location with nearly 300gb free.

How much is enough space?

  1. How many sessions are you running in parallel ?
  2. What is the aggregate output bit rate of all concurrent sessions ?
  3. How far of a “Seek backwards” buffer do you want to maintain?
  4. What’s the total run time of all the files which overlap?

I ask this because the correct answer is based entirely on how you use PMS and how you answered the four questions.

Why are they important?

  1. The transcoder will prune already-played buffers when space gets low.
  2. If you seek backwards to a point in time which has already been pruned, the transcoder will need regenerate those buffers
  3. If, while generating those buffers, it can’t keep the unplayed buffers due to lack of space, the unplayed will be deleted and generated again as needed.

At installation time, how can it know how you intend to use your system?

You may like my scripting work but I’m not that good :wink:

I have confirmed that setting TMPDIR inside the /etc/systemd/system/plexmediaserver.service.d/override.conf fixes the issue. I now see this in my log file:

DEBUG - Job running: EAE_ROOT='/plex/tmp/pms-4c34be92-4d95-4f99-83cc-acf94dc38c45/EasyAudioEncoder'

So this is good! I like that it follows the existing TMPDIR environment variable convention. I should have known after all these years working with Linux what you meant about TMPDIR. I was thrown off by the log message and that is when I tried to set EAE_ROOT.

The .service file has PLEX_MEDIA_SERVER_TMPDIR right in it. It seems to a bit off to me to have a PLEX_MEDIA_SERVER_TMPDIR environment variable (looks obvious enough), but not have everything inside Plex not follow that directive. It might be better just to have TMPDIR, which is the normal convention, in the .service file and get rid of PLEX_MEDIA_SERVER_TMPDIR. What are your thoughts on this?

1 Like

The formal name is PLEX_MEDIA_SERVER_TMPDIR.

Alternate forms are:


    # Use first found of 4 possible Temp Dir specifications (warp core)
    OverrideTmpdir="$(GetValue PLEX_MEDIA_SERVER_TMPDIR "$OverrideFile")"
    if [ "$OverrideTmpDir" = "" ]; then
      OverrideTmpDir="$(GetValue TMPDIR "$OverrideFile")"
      if [ "$OverrideTmpDir" = "" ]; then
        OverrideTmpDir="$(GetValue TEMP "$OverrideFile")"
        if [ "$OverrideTmpDir" = "" ]; then
          OverrideTmpDir="$(GetValue TMP "$OverrideFile")"
        fi
      fi
    fi

Chuck,

I do not think it is honoring PLEX_MEDIA_SERVER_TMPDIR though. On my ubuntu 18.04 I have a 80G /dev/shm in place, and have set the transcoding directory to /dev/shm. I have Transcoder temporary directory set to /dev/shm but EAE is still throwing everything inside of /tmp. Now, not a huge deal to me since it’s still in memory, but it not honoring that setting could be troublesome for others.

Yup! My first instinct was to look at the .service file and right there is PLEX_MEDIA_SERVER_TMPDIR. Which goes back to my original point that EAE_ROOT should follow PLEX_MEDIA_SERVER_TMPDIR. It doesn’t.

It’s nice that there is a work-around (TMPDIR), but that is less intuitive when the .service file lays out the default options.

1 Like

Engineering will start waking within the hour.
I posed a very interesting question to them.

Their answer will be interesting :slight_smile:

1 Like

Answer in hand.

  1. PMS hasn’t cared about those variables for YEARS.
  2. Several of us were misinformed
  3. We dug into the code.
  4. The code uses:

https://en.cppreference.com/w/cpp/filesystem/temp_directory_path

  1. Which specifically looks for:

On POSIX systems, the path may be the one specified in the environment variables TMPDIR , TMP , TEMP , TEMPDIR , and, if none of them are specified, the path “/tmp” is returned.

We chatted and there will be a blanket update of packaging to clear up the misinformation.

As test, set one of those variables and test.

1 Like

The use of TMPDIR is fine with me. It is the standard way for Unix/Linux. Only the packaging threw me off. Setting TMPDIR worked.

Yes, I haven’t responded… been tinkering a bit with LiveTV buffers. The volume that I’m currently using seems to be overkill by a couple of orders of magnitude. Go big or go home. :slight_smile:

Interesting discussion & usage of env vars that’s far more dependent on operating system than I’d have thought.

I like specifying a plex temp directory it instead of using the system default (but I understanding using the default if none is specified). Especially since the server could be doing other things than just plex. My default 500MB tmp partition works fine for the rest of the processes running on the server, but I would like to specify a tmp directory for plex, within my media partition which had terabytes of free space. I would also hope that plex periodically cleaned the temp space or cleared it when the plex process starts.

Thanks for all the attention you have given this issue.

Sean

Specifying a dedicated temp directory for Plex is as easy as writing a service override and assigning a value to TMPDIR.

/etc/systemd/system/plexmediaserver.service.d/override.conf

in it, place:

[Service]
Environment="TMPDIR=/path/to/temporary directory"

Am I correct, that a specific PLEX_MEDIA_SERVER_TMPDIR is actually requested?
I ask because, at present, PMS uses mkstemp in conjunction with the C++ standard on Linux for temporary directories for POSIX compliance.

I don’t think that it is required. If Plex always used mkstemp then a PLEX_MEDIA_SERVER_TMPDIR was never required and should have been removed from the .service file long ago. It would have been helpful to have a hint in the file (e.g. a commented out TMPDIR line) to help inform me that Plex uses the standard function.

@Disputin, use the override.conf file like @ChuckPa has shown. It will ONLY impact that particular service. I have tested this and it works.