Skip to content

fix: prevent SSH timeout stacking in MirrorSQL#189

Open
jakebromberg wants to merge 2 commits intomainfrom
fix/36-ssh-timeout-stacking
Open

fix: prevent SSH timeout stacking in MirrorSQL#189
jakebromberg wants to merge 2 commits intomainfrom
fix/36-ssh-timeout-stacking

Conversation

@jakebromberg
Copy link
Member

@jakebromberg jakebromberg commented Feb 21, 2026

Summary

  • Each sshInstance() call in MirrorSQL created a new 5-minute setTimeout without clearing the previous one, causing dangling timeouts to stack on rapid repeated calls.
  • Stores the timeout handle as a static class property and calls clearTimeout on the existing handle before setting a new one.
  • Adds unit tests verifying only one timeout is active after multiple calls, and that superseded timeouts don't trigger premature disposal.

Test plan

  • New test: tests/unit/middleware/legacy/ssh-timeout.test.ts — confirms clearTimeout is called on prior handles and that only the latest timeout fires dispose().
  • Tests fail before fix, pass after fix.
  • Existing unit tests still pass (npm run test:unit).

Fixes #36

Made with Cursor

Each sshInstance() call added a new 5-minute timeout without clearing
the previous one, stacking dangling timeouts on rapid repeated calls.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jakebromberg jakebromberg force-pushed the fix/36-ssh-timeout-stacking branch from 9d80d0c to 3c6f4f4 Compare February 27, 2026 05:56
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.

1 participant