Identify the primary issue in this Node.js code snippet that attempts to handle signals.
Node.js interview question for Advanced practice.
Answer
The SIGINT handler will never execute because the while(true) loop blocks the event loop.
Explanation
The most significant issue is the while (true) {} loop. This is a synchronous, blocking operation that will run indefinitely, completely starving the Node.js event loop. Because the event loop is blocked, it can never get to the point of processing the incoming SIGINT signal, so the handler will never be called. While option D is also a valid concern in a non-blocking scenario, the blocking loop is the primary reason this specific code fails.