node.js:134 throw e; // process.nextTick error, or 'error' event on first tick ^ Error: ECONNRESET, Connection reset by peer at Socket._readImpl (net.js:163:14) at Socket._onReadable (net.js:631:22) at IOWatcher.onReada

352 views
Skip to first unread message

gotrich

unread,
Apr 21, 2011, 1:57:08 AM4/21/11
to nodejs
I've got a basic app, reading/writing to the filesystem, and to mysql
(using the mysql npm).

Any ideas why I'm getting this exception? Connection reset on a
socket.

I'm not aware that I'm using sockets anywhere ;-)

Rich

gotrich

unread,
Apr 21, 2011, 2:21:17 AM4/21/11
to nodejs

/nevermind. looks like it's the database connection timing out under
significant load.

anyway with the mysql library (felixge) to increase the timeout, or
catch this error and retry?

thnks
rich

dhruvbird

unread,
Apr 22, 2011, 12:43:05 AM4/22/11
to nodejs
Hello Rich,
It depends on the library entirely. For example, the HTTP server
that ships with node will throw an exception if you don't have an
'error' event handler attached. If you are not catching the
'uncaughtException' on the process object, then it will crash node
(you should generally not catch that exception and continue running
the app unless you know what you are doing).
I would expect all libraries to use events with similar or the same
conventions, so I would *expect* the mysql library to not throw an
exception if you have an 'error' handler attached. Having said that, I
know for a fact that node_redis tries to reconnect on failure and even
buffers your commands for you. All these libraries need better
documentation as far as such behaviour is concerned.

Regards,
-Dhruv.

gotrich

unread,
Apr 22, 2011, 4:53:53 PM4/22/11
to nodejs
Thanks, yeah, I'm catching uncaughtException, just curious if there
was a better way

Rich
Reply all
Reply to author
Forward
0 new messages