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.
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.