Rust std's Hidden fork Fallback Triggers Revealed
Charlie Marsh notes Rust std usually uses posixspawnp, but preexec callbacks and macOS relative paths force a fallback to fork + exec.
2026-11-25 ~ 2026-11-25 · 14 related posts
- Codex cuts process spawn time 800x to 0.25ms via direct posix_spawn — charliermarsh · 2026-11-25
- Codex made process spawning 800x faster by ditching fork+exec for posix_spawn — charliermarsh · 2026-11-25
- Codex used to clone its entire app server just to run `ls` — charliermarsh · 2026-11-25
- fork's copy-on-write still copies page tables, slowing big processes — charliermarsh · 2026-11-25
- Codex replaced fork+exec with posix_spawn to kill spawn overhead — charliermarsh · 2026-11-25
- Rust's std usually uses posix_spawnp under the hood — with exceptions — charliermarsh · 2026-11-25
- pre_exec callbacks and macOS relative paths force Rust back to fork — charliermarsh · 2026-11-25
- Codex built its own Rust Command abstraction to stay on posix_spawn — charliermarsh · 2026-11-25
- If pre_exec only calls setsid, just pass posix_spawn's flag instead — charliermarsh · 2026-11-25
- Counterintuitive fix on Linux: an extra exec makes spawning faster — charliermarsh · 2026-11-25
- Codex spawns processes millions of times a week — the fix pays off — charliermarsh · 2026-11-25
- Codex spawn fix: bypass posix_spawnp's PATH search, exec yourself first on Linux — charliermarsh · 2026-11-25
- OpenAI open-sources fix for Codex MCP server spawning reliability on macOS — charliermarsh · 2026-11-25
1 near-duplicate retellings: petrusenko_max