Skip to content

fix(run): prevent stdio pipe buffer deadlock in dashboard mode#171

Open
A9G-Data-Droid wants to merge 1 commit into
LarsCowe:mainfrom
A9G-Data-Droid:#170-bmalph-run-can-hang-if-output-exceeds-pipe-buffer-
Open

fix(run): prevent stdio pipe buffer deadlock in dashboard mode#171
A9G-Data-Droid wants to merge 1 commit into
LarsCowe:mainfrom
A9G-Data-Droid:#170-bmalph-run-can-hang-if-output-exceeds-pipe-buffer-

Conversation

@A9G-Data-Droid
Copy link
Copy Markdown

Summary

  • spawnRalphLoop() spawned ralph_loop.sh with stdio: ["ignore", "pipe", "pipe"] but never attached data listeners, so the kernel pipe buffers filled after ~64 KiB of output (~10–30 min of runtime) and blocked bash's next write forever.
  • Fix: change the non-inherit case to ["ignore", "ignore", "ignore"] — the dashboard reads all state from files already, so no output is lost.
  • Also fixes swarm mode, which always spawns with inheritStdio: false.

Closes #170

Changes

  • src/run/ralph-process.ts — one-line stdio fix in spawnRalphLoop()
  • tests/run/ralph-process.test.ts — updated assertion + added detach null-guard regression test

Test plan

  • tests/run/ralph-process.test.ts — 39/39 pass
  • Full unit suite — 1816/1816 pass (20 pre-existing failures in tests/cli.test.ts unrelated to this change)
  • Manual: run bmalph run for 10+ minutes and confirm loop does not freeze

`src/run/ralph-process.ts:216`
- changed ["ignore", "pipe", "pipe"] to ["ignore", "ignore", "ignore"].
- When the dashboard is active, stdout/stderr were piped but never drained; after ~64KiB accumulated the kernel blocked bash's next write indefinitely.
- Switching to "ignore" eliminates the pipes entirely — the dashboard reads everything from files already, so nothing is lost.
- The detach() method's if (child.stdout) guards were already correct for this case.

`tests/run/ralph-process.test.ts`
 - updated the existing stdio assertion
 - added "detach does not throw when stdout/stderr are null (ignore stdio mode)" to make the guard's intent explicit and prevent regression.
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.

bmalph run can hang if output exceeds pipe buffer

1 participant