Skip to content

Identify with disallowed intents doesn't gracefully close the websocket thread #154

@Daniel-Worrall

Description

@Daniel-Worrall

Summary

When running a bot without allowing privileged intents, the thread that sends heartbeats to the gateway doesn't close.

bot.run

[ERROR : websocket @ 2022-04-28 20:20:04.201] The websocket connection has closed: (no information)
[ERROR : websocket @ 2022-04-28 20:20:04.201] Websocket close frame received!
[ERROR : websocket @ 2022-04-28 20:20:04.201] Code: 4014
[ERROR : websocket @ 2022-04-28 20:20:04.201] Message: Disallowed intent(s).
[ERROR : websocket @ 2022-04-28 20:20:04.201] You attempted to identify with privileged intents that your bot is not authorized to use
Please enable the privileged intents on the bot page of your application on the discord developer page.
Read more here https://discord.com/developers/docs/topics/gateway#privileged-intents
[WARN : websocket @ 2022-04-28 20:20:04.201] The WS loop exited! Not sure if this is a good thing
=> #<Thread:0x000056211b580b00 /home/d/git/ruby/discordrb/lib/discordrb/gateway.rb:166 dead>
[ERROR : heartbeat @ 2022-04-28 20:20:45.269] An error occurred while heartbeating!
[ERROR : heartbeat @ 2022-04-28 20:20:45.269] Exception: #<RuntimeError: Tried to send something to the websocket while not being connected!>
[ERROR : heartbeat @ 2022-04-28 20:20:45.269] /home/d/git/ruby/discordrb/lib/discordrb/gateway.rb:831:in `send'
[ERROR : heartbeat @ 2022-04-28 20:20:45.269] /home/d/git/ruby/discordrb/lib/discordrb/gateway.rb:426:in `send_packet'
[ERROR : heartbeat @ 2022-04-28 20:20:45.269] /home/d/git/ruby/discordrb/lib/discordrb/gateway.rb:275:in `send_heartbeat'
[ERROR : heartbeat @ 2022-04-28 20:20:45.269] /home/d/git/ruby/discordrb/lib/discordrb/gateway.rb:268:in `heartbeat'
[ERROR : heartbeat @ 2022-04-28 20:20:45.269] /home/d/git/ruby/discordrb/lib/discordrb/gateway.rb:456:in `block (2 levels) in setup_heartbeats'
[ERROR : heartbeat @ 2022-04-28 20:20:45.269] /home/d/git/ruby/discordrb/lib/discordrb/gateway.rb:450:in `loop'
[ERROR : heartbeat @ 2022-04-28 20:20:45.269] /home/d/git/ruby/discordrb/lib/discordrb/gateway.rb:450:in `block in setup_heartbeats'
[WARN : heartbeat @ 2022-04-28 20:21:26.561] Last heartbeat was not acked, so this is a zombie connection! Reconnecting
... more zombie logs

Environment

Ruby version: ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]

Discordrb version: main, e384e4a

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions