Worker: crash-loop on startup when server unreachable; no reconnect backoff #29

Open
opened 2026-09-08 20:57:31 -04:00 by jared · 0 comments
Owner

Overview

worker.start() awaits the first heartbeat; if the server is down the promise rejects and the process calls process.exit(1), so systemd restarts it every 10 s and journals an error each time (e.g. every time the server is redeployed by the webhook). WebSocket reconnects use a fixed 5 s delay with no backoff or jitter, so a fleet reconnects in lock-step.

Suggested fix

Treat the initial heartbeat failure as non-fatal (log and keep the timer running) and use exponential backoff with jitter for both heartbeat and WS reconnect.

## Overview `worker.start()` awaits the first heartbeat; if the server is down the promise rejects and the process calls `process.exit(1)`, so systemd restarts it every 10 s and journals an error each time (e.g. every time the server is redeployed by the webhook). WebSocket reconnects use a fixed 5 s delay with no backoff or jitter, so a fleet reconnects in lock-step. ## Suggested fix Treat the initial heartbeat failure as non-fatal (log and keep the timer running) and use exponential backoff with jitter for both heartbeat and WS reconnect.
jared added the bugworkerpriority/low labels 2026-09-08 20:57:31 -04:00
Sign in to join this conversation.