reactiflux / discord-irc

Connects Discord and IRC channels by sending messages back and forth.
MIT License
1.2k stars 293 forks source link

IRC Bot reconnects too incessantly #210

Closed gdude2002 closed 7 years ago

gdude2002 commented 7 years ago

This seems to be an issue with node's irc module, but I was hoping we might be able to mitigate it.

Last night, I set up this bot on a public IRC net, it was running fine for a few hours, and I went to bed.

In the morning, I noticed that it was offline, and the console output showed that it was k-lined. In talking to one of the opers, I learned the following:

This is obviously a pretty big problem since getting servers banned from networks is never a good thing.


The console output is kind of sparse, but I do have the following (with nicks/addresses redacted, of course):

<user>@<host>:~/irc$ discord-irc --config config.json
info: Connected to Discord
info: Connected to IRC
info: Connected to IRC
info: Connected to IRC
info: Connected to IRC
error: Received error event from IRC prefix=<server>, server=<server>, command=err_yourebannedcreep, rawCommand=465, commandType=error, args=[<nick>3, You are banned from this server- Temporary K-line 60 min. - [#9078] Connection limit exceeded. (2017/4/2 04.09)]
error: Received error event from IRC prefix=<server>, server=<server>, command=err_yourebannedcreep, rawCommand=465, commandType=error, args=[<nick>, You are banned from this server- Temporary K-line 60 min. - [#9078] Connection limit exceeded. (2017/4/2 02.09)]
error: Received error event from IRC prefix=<server>, server=<server>, command=err_yourebannedcreep, rawCommand=465, commandType=error, args=[<nick>, You are banned from this server- Temporary K-line 60 min. - [#9078] Connection limit exceeded. (2017/4/2 02.09)]
error: Received error event from IRC prefix=<server>, server=<server>, command=err_yourebannedcreep, rawCommand=465, commandType=error, args=[<nick>, You are banned from this server- Temporary K-line 60 min. - [#9078] Connection limit exceeded. (2017/4/2 02.09)]
error: Received error event from IRC prefix=<server>, server=<server>, command=err_yourebannedcreep, rawCommand=465, commandType=error, args=[<nick>, You are banned from this server- Temporary K-line 60 min. - [#9078] Connection limit exceeded. (2017/4/2 02.09)]
error: Received error event from IRC prefix=<server>, server=<server>, command=err_yourebannedcreep, rawCommand=465, commandType=error, args=[<nick>, You are banned from this server- Temporary K-line 60 min. - [#9078] Connection limit exceeded. (2017/4/1 22.09)]
error: Received error event from IRC prefix=<server>, server=<server>, command=err_yourebannedcreep, rawCommand=465, commandType=error, args=[<nick>, You are banned from this server- Temporary K-line 60 min. - [#9078] Connection limit exceeded. (2017/4/2 02.09)]
error: Received error event from IRC prefix=<server>, server=<server>, command=err_yourebannedcreep, rawCommand=465, commandType=error, args=[<nick>, You are banned from this server- Temporary K-line 60 min. - [#9078] Connection limit exceeded. (2017/4/2 02.09)]

Here's my configuration.

[
  {
    "nickname": "<nick>",
    "server": "<server>",
    "discordToken": "<bot token>",
    "autoSendCommands": [ // Commands that will be sent on connect
      ["PRIVMSG", "NickServ", "IDENTIFY <password>"]
    ],
    "channelMapping": { // Maps each Discord-channel to an IRC-channel, used to direct messages to the correct place
      "#irc": "#<channel>" // Add channel keys after the channel name
    },
    "ircOptions": { // Optional node-irc options
      "floodProtection": true, // On by default
      "floodProtectionDelay": 500 // 500 by default
    },
    "ircNickColor": true, // Gives usernames a color in IRC for better readability (on by default)
    // Makes the bot hide the username prefix for messages that start
    // with one of these characters (commands):
    "commandCharacters": ["!", ".", "?"],
    "ircStatusNotices": true // Enables notifications in Discord when people join/part in the relevant IRC channel
  }
]
Throne3d commented 7 years ago

Is this still a problem? I've taken over maintenance of the upstream library in a fork, here but I haven't noticed this behavior while using discord-irc before.

gdude2002 commented 7 years ago

It's a lot more stable than it used to be, but it does suffer the occasional breakage still.

I have to attribute this to connecting through a ZNC bouncer to be honest (How I worked around my original issue) - although it's been a lot more stable since I moved it to another machine a couple weeks ago, moving to the bouncer improved its performance quite a bit.

A lot of people I've talked to in the meantime seem pretty happy to attribute the issues to node-irc. Apparently it's quite infamous in some circles!

Throne3d commented 7 years ago

It seems like it gets maintenance every so often and then loses it for months, and like there are a few major issues that they don't address very timely (hence me deciding to take it over). I've made some positive progress at removing the major issues, I think – a few crashes, some weird behavior around long Unicode messages, fixing up some of the events to give more accurate data (such as quit, giving an accurate list of channels), plus a few other things which you can see here if you're curious.

If it's improved by using a bouncer and a different device I'd expect it to be an internet connectivity issue of some kind. Do you have another IRC client running from the same device, one you could use to tell if your connection is dropping or if it's due to this library specifically? As far as I know these don't handle connection loss very gracefully at present (which could be improved on, but probably only so much).

gdude2002 commented 7 years ago

Yeah, seems to be a problem with the Node community at large to be honest - Useful library is written, then appears abandoned for large blocks of time. Kinda weird.

You'd think it was, but given that it was just another machine on the same rack in a datacentre, I'm not 100% sure.. I run HexChat from that machine as well when I'm at work, and it appears to work just fine. No disconnections that I've noticed so far, anyway.

Throne3d commented 7 years ago

That's weird.

Have you tried enabling debug mode (in the ircOptions object in the config), possibly as well as node dev mode itself? (That would be with NODE_ENV=development as an environment variable; I'm not sure if it works on the installed version of discord-irc?) That could give more information about what went wrong to disconnect the bot – if it was, say, a ping timeout that led to it reconnecting, that would be different from if there were some sort of internal error that it for some reason suppressed? I'm not sure, really, sort of grasping at straws here.

gdude2002 commented 7 years ago

Well, I can certainly do that, few more messages in the journal won't hurt anything. I'll let you know if anything interesting pops up!

On 3 Jul 2017 11:09 p.m., "Edward Jones" notifications@github.com wrote:

That's weird.

Have you tried enabling debug mode (in the ircOptions object in the config), possibly as well as node dev mode itself? (That would be with NODE_ENV=development as an environment variable; I'm not sure if it works on the installed version of discord-irc?) That could give more information about what went wrong to disconnect the bot – if it was, say, a ping timeout that led to it reconnecting, that would be different from if there were some sort of internal error that it for some reason suppressed? I'm not sure, really, sort of grasping at straws here.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/reactiflux/discord-irc/issues/210#issuecomment-312741647, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMdeUC-yd8uwYvlc8bCzpOUbD4Jm330ks5sKWaDgaJpZM4Mw0Jh .

gdude2002 commented 7 years ago

Nothing too interesting so far. Just lots of this:

Jul 04 13:38:57 glowstone node[17572]: CyclingPingTimer 0: server silent for too long, let's send a PING
Jul 04 13:38:57 glowstone node[17572]: 4 Jul 13:38:57 - SEND: PING 1107
Jul 04 13:39:12 glowstone node[17572]: CyclingPingTimer 0: server silent for too long, let's send a PING
Jul 04 13:39:12 glowstone node[17572]: 4 Jul 13:39:12 - SEND: PING 1108
Jul 04 13:39:27 glowstone node[17572]: CyclingPingTimer 0: server silent for too long, let's send a PING
Jul 04 13:39:27 glowstone node[17572]: 4 Jul 13:39:27 - SEND: PING 1109
Jul 04 13:39:29 glowstone node[17572]: debug: Received debug event from Discord Sending heartbeat
Jul 04 13:39:29 glowstone node[17572]: debug: Received debug event from Discord Heartbeat acknowledged
Jul 04 13:39:42 glowstone node[17572]: CyclingPingTimer 0: server silent for too long, let's send a PING
Jul 04 13:39:42 glowstone node[17572]: 4 Jul 13:39:42 - SEND: PING 1110
Jul 04 13:39:57 glowstone node[17572]: CyclingPingTimer 0: server silent for too long, let's send a PING
Jul 04 13:39:57 glowstone node[17572]: 4 Jul 13:39:57 - SEND: PING 1111
Jul 04 13:40:11 glowstone node[17572]: debug: Received debug event from Discord Sending heartbeat
Jul 04 13:40:11 glowstone node[17572]: debug: Received debug event from Discord Heartbeat acknowledged
Jul 04 13:40:12 glowstone node[17572]: CyclingPingTimer 0: server silent for too long, let's send a PING
Jul 04 13:40:12 glowstone node[17572]: 4 Jul 13:40:12 - SEND: PING 1112
Jul 04 13:40:27 glowstone node[17572]: CyclingPingTimer 0: server silent for too long, let's send a PING
Jul 04 13:40:27 glowstone node[17572]: 4 Jul 13:40:27 - SEND: PING 1113
Jul 04 13:40:31 glowstone node[17572]: debug: Channel Mapping #updates
Jul 04 13:40:42 glowstone node[17572]: CyclingPingTimer 0: server silent for too long, let's send a PING
Jul 04 13:40:42 glowstone node[17572]: 4 Jul 13:40:42 - SEND: PING 1114
Jul 04 13:40:52 glowstone node[17572]: debug: Received debug event from Discord Sending heartbeat
Jul 04 13:40:52 glowstone node[17572]: debug: Received debug event from Discord Heartbeat acknowledged
Jul 04 13:40:57 glowstone node[17572]: CyclingPingTimer 0: server silent for too long, let's send a PING
Jul 04 13:40:58 glowstone node[17572]: 4 Jul 13:40:57 - SEND: PING 1115
Jul 04 13:41:12 glowstone node[17572]: CyclingPingTimer 0: server silent for too long, let's send a PING
Jul 04 13:41:12 glowstone node[17572]: 4 Jul 13:41:12 - SEND: PING 1116
Jul 04 13:41:27 glowstone node[17572]: CyclingPingTimer 0: server silent for too long, let's send a PING
Jul 04 13:41:27 glowstone node[17572]: 4 Jul 13:41:27 - SEND: PING 1117
Jul 04 13:41:33 glowstone node[17572]: debug: Received debug event from Discord Sending heartbeat
Jul 04 13:41:33 glowstone node[17572]: debug: Received debug event from Discord Heartbeat acknowledged
Jul 04 13:41:42 glowstone node[17572]: CyclingPingTimer 0: server silent for too long, let's send a PING
Jul 04 13:41:42 glowstone node[17572]: 4 Jul 13:41:42 - SEND: PING 1118
Throne3d commented 7 years ago

I agree that it doesn't look interesting yet. The CyclingPingTimer stuff is just to ping the server every so often, I think so you don't get a ping timeout / so it can detect when you do, and I assume the Discord Heartbeat thing is similar. Thanks anyway!

gdude2002 commented 7 years ago

I think this is safe to close - I haven't noticed a single issue since the last comment I've made.