If you look at the beginning of the Node.js documentation for domains it states:
Again in the code example it gives in that first section it says:
Though we’ve prevented abrupt process restarting, we are leaking resources like crazy
I can understand why there could be resource leaks in a non garbage collected language if you throw an exception because then any code you might run to clean up objects wouldn’t run if an exception is thrown.
I’ve Written a blog explaining the answer to this a bit better now. Check it out
Unexpected exceptions are the ones you need to worry about. If you don’t know enough about the state of the app to add handling for a particular exception and manage any necessary state cleanup, then by definition, the state of your app is undefined, and unknowable, and it’s quite possible that there are things hanging around that shouldn’t be. It’s not just memory leaks you have to worry about. Unknown application state can cause unpredictable and unwanted application behavior (like delivering output that’s just wrong — a partially rendered template, or an incomplete calculation result, or worse, a condition where every subsequent output is wrong). That’s why it’s important to exit the process when an unhandled exception occurs. It gives your app the chance to repair itself.
Exceptions happen, and that’s fine. Embrace it. Shut down the process and use something like Forever to detect it and set things back on track. Clusters and domains are great, too. The text you were reading is not a caution against throwing exceptions, or continuing the process when you’ve handled an exception that you were expecting — it’s a caution against keeping the process running when unexpected exceptions occur.