concurrency-scalingAnswer last reviewed July 2026

You've got long-running workers that crash sometimes. How do you supervise them so a crash doesn't take the service down, but you also don't end up restart-looping forever?

A strong answer builds supervision in layers, heartbeats beyond exit events, backoff under a budget, and a plan for the task the dead worker was holding.

What an AI-prepared candidate might say

You listen for the worker's exit and error events, log whatever happened, and start a replacement. To avoid a tight crash loop you add exponential backoff between restarts and cap the number of attempts, and past the cap you alert instead of respawning. You read the exit code to tell a clean exit from a crash. And the restart logic stays outside the worker itself, so a broken worker can't break its own recovery. Health checks or heartbeat messages catch the workers that hang without actually dying. Then at the outer layer, a process manager like systemd or PM2 or the orchestrator supervises the parent the same way. The goal is basically automatic recovery from transient failures, containing the repeated ones, and enough logging to figure out what killed the worker.

Senior
Locked

Reading exit codes and signals properly, heartbeats for the worker that's wedged but alive, backoff with a restart budget, and deciding what happens to in-flight tasks.

Unlock the depth
Staff
Locked

Supervision layered with escalation, MTBF trends as your leak detector, poison-task quarantine, and the crash forensics (reports, dmesg, signals) that make restarts explainable.

Unlock the depth
Follow-up chain
You've got long-running workers that crash sometimes. How do you supervise them so a crash doesn't take the service down, but you also don't end up restart-looping forever? | NodeBook