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

"An existing connection was forcibly closed by the remote host" results in reconnect attempts multiple times per second #268

Open
rpherbig opened this issue Aug 11, 2024 · 0 comments

Comments

@rpherbig
Copy link

Summary

I've got a discord bot that listens for commands in a channel. For long periods of time it's effectively idle. Most of the time this is fine, after what I presume is an idle timeout the bot is disconnected and reconnects just fine:

[ERROR : websocket @ 2024-08-09 11:14:38.577] The websocket connection has closed: (no information)
[INFO : websocket @ 2024-08-09 11:14:38.578] Instant reconnection flag was set - reconnecting right away
[INFO : websocket @ 2024-08-09 11:14:39.227] Resumed

However, sometimes I get behavior like this:

[INFO : websocket @ 2024-08-09 11:14:38.578] Instant reconnection flag was set - reconnecting right away
[INFO : websocket @ 2024-08-09 11:14:39.227] Resumed
[ERROR : websocket @ 2024-08-09 13:32:56.592] The websocket connection has closed: (no information)
[INFO : websocket @ 2024-08-09 13:32:56.592] Instant reconnection flag was set - reconnecting right away
[INFO : websocket @ 2024-08-09 13:32:57.299] Resumed
[ERROR : websocket @ 2024-08-09 14:04:09.399] An error occurred in the main websocket loop!
[ERROR : websocket @ 2024-08-09 14:04:09.399] Exception: #<Errno::ECONNRESET: An existing connection was forcibly closed by the remote host.>
[ERROR : websocket @ 2024-08-09 14:04:09.400] C:/Ruby32-x64/lib/ruby/3.2.0/openssl/buffering.rb:157:in `sysread'
[ERROR : websocket @ 2024-08-09 14:04:09.401] C:/Ruby32-x64/lib/ruby/3.2.0/openssl/buffering.rb:157:in `readpartial'
[ERROR : websocket @ 2024-08-09 14:04:09.402] C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/discordrb-3.5.0/lib/discordrb/gateway.rb:602:in `websocket_loop'
[ERROR : websocket @ 2024-08-09 14:04:09.403] C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/discordrb-3.5.0/lib/discordrb/gateway.rb:579:in `connect'
[ERROR : websocket @ 2024-08-09 14:04:09.404] C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/discordrb-3.5.0/lib/discordrb/gateway.rb:473:in `block in connect_loop'
[ERROR : websocket @ 2024-08-09 14:04:09.408] C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/discordrb-3.5.0/lib/discordrb/gateway.rb:472:in `loop'
[ERROR : websocket @ 2024-08-09 14:04:09.409] C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/discordrb-3.5.0/lib/discordrb/gateway.rb:472:in `connect_loop'
[ERROR : websocket @ 2024-08-09 14:04:09.410] C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/discordrb-3.5.0/lib/discordrb/gateway.rb:168:in `block in run_async'
[ERROR : websocket @ 2024-08-09 14:04:09.412] An error occurred in the main websocket loop!
[ERROR : websocket @ 2024-08-09 14:04:09.413] Exception: #<Errno::ECONNRESET: An existing connection was forcibly closed by the remote host.>
[ERROR : websocket @ 2024-08-09 14:04:09.414] C:/Ruby32-x64/lib/ruby/3.2.0/openssl/buffering.rb:157:in `sysread'
[ERROR : websocket @ 2024-08-09 14:04:09.416] C:/Ruby32-x64/lib/ruby/3.2.0/openssl/buffering.rb:157:in `readpartial'
[ERROR : websocket @ 2024-08-09 14:04:09.417] C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/discordrb-3.5.0/lib/discordrb/gateway.rb:602:in `websocket_loop'
[ERROR : websocket @ 2024-08-09 14:04:09.419] C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/discordrb-3.5.0/lib/discordrb/gateway.rb:579:in `connect'
[ERROR : websocket @ 2024-08-09 14:04:09.420] C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/discordrb-3.5.0/lib/discordrb/gateway.rb:473:in `block in connect_loop'
[ERROR : websocket @ 2024-08-09 14:04:09.421] C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/discordrb-3.5.0/lib/discordrb/gateway.rb:472:in `loop'
[ERROR : websocket @ 2024-08-09 14:04:09.422] C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/discordrb-3.5.0/lib/discordrb/gateway.rb:472:in `connect_loop'
[ERROR : websocket @ 2024-08-09 14:04:09.424] C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/discordrb-3.5.0/lib/discordrb/gateway.rb:168:in `block in run_async'
[ERROR : websocket @ 2024-08-09 14:04:09.426] An error occurred in the main websocket loop!
[ERROR : websocket @ 2024-08-09 14:04:09.426] Exception: #<Errno::ECONNRESET: An existing connection was forcibly closed by the remote host.>
[ERROR : websocket @ 2024-08-09 14:04:09.427] C:/Ruby32-x64/lib/ruby/3.2.0/openssl/buffering.rb:157:in `sysread'
[ERROR : websocket @ 2024-08-09 14:04:09.427] C:/Ruby32-x64/lib/ruby/3.2.0/openssl/buffering.rb:157:in `readpartial'
[ERROR : websocket @ 2024-08-09 14:04:09.428] C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/discordrb-3.5.0/lib/discordrb/gateway.rb:602:in `websocket_loop'
[ERROR : websocket @ 2024-08-09 14:04:09.429] C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/discordrb-3.5.0/lib/discordrb/gateway.rb:579:in `connect'
[ERROR : websocket @ 2024-08-09 14:04:09.432] C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/discordrb-3.5.0/lib/discordrb/gateway.rb:473:in `block in connect_loop'
[ERROR : websocket @ 2024-08-09 14:04:09.434] C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/discordrb-3.5.0/lib/discordrb/gateway.rb:472:in `loop'
[ERROR : websocket @ 2024-08-09 14:04:09.435] C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/discordrb-3.5.0/lib/discordrb/gateway.rb:472:in `connect_loop'
[ERROR : websocket @ 2024-08-09 14:04:09.436] C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/discordrb-3.5.0/lib/discordrb/gateway.rb:168:in `block in run_async'

and the exception repeats every few milliseconds


Environment

Ruby version:

PS C:\...> ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mingw-ucrt]

Discordrb version:

PS C:\...> gem list discordrb

*** LOCAL GEMS ***

discordrb (3.5.0)
discordrb-webhooks (3.5.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant