DEV Community

Sadeesh P V
Sadeesh P V

Posted on

Why does my Node.js app not exit automatically after upgrading to version 22 from 16?

We use Node 16 in one of our modules (used nodejs + selenium). This module is responsible for executing dynamic scripts, which are pulled from a central location. With Node 16, the script execution works as expected, and the Node process exits automatically afterward. However, since we upgraded from Node 16 to Node 22, this behaviour has changed. The scripts still execute correctly, but the Node process does not exit automatically after a successful run in some cases (only in the case of few dynamic scripts). I understand that the process terminates only when the event loop is empty. We believe the observed behaviour, where the process does not terminate, is caused by unclosed handles. But, my question is why this issue occurs with Node 22 but not with Node 16.

Top comments (0)