voidzero-dev / voidzero-dev/vite-task

macOS: bundled oils shell intermittently fails fast external commands (getpgid ESRCH race)

Open
#702 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
466
Forks
42
Avg merge
1d 15h
Merged PRs (30d)
19

Description

Symptom

A cached task on macOS intermittently reports exit 2 with empty stdout and oils I/O error (main): No such process on stderr. Seen in the wild running parallel test suites that spawn vp run (each task runs under the bundled osh, which fspy substitutes for /bin/sh).

Root cause

Not fspy's exec interposition — the bundled oils 0.37.0 itself. Process::RunProcess (core/process.py) calls getpgid(child_pid) right after fork() and before waitpid(). On macOS, getpgid() of a zombie child fails with ESRCH, so when the parent is descheduled past a fast command's exit (CPU contention), the OSError escapes to oils' main() → exit 2.

Reproduces with the raw oils binary, no fspy involved: ~5% under 6-8-way parallel loops of osh -c 'echo x > f; cat f'.

Fix

Upstream PR: https://github.com/oils-for-unix/oils/pull/2689 — gate the getpgid() on job control being enabled (MaybeGiveTerminal() no-ops otherwise, so batch shells never needed the pgid).

Once an oils release includes it: rebuild the bundled binary and bump MACOS_BINARY_DOWNLOADS in crates/fspy/build.rs.

Verification of the fix

Patched 0.37.0 tarball build (same one-liner in the generated C++): 2000 concurrent runs of the failing shapes, 0 failures (vs ~5% before); smoke script output byte-identical to the unpatched binary.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read crates/fspy/build.rs and locate MACOS_BINARY_DOWNLOADS; first confirm an Oils release containing upstream PR #2689, then rebuild the bundled macOS binary. Run the parallel fast-command reproduction and smoke script, checking for no failures and byte-identical smoke output.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, rust, shell
Domain
build-system, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.