Skip to content

QuizNot attempted

Starving the event loop

Which can freeze a Node server for ALL users?

Select all that apply.

1–4 to choose, Enter to submit
Show answer & explanation

Correct answers:

  • JSON.parse on a 50MB string, or a CPU-heavy loop in a request handler or Server Component
  • A recursive process.nextTick chain that never ends
  • Node runs your JS on one thread, so synchronous CPU work (JSON.parse of 50MB, a heavy loop) blocks every request, and a never-ending process.nextTick chain starves the loop because the nextTick queue is drained before any phase can run.
  • Not awaiting a slow query: the await yields, and the loop serves others meanwhile.
  • Not many requests waiting on the network: waiting on I/O is non-blocking.
  • Offload CPU work to worker_threads, a queue, or another service.