As I said above, we’re going to clean up the confusion caused in the new packaging.
Having traced it all down back to the beginning of time (2011) for Linux.
TMPDIR was always used (for POSIX compliance)
TranscoderTempDir is not set by default. If you want that, you can set in Preferences.xml or in the GUI (transcoder - show advanced)
When PMS was first ported to Linux and the team setup the variables, they made plans for having all nice names. PLEX_MEDIA_SERVER_TEMPDIR was supposed to be included.
In the initial start_pms script, it was used, if defined, by
TMPDIR="$PLEX_MEDIA_SERVER_TMPDIR"
The transition from SYSV -> Upstart -> systemd lost that functionality in systemd.
When I re-introduced SYSV-init support, I accidentally brought it back.
It was never supported in the first place.
Official has always been to set TMPDIR, or any of the four honored by mkstemp() prior to PMS launch .
What will happen now is I’m going to clean up this perpetuation of an error because there is no way for us to selectively pick variable names in service definitions.
The solution I’m going to implement is:
I’ll set TMPDIR to the Plex default (which is per each platform’s default) /tmp
If this isn’t desired, all that’s needed is to declare a new value in override.conf or /etc/default/plexmediaserver (platform dependent)
I will also be adding some support info in the service file and default file to clarify this.
Ah! I just noticed I had a lingering file in my /etc/sysconfig for Plex. I guess it was in the package a long time ago. I had renamed it to /etc/sysconfig/PlexMediaServer.prev (note the capital letters). It was dated April 2013! I didn’t think to look there because it wasn’t referenced in the .service file. Like you stated, it has this:
There you go. That is the exact evidence we found.
PLEX_MEDIA_SERVER_TMPDIR was supported via the shell script only.
It was supposed to become a “pretty” variable in PMS but never did.
Transition from 2013 → 2015 (upstart) → 2016 (system)
The introduction of upstart broke it. systemd was also broken but perpetuated the broken variable nonetheless.
When I recreated SYSV-init support, from the old archives, I encountered that variable and, without realizing it didn’t belong, integrated support for it.
Jump forward in time until today.
As the result of all the research.
TMPDIR, TEMPDIR, TMP, and TEMP remain variables supported by Linux
Plex uses, and has always only used TMPDIR
Engineering decision is to remove the non-supported PLEX_MEDIA_SERVER_TMPDIR variable from Linux desktop distributions (redhat & debian).
It’s clear I have a great deal more flexibility in any shell environment but I need adhere to lowest common denominator else there will be complete mayhem.
Looks good. It is good to know that the var’s have been vetted.
My only small criticism is that the note “(customizable in override.conf)” could apply to anything in the .service file, not just User= and Group=. The note could be placed at the beginning of the file to give a hint to users unfamiliar with that feature of systemd.
With the next update, I will stop reporting it in the config.
To aid in the transition, I will flag PLEX_MEDIA_SERVER_TMPDIR as a not-allowed variable.
did anyone ask the question why Plex is writing >1 GiB temporary data at all and if this was the case before already? Writing such amount to any tmpfs OR disk is neither something I like to see from a media server within a day single client usage, and since we never faced issues like this before and never touched any tmp path settings, I guess it was using much less before.
Is there probably an issue with internal tmp cleanup tasks?
We only got this report just as well, I’m building a test case up, requires video files, at least playing audio files does not lead to any tmp files being created. Conversion to RAW seems to be what is creating the large ones.
… probably indeed due to skip intro feature, something I cannot test due to missing Plex pass for now . Thanks for the hint!
Went through the thread and see it has been closed. But I have to say the discussion opposition has a fair point that the current situation where intro detection writes such amount of data by default to /tmp creates real issues. See: Image update | Odroid XU3/XU4/MC1/HC1/HC2 · Issue #3544 · MichaIng/DietPi · GitHub
On the new GitHub issue one can see that disabling intro detection solved the issue of > 1 GiB PMS data written to /tmp, default TMPDIR and by default tmpfs with again default 512 MiB size on all Linux distros I know. Of course one can increase it, on our little overlay distro it has 1 GiB by default but more stresses a swap file on most SBCs, hence often leads to SD card wear that way. Using a well defined directory, respecting a setting dedicated to TMPDIR instead (like it is for regular transcoding), allows one to have that data created e.g. on an external drive so that neither GiBs of RAM is blocked nor the SD card is worn. Otherwise the feature IMO should be disabled by default with a strong warning that it requires a certain (unusual) large amount of RAM in certain circumstances. I just have this one report of 1 GiB, but don’t know much much media was processed and how much data would have been written if /tmp wouldn’t gotten full.
Read somewhere that the feature will be available for non-pass users as well? Would run some tests then to check more in detail myself.
Little buttom line from my end:
The default tmpfs size is 512 MiB and /tmp is a tmpfs usually.
That gives a hint about which data size is usually expected to be created there and in which case one should better use a dedicated non tmpfs dir by default, also /var/tmp is an option, which is considered for persistent tmp files, hence not intended to be a tmpfs.
I know there is no strict rule about this, but the related issues are present. So IMO its wise to design program defaults a way that no 512 MiB are written to /tmp in usual circumstances with default settings .
By default the TranscoderTempDirectory is currently /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache/Transcode
What a perfect place to put temporary files produced by the Transcoder
But the Proper solution would be the Transcoder just respecting writing to TranscoderTempDirectory and not using TMPDIR. It uses TranscoderTempDirectory for most of its operations now anyways.