reactiflux / discord-irc

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

Stops working after an extended period of time #594

Open Joshua-Ashton opened 3 years ago

Joshua-Ashton commented 3 years ago

Hello!

I am using the docker build of this repo with the following docker-compose:

  irc-bridge:
    image: discordirc/discord-irc
    hostname: discordirc.froggi.es
    networks:
      - internal
      - web
    volumes:
      - ./irc-bridge/config.json:/config/config.json
    container_name: irc-bridge
    restart: unless-stopped

which is:

[joshua@pond ~]$ sudo docker images | grep irc
discordirc/discord-irc                latest         6c2387a7f3a7   6 months ago    199MB

and config:

[
  {
    "nickname": "VKx",
    "server": "irc.libera.chat",
    "discordToken": "[redacted]",
    "channelMapping": {
      "#frogbridge": "#frogbridge",
      "#winehackers": "#winehackers"
    },
    "ircOptions": {
      "floodProtection": false,
      "port": "6697",
      "secure": true,
      "sasl": true,
      "username": "VKx",
      "password": "[redacted]"
    },
    "format": {
      "commandPrelude": "Command sent by {$nickname}",
      "ircText": "<{$displayUsername}> {$text}",
      "urlAttachment": "<{$displayUsername}> {$attachmentURL}",
      "discord": "**<{$author}>** {$withMentions}",
      "webhookAvatarURL": "https://robohash.org/{$nickname}?set=set4"
    },
    "parallelPingFix": true,
    "ircStatusNotices": false,
    "webhooks": {
      "#frogbridge": "[redacted]",
      "#winehackers": "[redacted]"
    }
  }
]

and after a while of running, the irc-bridge, it will just stop working, my docker setup should make it restart if it crashes.

[joshua@pond ~]$ sudo docker logs irc-bridge

> discord-irc@2.9.0 start /bot
> node dist/index.js "--config" "/config/config.json"

2021-06-01T21:01:11.950Z info: Connected to IRC
2021-06-01T21:01:12.038Z info: Connected to Discord
(node:25) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
    at RequestHandler.execute (/bot/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:25) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:25) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:25) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
    at RequestHandler.execute (/bot/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:25) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:25) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
    at RequestHandler.execute (/bot/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:25) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:25) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
    at RequestHandler.execute (/bot/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:25) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)

> discord-irc@2.9.0 start /bot
> node dist/index.js "--config" "/config/config.json"

2021-06-01T21:49:26.297Z info: Connected to Discord
2021-06-01T21:49:26.439Z info: Connected to IRC

> discord-irc@2.9.0 start /bot
> node dist/index.js "--config" "/config/config.json"

2021-06-02T12:00:05.905Z info: Connected to Discord
2021-06-02T12:00:06.415Z info: Connected to IRC

> discord-irc@2.9.0 start /bot
> node dist/index.js "--config" "/config/config.json"

2021-06-04T18:40:15.214Z info: Connected to Discord
2021-06-04T18:40:15.841Z info: Connected to IRC
2021-06-04T19:35:07.797Z error: request to [redacted]?wait=true failed, reason: read ETIMEDOUT
2021-06-04T19:35:33.853Z info: Connected to IRC
2021-06-04T20:05:31.924Z info: Connected to IRC
2021-06-04T21:15:38.922Z info: Connected to IRC
2021-06-04T22:32:50.754Z info: Connected to IRC
2021-06-05T00:44:27.746Z info: Connected to IRC

> discord-irc@2.9.0 start /bot
> node dist/index.js "--config" "/config/config.json"

2021-06-06T04:01:45.229Z info: Connected to Discord
2021-06-06T04:01:45.402Z info: Connected to IRC

This log spam always seems to occur, then it will stop working at all. It will no longer be present on the IRC server also.

Sorry for the lack of specific info... I don't super know what you would need to help me debug or diagnose this problem.

The missing permission stuff is weird, but I don't see why it'd work for a day or two then just suddenly start having random missing permissions stop it from working...

Thanks for your time!

Joshua-Ashton commented 3 years ago

This seems to happen whenever my internet goes down and then it never tries to reconnect or restart.

Joshua-Ashton commented 3 years ago

The solution was to set "retryCount": null in my config.

This defaulting to 10 and then not working forever again is pretty silly. Can this be changed? It also isn't documented anywhere.

Joshua-Ashton commented 3 years ago

Nevermind, that still doesn't fix it, it just randomly dies after some point and never reconnnects even with that.