feat!: shorten the session working directory name for Windows MAX_PATH - #348
Open
crowecawcaw wants to merge 2 commits into
Open
Conversation
The applications a job runs on Windows -- After Effects and Cinema4D among
them -- use the legacy Win32 file APIs, which cap a path at MAX_PATH (260
characters) regardless of the LongPathsEnabled registry value and regardless
of whether this library prefixes its own paths with \\?\. Nothing but a
shorter path helps them.
The session working directory name was the full session id used verbatim as
the mkdtemp() prefix. For a Deadline Cloud session that is 40 characters
(`session-` plus a 32 character hex uuid) plus mkdtemp()'s 8 random
characters: 48 characters, of which the uuid and the random suffix were both
sources of uniqueness. Only one of them needs to be.
Use the last SESSION_DIR_ID_LENGTH (6) characters of the session id as the
prefix instead, giving a 14 character name -- 34 characters recovered. The
tail rather than the head because a session id conventionally leads with
constant text saying what kind of id it is, so a leading slice can carry no
correlation at all.
Uniqueness is unaffected. mkdtemp() creates each candidate name with an
exclusive mkdir() and retries on FileExistsError (verified identical in
CPython 3.9 through 3.14, the supported range), so it cannot return an
existing directory however short the prefix is. The truncated id is purely an
operator-facing label; the full id is unchanged and still appears on every log
record for the session and immediately beside this directory's path at
initialization.
Also shorten the embedded files subdirectory prefix from "embedded_files" to
"ef", recovering 12 more characters from every embedded file path. That
directory nests inside the session working directory, so its name is charged
to everything beneath it.
BREAKING CHANGE: the on-disk name of the session working directory is no
longer prefixed with the session id, and the embedded files subdirectory is
named "ef<random>" rather than "embedded_files<random>". Neither name is part
of the public Python interface -- Session.working_directory and
Session.files_directory are unchanged, as is OPENJD_SESSION_WORKING_DIR -- but
anything that pattern-matches the directory name must be updated. Known
consumer: deadline-cloud-worker-agent's test/e2e/test_worker_config.py
asserts a `session-[a-f0-9]{32}` directory name, and its docs/state.md
documents the old shape.
Signed-off-by: Stephen Crowe <6042774+crowecawcaw@users.noreply.github.com>
crowecawcaw
force-pushed
the
feature/shorten-session-working-dir-name
branch
from
August 12, 2026 20:56
072321a to
b6e4f8d
Compare
- test_full_session_id_remains_in_the_log: filter to openjd.sessions records and default the session_id getattr to None, so a dropped LoggerAdapter fails the assertion instead of passing vacuously. - Replace the probabilistic name-inspection assertions with a deterministic check that TempDir is called with prefix="". - Assert the name length as a <= budget ceiling rather than == to an incidental CPython detail. - Narrow the concurrent test's except from BaseException to Exception (CodeQL). - Fix TempDir.prefix docstring (default is None -> "tmp", not ""). - Note on working_directory / retain_working_dir that the directory name no longer carries session identity; the log holds that mapping. Signed-off-by: Stephen Crowe <6042774+crowecawcaw@users.noreply.github.com>
crowecawcaw
force-pushed
the
feature/shorten-session-working-dir-name
branch
from
August 13, 2026 03:44
b547a27 to
732c800
Compare
crowecawcaw
marked this pull request as ready for review
August 13, 2026 14:02
leongdl
approved these changes
Aug 13, 2026
leongdl
left a comment
Contributor
There was a problem hiding this comment.
Meta comment, I'm seeing alot of changes around the components to work around windows long path. In this temp dir case it is ok, since it is not a contract. But we cannot generally solve this.
How about we push for the proper python installer fixes ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was the problem/requirement? (What/Why)
The applications a job runs on Windows -- After Effects and Cinema4D among them -- use the legacy Win32 file APIs, which cap a path at MAX_PATH (260 characters). Deadline libraries use up a lot of that limit with long path names.
What was the solution? (How)
What is the impact of this change?
Enables users to use files with 40 more characters with DCCs without long path support.
How was this change tested?
CI
Was this change documented?
Yes
Is this a breaking change?
No. Session directories are temporary, contain a random component (not deterministic), and their format is not guaranteed.
Does this change impact security?
No. Folder uniqueness is still enforced with mktempdir as it was before.
Cross-port to openjd-rs
TODO
This package is being migrated to Rust in
openjd-rs/crates/openjd-sessions.Behavioral changes made here should be replicated there to keep the two
implementations in sync until the migration is complete.
openjd-rs(link the PR here): , oropenjd-rsto port this change (link here): , orBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.