Repository navigation
fix(hub): stop Bun's idle timeout dropping quiet requests - #177
TheGreatAxios merged 1 commit into
Conversation
|
Triage: Pass No changes needed from you. A maintainer will review this pull request. Approve held: code review has 1 finding at P2 or above open on this head. |
| hostname: runtime.hostname, | ||
| port: runtime.port, | ||
| // Bun's 10-second default drops slow routes; the run stream's 5-second heartbeat stays well inside this. | ||
| idleTimeout: 120, |
There was a problem hiding this comment.
P1 · 120s idle timeout still drops hub routes that can stay silent for up to 300s
Bun closes a connection after idleTimeout seconds with no bytes sent. This hub serves POST /api/tenants/:t/workflows/deployments (the route agent-token-bridge.ts matches), and that route sends nothing until it has installed, probed and gated the source. Per the comment in deploy-tools.ts, those stages can take 120s + 120s + 60s, which is why callers allow DEPLOY_TIMEOUT_MS = 300_000. The web client likewise allows 5 minutes per hub call, coordinator deploys included (HUB_REQUEST_CEILING_MS). The vendored Interchange hub uses idleTimeout: 0 for the same routes. With 120, any deploy whose stages take more than about 2 minutes in total gets its socket reset, while the hub keeps working and finishes the deploy.
A workflow or coordinator deploy where sidecar ensure plus connection take more than 120s, e.g. a slow container start, so no response byte goes out within 120s.
Resolve this comment. Triage will not finish while it is open.
Closes CL-12102
The live-app proxy now turns off Bun's idle timeout for each forwarded HTTP request with
server.timeout(request, 0), so the person's app decides how long a response may stay quiet. WebSocket handling is unchanged. The hub'sBun.servenow setsidleTimeout: 120instead of relying on Bun's 10-second default; the run stream's 5-second heartbeat stays well inside it.Verified on Bun 1.4.4 with a standalone script: with the default, a response that sent nothing for 25 seconds (a slow first byte, or a stream that paused mid-response) was reset at about 12 seconds. With
server.timeout(req, 0)oridleTimeout: 120it completed. Lint, format check, typecheck, tests, pins and vendor checks pass.