nguyenquyhy / DiscordBridge

A Sponge plugin to integrate Minecraft server with a Discord channel
MIT License
31 stars 18 forks source link

10% of the time the Discord doesnt connect on ServerStartup #42

Open Whazaaaaa opened 7 years ago

Whazaaaaa commented 7 years ago

So I've been having this problem since probably day one that in 10% of the times my servers start the Discord Bot just doesnt connect at all. Now a simple /discord reload from ingame or server console makes it go online again but I would like the bot to connect 100% of the times my servers restart.

So this was my latest .log I got from the server that initially didnt startup Discord. I think I got the whole part where all the error/exception happend in this pastebin. http://pastebin.com/XxXdCkmB

Am I doing something wrong or is it something in the plugin itself? Is the bot just faulty? Would love if this could be fixed. Love the plugin, its a great help in communicating with my players keep up the great plugin!

Extra info if needed Minecraft: 1.10.2 SpongeAPI: 5.1.0-SNAPSHOT-428c0b2 SpongeForge: 1.10.2-2202-5.1.0-BETA-2022 Minecraft Forge: 12.18.3.2185 SpongeDiscord: Sponge-Discord-2.2.0-all

nguyenquyhy commented 7 years ago

Please try the latest 2.3.0 version and let me know if you still get this error 😄 .

Whazaaaaa commented 7 years ago

Not sure what you did but now the bot doesnt start every time my server start and I have to do /discord reconnect to fix it.

15.01 18:13:34 [Server] pool-8-thread-1/ERROR [discordbridge]: Cannot connect to Discord! 15.01 18:13:34 [Server] INFO java.lang.IllegalStateException: Socket closed before ready packet was received! 15.01 18:13:34 [Server] INFO at de.btobastian.javacord.ImplDiscordAPI.connectBlocking(ImplDiscordAPI.java:162) ~[ImplDiscordAPI.class:?] 15.01 18:13:34 [Server] INFO at de.btobastian.javacord.ImplDiscordAPI$2.call(ImplDiscordAPI.java:144) ~[ImplDiscordAPI$2.class:?] 15.01 18:13:34 [Server] INFO at de.btobastian.javacord.ImplDiscordAPI$2.call(ImplDiscordAPI.java:141) ~[ImplDiscordAPI$2.class:?] 15.01 18:13:34 [Server] INFO at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_111] 15.01 18:13:34 [Server] INFO at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_111] 15.01 18:13:34 [Server] INFO at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_111] 15.01 18:13:34 [Server] INFO at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111] This is all I got in my log about it.

Do I need to change my configs with the latest version or soemthing?

nguyenquyhy commented 7 years ago

It seems the server got disconnected from Discord immediately after successfully connect. Do you have another Sponge plugin that connect to Discord?

Also, you should not need to change the config.

Whazaaaaa commented 7 years ago

Of my knowledge I have no other plugins that do anything with discord These are the plugins I have on my servers. All of my plugins

Whazaaaaa commented 7 years ago

This is my config if that is of any use I dont use the tokens file at all btw.

{
  "channels": [
    {
      "minecraft": {
        "chatTemplate": "&7<%a> &f%s",
        "attachment": {
          "template": "&3[Attachment]&r",
          "hoverTemplate": "Click to open attachment.",
          "allowLink": true
        },
        "roles": {},
        "mention": {
          "userTemplate": "@%s",
          "roleTemplate": "@%s",
          "everyoneTemplate": "&6@%s",
          "channelTemplate": "&9#%s"
        }
      },
      "discordId": "MYDISCORDID",
      "discord": {
        "serverUpMessage": "Server has started.",
        "serverDownMessage": "Server has stopped.",
        "publicChat": {
          "authenticatedChatTemplate": "%s",
          "anonymousChatTemplate": "`<%a>` %s"
        },
        "broadcastTemplate": "_<BROADCAST> %s_"
      }
    }
  ],
  "tokenStore": "JSON",
  "botToken": "MYBOTTOKEN",
  "minecraftBroadcastTemplate": "&2<BROADCAST> %s",
  "botDiscordGame": "",
  "ignoreBots": false,
  "prefixBlacklist": []
}
Whazaaaaa commented 7 years ago

This is still a issue btw

27.01 17:09:55 [Server] Server thread/INFO [nucleus]: Whazaaaaa ran the command: /discord reconnect
27.01 17:09:55 [Server] Server thread/INFO [discordbridge]: Configuration loaded.
27.01 17:09:55 [Server] Server thread/INFO [discordbridge]: Use JSON storage.
27.01 17:09:55 [Server] Server thread/INFO [discordbridge]: Logging in to bot Discord account...
27.01 17:09:58 [Server] pool-19-thread-1/ERROR [discordbridge]: Cannot connect to Discord!
27.01 17:09:58 [Server] INFO java.lang.IllegalStateException: Socket closed before ready packet was received!
27.01 17:09:58 [Server] INFO at de.btobastian.javacord.ImplDiscordAPI.connectBlocking(ImplDiscordAPI.java:162) ~[ImplDiscordAPI.class:?]
27.01 17:09:58 [Server] INFO at de.btobastian.javacord.ImplDiscordAPI$2.call(ImplDiscordAPI.java:144) ~[ImplDiscordAPI$2.class:?]
27.01 17:09:58 [Server] INFO at de.btobastian.javacord.ImplDiscordAPI$2.call(ImplDiscordAPI.java:141) ~[ImplDiscordAPI$2.class:?]
27.01 17:09:58 [Server] INFO at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_111]
27.01 17:09:58 [Server] INFO at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_111]
27.01 17:09:58 [Server] INFO at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_111]
27.01 17:09:58 [Server] INFO at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]

Is this somethin with my bot that is going wrong or is it something on the plugin side?

Tencao commented 7 years ago

Would further like to confirm this issue myself, same error

Whazaaaaa commented 7 years ago

Hello,

This is still an issue in version 2.4.0 and its not 10% anymore its gone up to about 80% of the time the bot doesnt connect. (I am using the bot on 6 servers at the same time if that could be a problem.)

16.03 09:44:44 [Server] pool-13-thread-1/ERROR [discordbridge]: Cannot connect to Discord!
16.03 09:44:44 [Server] INFO java.lang.IllegalStateException: Socket closed before ready packet was received!
16.03 09:44:44 [Server] INFO at de.btobastian.javacord.ImplDiscordAPI.connectBlocking(ImplDiscordAPI.java:162) ~[ImplDiscordAPI.class:?]
16.03 09:44:44 [Server] INFO at de.btobastian.javacord.ImplDiscordAPI$2.call(ImplDiscordAPI.java:144) ~[ImplDiscordAPI$2.class:?]
16.03 09:44:44 [Server] INFO at de.btobastian.javacord.ImplDiscordAPI$2.call(ImplDiscordAPI.java:141) ~[ImplDiscordAPI$2.class:?]
16.03 09:44:44 [Server] INFO at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_111]
16.03 09:44:44 [Server] INFO at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_111]
16.03 09:44:44 [Server] INFO at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_111]
16.03 09:44:44 [Server] INFO at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]

I love this plugin so much but now even /discord reconnect seems to not work alot aswell.

Yorkforce commented 7 years ago

We are having the same problem, bot is running on 2 servers.

Even /discord reconnect is starting to have issues, sometimes it works sometimes it throw the error in console.

[13:12:12] [Server thread/INFO] [nucleus/]: Server ran the command: /discord reconnect
[13:12:12] [Server thread/INFO] [discordbridge/]: Configuration loaded.
[13:12:12] [Server thread/INFO] [discordbridge/]: Use JSON storage.
[13:12:12] [Server thread/INFO] [discordbridge/]: Logging in to bot Discord account...
[13:12:12] [pool-19-thread-1/DEBUG] [de.btobastian.javacord.ImplDiscordAPI/]: Checking token ************************************************************x9Q
[13:12:12] [pool-19-thread-1/DEBUG] [de.btobastian.javacord.ImplDiscordAPI/]: Checked token ************************************************************x9Q (valid: true)
[13:12:12] [pool-19-thread-1/DEBUG] [de.btobastian.javacord.ImplDiscordAPI/]: Requesting gateway (token: ************************************************************x9Q)
[13:12:12] [pool-19-thread-1/DEBUG] [de.btobastian.javacord.ImplDiscordAPI/]: Requested gateway wss://gateway.discord.gg (token: ************************************************************x9Q)
[13:12:13] [ReadingThread/DEBUG] [de.btobastian.javacord.utils.DiscordWebsocketAdapter/]: Sending identify packet
[13:12:13] [ReadingThread/DEBUG] [de.btobastian.javacord.utils.DiscordWebsocketAdapter/]: Received HELLO packet
[13:12:13] [Timer-3/DEBUG] [de.btobastian.javacord.utils.DiscordWebsocketAdapter/]: Sent heartbeat (interval: 41250)
[13:12:13] [ReadingThread/DEBUG] [de.btobastian.javacord.utils.DiscordWebsocketAdapter/]: Received READY packet
[13:12:15] [WritingThread/DEBUG] [de.btobastian.javacord.utils.DiscordWebsocketAdapter/]: Websocket closed! Trying to resume connection.
[13:12:15] [pool-19-thread-1/ERROR] [discordbridge/]: Cannot connect to Discord!
java.lang.IllegalStateException: Socket closed before ready packet was received!
    at de.btobastian.javacord.ImplDiscordAPI.connectBlocking(ImplDiscordAPI.java:162) ~[ImplDiscordAPI.class:?]
    at de.btobastian.javacord.ImplDiscordAPI$2.call(ImplDiscordAPI.java:144) ~[ImplDiscordAPI$2.class:?]
    at de.btobastian.javacord.ImplDiscordAPI$2.call(ImplDiscordAPI.java:141) ~[ImplDiscordAPI$2.class:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_66]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_66]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_66]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
Whazaaaaa commented 7 years ago

Any information about this? Its sadly still happening.

Yorkforce commented 7 years ago

Got significantly worse for us too these last 3 days, none of the servers will currently connect after a restart and Sunday and yesterday we had to /discord reconnect around 10-30 times to get it connect, every 4 hours per server. Seems to be better today, it still wont connect on a server restart but the /discord reconnect only needs doing around 2-5 times on average.

I really hope a solution can be found, we have become so reliant on this plugin now lol, it's great for monitoring chat, answering player questions and general staff duties.

patriq commented 7 years ago

Can confirm this is still happening!

Yorkforce commented 7 years ago

Its worse than ever right now, last few days it started happening again, right now we cannot connect 100% of the time. Is this ever going to get fixed? It's been 5 months.

ResqDiver1317 commented 6 years ago

We had not been having issues until a couple days ago then all of the sudden, 2 of our servers quit connecting to our discord and are giving the same errors as above. Both of these servers restart every 12 hours and for the last 5 restarts, they did not connect. I found this thread and saw to try /discord reconnect and I have tried it several times with the same result every time. We are running version 2.5.1

Mohron commented 6 years ago

@ResqDiver1317 there is no v2.5.1

ResqDiver1317 commented 6 years ago

Odd. We are running that version from axle2005's ORE listing. The issues link there brings me here

ResqDiver1317 commented 6 years ago

135f6bd4-a806-427d-9bf0-90fa106539e5

Mohron commented 6 years ago

axel2005's fork should have its own issue tracker as the original developer has nothing to do with the modifications made in his for.

ResqDiver1317 commented 6 years ago

OK yea I found the link to his now. He has a link to the readme.md at the bottom of the ore page that goes to his. Odd that his issue tracker is tucked away down there but the main link on top for "issues" comes to this one.

Mohron commented 6 years ago

@axle2005 I'd recommend that you update your Issues link.

ResqDiver1317 commented 6 years ago

Ok, for curiosity sake (and hoping it was just a bug in Axle's modified version, I swapped out for the latest version of this one and am having the same issue with the connection. Screenshot from Gyazo

ResqDiver1317 commented 6 years ago

Our Spigot server which is using a totally different plugin connects fine, and our Horizons III server which is running Axle's modified version of this is still able to connect, but both of our 1.10.2 modded servers will not connect using either Axle's or this original version.

Mohron commented 6 years ago

@ResqDiver1317 the last official version is no longer usable due to the discord api changes see #78

ResqDiver1317 commented 6 years ago

You sir, are amazing!!