DAP eventually fails to reconnect
See original GitHub issueHello! I have a minor issue I’d like to report: after several hours left unattended, DAP can fail to stay connected to a voice channel. When this happens, selecting a different voice channel & back didn’t seem to work, or at least not fully: the bot account was in the channel, but audio didn’t go through until a full program restart.
Errors log:
Disconnected from voice... Reconnecting in 1.18s.
Traceback (most recent call last):
File "discord\voice_client.py", line 383, in poll_voice_ws
File "discord\gateway.py", line 889, in poll_event
discord.errors.ConnectionClosed: Shard ID None WebSocket closed with 1006
Attempting a reconnect in 0.61s
Traceback (most recent call last):
File "discord\client.py", line 551, in connect
File "discord\gateway.py", line 578, in poll_event
discord.errors.ConnectionClosed: Shard ID None WebSocket closed with 1000
Attempting a reconnect in 1.14s
Traceback (most recent call last):
File "discord\client.py", line 551, in connect
File "discord\gateway.py", line 578, in poll_event
discord.errors.ConnectionClosed: Shard ID None WebSocket closed with 1000
Attempting a reconnect in 0.87s
Traceback (most recent call last):
File "discord\client.py", line 551, in connect
File "discord\gateway.py", line 578, in poll_event
discord.errors.ConnectionClosed: Shard ID None WebSocket closed with 1000
Disconnected from voice... Reconnecting in 0.41s.
Traceback (most recent call last):
File "discord\voice_client.py", line 383, in poll_voice_ws
File "discord\gateway.py", line 889, in poll_event
discord.errors.ConnectionClosed: Shard ID None WebSocket closed with 1001
I believe part of this failure to auto-reconnect may be witnessed by manually changing a server’s voice region while connected; the “jump” in sessions can then result in these slightly different errors:
Disconnected from voice... Reconnecting in 1.27s.
Traceback (most recent call last):
File "discord\voice_client.py", line 383, in poll_voice_ws
File "discord\gateway.py", line 889, in poll_event
discord.errors.ConnectionClosed: Shard ID None WebSocket closed with 4000
Exception in voice thread Thread-20
Traceback (most recent call last):
File "discord\player.py", line 598, in run
File "discord\player.py", line 591, in _do_run
File "discord\voice_client.py", line 598, in send_audio_packet
TypeError: str, bytes or bytearray expected, not NoneType
Disconnected from voice... Reconnecting in 1.77s.
Traceback (most recent call last):
File "discord\voice_client.py", line 383, in poll_voice_ws
File "discord\gateway.py", line 889, in poll_event
discord.errors.ConnectionClosed: Shard ID None WebSocket closed with 4000
In this specific case, selecting a different voice channel & back worked.
Again, this probably isn’t a very important issue as I reckon this program is mainly aimed at active usage, but if you wanted to look into improving its long-term resiliency, I’d be happy to help try out fixes or improvements.
Cheers! (and by the way, the new UI looks great 😃)
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
The 2.0 exe should have timestamps for errors now. For verbose logging, you’ll have to launch the program from CMD or PowerShell with
.\dap.exe --verbose
, and it will create adiscord.log
in the same dir.I had the same problem this past weekend when running a game, you can see attached all the exceptions that happened. It kept disconnecting quite often, but my internet service provider really sucks so they drop packets now and again. So if this is a persistent connection type thing, might need to write a catch around this and just reconnect automatically because people with bad internet (or using this during peak times on their cable modems when the rest of the neighborhood is using up all the bandwidth) will have the same issues.
https://pastebin.com/HqVhSbhd
Might be only way to test this out, is to disconnect your development machine from the internet while being connected, then connect it up again a few seconds later… since that’s what happens to me, my ISP drops the internet every now and then for just like 3 pings. I keep a dos window open with ping -t google.com and I will drop at least 3 packets every 5 minutes or 10 minutes.