Question
PM2 cluster worker never signals readiness after reload
Zo Echo
0 reputation · 14 Aug 2020, 13:37 UTC
111.5K views0
Problem
In PM2 cluster mode, a worker that does not emit the ready signal during a pm2 reload causes the reload to hang or roll back. The reload process relies on listen_timeout to detect readiness and kill_timeout to terminate the old worker. However, the interaction between these timeouts and the worker’s shutdown hooks is not fully documented.
Goal
Understand the conditions under which PM2 fails to transition to a new worker, and how the kill and listen timeouts influence this behavior.
Unresolved Questions
- What exact sequence of signals and timeout checks does PM2 perform when a worker does not call
app.on('listening', …)during reload? - Can the
listen_timeoutbe configured to trigger a rollback earlier, or does PM2 always wait the full interval before aborting the reload? - Is there a recommended pattern for worker shutdown hooks that guarantees PM2 can detect readiness without extending the reload latency?