Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reconnect issue #1

Closed
surajkumar opened this issue Mar 29, 2024 · 0 comments · Fixed by #29
Closed

Fix reconnect issue #1

surajkumar opened this issue Mar 29, 2024 · 0 comments · Fixed by #29
Assignees
Labels
bug Something isn't working

Comments

@surajkumar
Copy link
Contributor

surajkumar commented Mar 29, 2024

When we run the bot and there's a disconnct, we have a retry in place to attempt a "resume" with discord.
The way this works is by using an exponential backoff i.e. try again after 2 seconds, then 4, then 8 etc.

Reconnecting in 4000ms [attempt=1]
Reconnecting in 8000ms [attempt=2]
...

This use to work but with all the refactoring, something broke somewhere.

Repro steps:

  1. Start the bot
  2. Disconnect your internet
  3. Reconnect your internet

The following will start spamming in the console:

14:49:06.702 [vert.x-eventloop-thread-0] INFO  com.javadiscord.jdi.internal.gateway.WebSocketRetryHandler - Reconnecting in 8000ms [attempt=2]
14:49:14.919 [vert.x-eventloop-thread-0] INFO  com.javadiscord.jdi.internal.gateway.WebSocketManager - Connected to Discord
14:49:18.738 [vert.x-eventloop-thread-0] INFO  com.javadiscord.jdi.internal.gateway.WebSocketRetryHandler - Reconnecting in 2000ms [attempt=0]
14:49:18.739 [vert.x-eventloop-thread-0] ERROR com.javadiscord.jdi.internal.gateway.WebSocketHandler - [1000] null
14:49:18.824 [vert.x-eventloop-thread-0] INFO  com.javadiscord.jdi.internal.gateway.WebSocketManager - Connected to Discord
14:49:20.935 [vert.x-eventloop-thread-0] INFO  com.javadiscord.jdi.internal.gateway.WebSocketManager - Connected to Discord
14:49:22.159 [vert.x-eventloop-thread-0] INFO  com.javadiscord.jdi.internal.gateway.WebSocketRetryHandler - Reconnecting in 2000ms [attempt=0]
14:49:22.159 [vert.x-eventloop-thread-0] ERROR com.javadiscord.jdi.internal.gateway.WebSocketHandler - [1000] null
14:49:22.241 [vert.x-eventloop-thread-0] INFO  com.javadiscord.jdi.internal.gateway.WebSocketManager - Connected to Discord
14:49:24.345 [vert.x-eventloop-thread-0] INFO  com.javadiscord.jdi.internal.gateway.WebSocketManager - Connected to Discord
14:49:24.665 [vert.x-eventloop-thread-0] INFO  com.javadiscord.jdi.internal.gateway.WebSocketRetryHandler - Reconnecting in 2000ms [attempt=0]
14:49:24.665 [vert.x-eventloop-thread-0] ERROR com.javadiscord.jdi.internal.gateway.WebSocketHandler - [1000] null

Observations
We're reconnecting and resuming our session with discord correctly.
The error string [1000] null comes from WebSocketHandler#frameHandler

Relevant classes that this error is around:

com.javadiscord.jdi.internal.gateway.WebSocketRetryHandler

com.javadiscord.jdi.internal.gateway.WebSocketManager

com.javadiscord.jdi.internal.gateway.WebSocketHandler

Acceptance Criteria

WHEN connected to discord
AND the internet disconnects
THEN we should successfully be connected to discord without any errors showing up

@surajkumar surajkumar moved this to Ready in Java Discord Mar 29, 2024
@surajkumar surajkumar added the bug Something isn't working label Mar 31, 2024
@surajkumar surajkumar moved this from Ready to In progress in Java Discord Apr 1, 2024
@surajkumar surajkumar self-assigned this Apr 1, 2024
@surajkumar surajkumar moved this from In progress to In review in Java Discord Apr 1, 2024
@surajkumar surajkumar linked a pull request Apr 1, 2024 that will close this issue
4 tasks
@github-project-automation github-project-automation bot moved this from In review to Done in Java Discord Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant