Skip to content

fix: dispose RPC session and ping timer so CI exits after reporting#137

Merged
veksen merged 1 commit into
mainfrom
veksen/fix-ci-hang-dispose-rpc
May 15, 2026
Merged

fix: dispose RPC session and ping timer so CI exits after reporting#137
veksen merged 1 commit into
mainfrom
veksen/fix-ci-hang-dispose-rpc

Conversation

@veksen
Copy link
Copy Markdown
Member

@veksen veksen commented May 15, 2026

Summary

  • The analyzer's CI job hung after "Generating report (GitHub)" because the WebSocket RPC stub and the 30s ping `setInterval` opened by `ApiClient.connect` kept the Node event loop alive until GitHub's runner timeout fired.
  • `ApiClient.connect` now returns `{ api, dispose }`; `dispose()` clears the ping timer and disposes the (authenticated + unauthenticated) capnweb stubs via `[Symbol.dispose]`.
  • `runInCI` wraps the post-connect flow in `try { … } finally { disposeApi(); }` so cleanup runs even if reporting throws; `connectWithReconnect` also calls `dispose()` on `onRpcBroken` to avoid leaking timers across reconnects.
  • `runOutsideCI` (Docker server path) is untouched and still uses its own SIGTERM/SIGINT shutdown.

Test plan

  • Local repro: run `node --import tsx src/main.ts` with the CI env vars and confirm the process exits within a few seconds of "Generating report (GitHub)" instead of hanging.
  • Site CI: trigger the `analyzer / Analyzer` job against this branch and confirm it completes in well under the runner timeout.

@veksen veksen requested a review from Xetera May 15, 2026 14:05
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query Doctor Analysis

View full run details

2 queries analyzed

2 pre-existing issues

Using assumed statistics (10000000 rows/table). For better results, sync production stats.

ApiClient.connect now returns { api, dispose }; runInCI calls dispose()
in finally so the WebSocket stub and ping setInterval no longer keep the
Node event loop alive after the report is generated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@veksen veksen force-pushed the veksen/fix-ci-hang-dispose-rpc branch from f48c8a0 to 5a88aad Compare May 15, 2026 14:08
@veksen veksen merged commit 262eee5 into main May 15, 2026
6 checks passed
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.

2 participants