Respond to ETIMEDOUT error with a retry #109

wants to merge 1 commit into

5 participants


I've been using node-irc over a wireless network. Almost daily, my bot was getting disconnected with an error with the message:

Error: read ETIMEDOUT

When this happens, node-irc makes no attempt to retry the connection. I've been testing this modification for the past couple of weeks, and this has allowed my bot to reconnect cleanly when this error occurs.

It seems like this error gets fired before or in place of a close event. I'm not sure if this modification is the cleanest way to deal with this issue, but it seems like the smallest change to do so. There may be an entire class of errors that would benefit from a retry attempt, but I don't know of any others.


It does seem slightly odd to be using a regexp to match the error mnemonic. I'll try look at this a bit more closely soon, and if I can't find a better solution then merge this.


I've been experiencing something like this, the bot just dropping off the server without displaying anything at all in the logs. +1


I'm seeing something like this too. In my case, I see on another client that is connected at the time:
mkbot has left freenode (Read error: Connection reset by peer)

where mkbot is the name of my basic logging bot I have that uses node-irc. I have listeners for both error and netError and neither get called and irc-node also makes no attempt to reconnect.


BTW Its hard to find any node documentation but from looking at some testcase in node src, I think exception.code should be set to the name of the error so should be able to do:
if (exception.code == 'ETIMEDOUT')

the names seem to be defined in:


Yeah, I'd rather see this patch not using a regexp on the error message. maks, do you wanna try fixing it up?

@sigkell sigkell closed this May 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment