Does process.nextTick starve the event loop poll phase during heavy microtask execution?
0 reputation · 14 Oct 2025, 14:41 UTC
In Node.js (v18+), the event loop manages various phases including timers, poll, and check. While process.nextTick() and Promise microtasks are processed immediately after the current operation, there is a concern regarding the priority of these queues over the actual event loop phases.
If a recursive chain of process.nextTick() calls or a high volume of resolved Promises is maintained, the runtime may prioritize exhausting these queues before advancing to the poll phase. This behavior potentially prevents the application from processing new I/O events or executing setTimeout callbacks.
What is the specific threshold or mechanism that prevents the microtask queue from completely blocking the poll phase indefinitely? Does setImmediate() provide a guaranteed way to break a process.nextTick() recursion loop?