Skip to content

Close the pty write-after-respawn race and bound the pty PATH resolve stall - #205

Open
rakibulism wants to merge 1 commit into
vercel-labs:mainfrom
rakibulism:main
Open

Close the pty write-after-respawn race and bound the pty PATH resolve stall#205
rakibulism wants to merge 1 commit into
vercel-labs:mainfrom
rakibulism:main

Conversation

@rakibulism

Copy link
Copy Markdown

Summary

  • ptySpawn now returns a versioned PtyHandle{key, generation}; a new ptyWriteChecked refuses a write whose generation no longer matches the current occupant of that key. This closes a misdelivery hazard where a stale write (issued for an old pty occupant) could silently land on a new pty that reused the same key. ts_core_host.zig's spawn/write path now uses it.
  • resolveExecutable's PATH walk (blocking access() calls with no timeout) now runs on a bounded worker thread via resolveExecutableBounded, capped at 300ms before the worker is abandoned — a stalled NFS/autofs mount now costs the loop thread a bounded stall instead of hanging indefinitely.
  • Adds a real-executor test for the deferred (non-inline) host-request answer path racing cancelHostRequest, closing a coverage gap in effects_host_tests.zig — previously every real-executor request_fn stub answered synchronously inline, so the genuinely async path (feedHostResult called later, off request_fn's own call stack) was untested.

Test plan

  • zig build test passes locally (Zig 0.16.0) with the same set of pre-existing, environment-gated failures (missing codesigning identity, no Android SDK, etc.) as an unmodified checkout — nothing new broken.
  • zig ast-check clean on every edited file.
  • The real-transport pty test suite (which exercises resolveExecutableBounded on every spawn) runs and passes.

… stall

ptySpawn now returns a versioned PtyHandle{key, generation}; ptyWriteChecked
refuses a write whose generation no longer matches the current occupant of
that key, closing a misdelivery hazard where a stale write could land on a
respawned pty that reused the same key. ts_core_host.zig's spawn/write path
now uses it.

resolveExecutable's PATH walk (blocking access() calls with no timeout) now
runs on a bounded worker thread via resolveExecutableBounded, capped at
300ms before the worker is abandoned rather than stalling the loop thread
indefinitely on a wedged NFS/autofs mount.

Also adds a real-executor test for the deferred (non-inline) host-request
answer path racing cancelHostRequest, closing a coverage gap in
effects_host_tests.zig.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

@rakibulism is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant