spawnSync: make signal-forwarding register/unregister safe for concurrent callers #30956
+69
−3
Claude / Claude Code Review
completed
May 23, 2026 in 16m 21s
Code review found 1 potential issue
Found 3 candidates, confirmed 1. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 1 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟡 Nit | src/jsc/bindings/c-bindings.cpp:1019-1023 |
Inner unregister zeros Bun__currentSyncPID before depth guard |
Annotations
Check warning on line 1023 in src/jsc/bindings/c-bindings.cpp
claude / Claude Code Review
Inner unregister zeros Bun__currentSyncPID before depth guard
Minor: `Bun__currentSyncPID = 0;` runs *before* the new lock + `--signalForwardingDepth != 0` early-return, so an inner unregister (e.g. an `openInEditor` thread finishing while a main-thread `spawnSync` is still waiting) zeroes the outer caller's forwarding PID even though the depth guard is meant to make inner calls no-ops. You've already noted `Bun__currentSyncPID` remains a shared singleton, and moving this line below the guard trades a zeroed PID for a potentially stale (reaped) one in the
Loading