Skip to content

[BUG] macOS V8 runtime bootstrap fails when TMPDIR makes UDS path too long #60

@notkadez

Description

@notkadez

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.ts

Observed:

Error: V8 runtime process closed stdout before sending socket path

Works with short temp dir:

TMPDIR=/tmp/se pnpm exec tsx examples/quickstart/src/simple.ts

Observed:

hello from secure-exec

Direct control against the packaged runtime shows the real failure:

failed to bind UDS: path must be shorter than SUN_LEN

Impact

  • 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.sock

On 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions