-
Notifications
You must be signed in to change notification settings - Fork 29
[BUG] macOS V8 runtime bootstrap fails when TMPDIR makes UDS path too long #60
Description
Summary
On macOS, pnpm exec tsx examples/quickstart/src/simple.ts can fail during V8 runtime bootstrap if the default TMPDIR is long enough to push the Unix socket path past Darwin's sun_path limit.
The same command succeeds with a shorter TMPDIR, so this is not a tsx issue. The Rust V8 runtime is binding its socket under std::env::temp_dir() with a path shape that is too long for some macOS temp roots.
Minimal repro
Fails with default macOS temp dir:
pnpm exec tsx examples/quickstart/src/simple.tsObserved:
Error: V8 runtime process closed stdout before sending socket pathWorks with short temp dir:
TMPDIR=/tmp/se pnpm exec tsx examples/quickstart/src/simple.tsObserved:
hello from secure-execDirect control against the packaged runtime shows the real failure:
failed to bind UDS: path must be shorter than SUN_LENImpact
- breaks the documented quickstart flow on some macOS setups
- surfaces a misleading bootstrap error instead of the real bind failure
- likely affects any macOS V8-runtime startup path using a long default
TMPDIR
Root cause
native/v8-runtime/src/main.rs creates a socket path like:
<temp_dir>/secure-exec-<32 hex>/secure-exec.sockOn macOS, default temp roots like /var/folders/.../T/ are already long. After appending the secure-exec-specific directory and socket name, UnixListener::bind() can exceed Darwin's UDS path limit and fail before the runtime prints its socket path to stdout.
packages/v8/src/runtime.ts then reports the generic stdout-close error instead of surfacing stderr.