[SPARK-57949][PYTHON][TESTS] Use shortest temp base for direct-worker UDS path to fix macOS AF_UNIX path too long#57028
Closed
HyukjinKwon wants to merge 1 commit into
Closed
Conversation
… UDS path (fix macOS AF_UNIX path too long) TestDirectWorkerDispatcher.shortTempBase picked the first writable base among TMPDIR/TEMP/TMP/tmp. On macOS $TMPDIR is a long /var/folders/<...>/T path, so the resulting Unix-domain socket path (base + createTempDirectory random suffix + w-<id>.sock leaf) exceeded the 104-byte macOS sun_path limit and failed PythonUDFWorkerSpecificationSuite with 'OSError: AF_UNIX path too long', turning the Build / Maven (JDK 21, MacOS-26) lane red. Pick the shortest usable base by its real (symlink-resolved) path instead, so on macOS /tmp (-> /private/tmp) is chosen over the long $TMPDIR. Linux is unaffected (its per-user temp dirs are already short). Test-only. Generated-by: Claude Code
dongjoon-hyun
approved these changes
Jul 6, 2026
HyukjinKwon
added a commit
that referenced
this pull request
Jul 6, 2026
…UDS path to fix macOS AF_UNIX path too long ### What changes were proposed in this pull request? `TestDirectWorkerDispatcher.shortTempBase` (in `TestDirectWorkerHelpers.scala`) chooses a base directory for the direct-worker Unix-domain socket by taking the **first** writable entry among `$TMPDIR`, `$TEMP`, `$TMP`, `/tmp`. This PR changes it to pick the **shortest** usable base, measured by its real (symlink-resolved) path. ### Why are the changes needed? On macOS, `$TMPDIR` is a long per-user path like `/var/folders/k8/j7r3p6cx43xdqhzy2rmp6tqr0000gn/T/` (~49 chars). Combined with the `createTempDirectory` random suffix and the `w-<id>.sock` leaf, the bound socket path exceeds the **104-byte macOS `sun_path` limit**, so `PythonUDFWorkerSpecificationSuite` fails with: ``` OSError: AF_UNIX path too long at ...TestDirectWorkerDispatcher.throwWorkerExitedBeforeSocket(TestDirectWorkerHelpers.scala:207) ``` This keeps the scheduled `Build / Maven (Scala 2.13, JDK 21, MacOS-26)` lane red. Picking the shortest base makes macOS use `/tmp` (which resolves to the short `/private/tmp`) instead of the long `$TMPDIR`, keeping the socket path well within the limit. Linux is unaffected — its per-user temp dirs are already short — and the choice is now deterministic (shortest wins) rather than order-dependent. ### Does this PR introduce _any_ user-facing change? No. Test-only. ### How was this patch tested? Ran the affected suites on both `macos-14` and `macos-15` GitHub Actions runners (arm64, the same short-`$TMPDIR` layout as `macos-26`), where `$TMPDIR` was confirmed to be the long `/var/folders/...` path (`len=49`): - `udf-worker-core`: `DirectWorkerDispatcherSuite` + `WorkerSessionSuite` — **48 tests, 0 failures** - `sql/core`: `PythonUDFWorkerSpecificationSuite` — **1 test, 0 failures** (previously `AF_UNIX path too long`) Both runners green: https://github.com/HyukjinKwon/spark/actions/runs/28765870386 Before this change the same suite fails on `macos-26`: https://github.com/apache/spark/actions/runs/28753698265 ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code Closes #57028 from HyukjinKwon/ci-fix/agent4-macos-uds-path-pr. Authored-by: Hyukjin Kwon <gurwls223@apache.org> Signed-off-by: Hyukjin Kwon <hyukjin.kwon@databricks.com> (cherry picked from commit 226ea56) Signed-off-by: Hyukjin Kwon <hyukjin.kwon@databricks.com>
Member
Author
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 changes were proposed in this pull request?
TestDirectWorkerDispatcher.shortTempBase(inTestDirectWorkerHelpers.scala) chooses abase directory for the direct-worker Unix-domain socket by taking the first writable
entry among
$TMPDIR,$TEMP,$TMP,/tmp. This PR changes it to pick the shortestusable base, measured by its real (symlink-resolved) path.
Why are the changes needed?
On macOS,
$TMPDIRis a long per-user path like/var/folders/k8/j7r3p6cx43xdqhzy2rmp6tqr0000gn/T/(~49 chars). Combined with thecreateTempDirectoryrandom suffix and thew-<id>.sockleaf, the bound socket pathexceeds the 104-byte macOS
sun_pathlimit, soPythonUDFWorkerSpecificationSuitefails with:
This keeps the scheduled
Build / Maven (Scala 2.13, JDK 21, MacOS-26)lane red. Picking theshortest base makes macOS use
/tmp(which resolves to the short/private/tmp) instead ofthe long
$TMPDIR, keeping the socket path well within the limit. Linux is unaffected — itsper-user temp dirs are already short — and the choice is now deterministic (shortest wins)
rather than order-dependent.
Does this PR introduce any user-facing change?
No. Test-only.
How was this patch tested?
Ran the affected suites on both
macos-14andmacos-15GitHub Actions runners (arm64, thesame short-
$TMPDIRlayout asmacos-26), where$TMPDIRwas confirmed to be the long/var/folders/...path (len=49):udf-worker-core:DirectWorkerDispatcherSuite+WorkerSessionSuite— 48 tests, 0 failuressql/core:PythonUDFWorkerSpecificationSuite— 1 test, 0 failures (previouslyAF_UNIX path too long)Both runners green: https://github.com/HyukjinKwon/spark/actions/runs/28765870386
Before this change the same suite fails on
macos-26:https://github.com/apache/spark/actions/runs/28753698265
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code