Observed
The #127 service test handshake, version mismatch, framing, containment, registry, and disconnect policy (tests/sessionService.test.ts) fails intermittently under full-suite load with:
Error: ioctl(2) failed, EBADF
Seen repeatedly in local full-suite runs while working on #131 and #197 (roughly 1 in 3 to 5 runs on a heavily loaded machine). Not yet seen in CI. The test passes when run alone.
Likely context (not yet confirmed)
node-pty throws synchronously from pty.resize() when the PTY file descriptor is already closed, for example when a resize reaches a session whose shell has just exited or is being torn down. ShellSession.resize calls this.pty.resize(...) without a guard. The session service handles client resize messages (and its own redraw-nudge resizes on attach) for sessions that can exit concurrently.
Why it matters
If the throw happens inside the long-lived session service rather than a test process, an uncaught exception could take nmshd down along with every live session it owns.
Reproduction
- Run
npm test repeatedly on a loaded machine and watch the handshake test above.
- Or run
node --import=tsx --test tests/sessionService.test.ts in a loop under CPU load.
Next step
Confirm the exact throwing call site, then decide the handling. Not started; deliberately deferred from the #197 work.
Observed
The #127 service test
handshake, version mismatch, framing, containment, registry, and disconnect policy(tests/sessionService.test.ts) fails intermittently under full-suite load with:Seen repeatedly in local full-suite runs while working on #131 and #197 (roughly 1 in 3 to 5 runs on a heavily loaded machine). Not yet seen in CI. The test passes when run alone.
Likely context (not yet confirmed)
node-pty throws synchronously from
pty.resize()when the PTY file descriptor is already closed, for example when a resize reaches a session whose shell has just exited or is being torn down.ShellSession.resizecallsthis.pty.resize(...)without a guard. The session service handles clientresizemessages (and its own redraw-nudge resizes on attach) for sessions that can exit concurrently.Why it matters
If the throw happens inside the long-lived session service rather than a test process, an uncaught exception could take nmshd down along with every live session it owns.
Reproduction
npm testrepeatedly on a loaded machine and watch the handshake test above.node --import=tsx --test tests/sessionService.test.tsin a loop under CPU load.Next step
Confirm the exact throwing call site, then decide the handling. Not started; deliberately deferred from the #197 work.