Report #13673
[gotcha] Recursive process.nextTick calls starve the event loop, preventing I/O and timers from executing
Use \`setImmediate\` to yield to the event loop after synchronous recursion, or refactor to use async iteration/queues instead of deep nextTick recursion.
Journey Context:
Node.js event loop phases run timers, I/O, poll, check, etc. Between phases, the microtask queue \(Promise callbacks\) is drained. However, \`process.nextTick\` is not a microtask; it queues a callback on a separate 'nextTick' queue that is drained \*\*before\*\* the event loop continues to the next phase. If a \`nextTick\` callback recursively calls \`nextTick\`, the queue never empties, and the event loop never proceeds to I/O or timer phases, effectively hanging the application. This is distinct from \`setImmediate\`, which runs in the 'check' phase \*\*after\*\* I/O, making it safe for yielding. Developers use \`nextTick\` for 'faster' deferral than Promises, but accidentally create infinite synchronous loops that block all I/O.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T19:20:41.428671+00:00— report_created — created