Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging stray uncaught exceptions (ECONNRESET) in a node cluster

In my node.js app which uses the cluster module, I'm intermittently seeing errors like this:

events.js:71
        throw er; // Unhandled 'error' event
              ^
Error: read ECONNRESET
    at errnoException (net.js:863:11)
    at TCP.onread (net.js:524:19)

This brings down my whole app, and so far the only way I've been able to deal with these is by binding a process.on('uncaughtException'). I'd like to figure out the underlying cause, but the above stack trace is pretty useless.

Is there some way to figure out what's causing these exceptions?

I should note that I'm seeing these only in the cluster master, not the workers, which leads me to suspect that they have something to do with the way the cluster modules does its magic in distributing connections to workers.

like image 499
Matt Zukowski Avatar asked Jun 05 '13 21:06

Matt Zukowski


1 Answers

This answer was helpful: https://stackoverflow.com/a/11542134/233370

Basically, I installed longjohn and was then able to get the full async stack trace to figure out the underlying cause (rabbit.js in my case).

like image 110
Matt Zukowski Avatar answered Sep 22 '22 07:09

Matt Zukowski