Closed trwnh closed 2 years ago
For clarification, under what conditions does number 2 occur?
1 happens under unclear conditions 2 occurs when an automatic voice server update happens, I think. 3 happens when a manual voice server update happens.
I've identified the cause to be introduced in #1273. I'll make a PR soon to fix the issue.
Summary
I have a Discord bot that joins a voice channel and performs tasks such as playing music. Occasionally it will leave and rejoin on its own, but sometimes it will leave and not rejoin.
Reproduction Steps
Option A:
1) Summon the bot using the join command 1) Wait for a random voice server update from Discord while voice channel region is set to "Automatic"
Option B:
1) Summon the bot using the join command 1) Manually change the voice channel region (possibly a few times, possibly region-dependent?)
Minimal Reproducible Code
app.py:
music.py:
Expected Results
Voice client should gracefully handle voice server updates
Actual Results
Voice client sometimes does not reconnect
Intents
See reproducible code / app.py
System Information
Checklist
Additional Context
Logs: https://gist.github.com/trwnh/db000f367aac8bf79e36f0604675ccf5
1) I have not been able to observe this myself, but apparently sometimes the bot will appear to go offline despite it still running. problem1.log is a 10-minute segment of logs in which this supposedly happened.
2) Websocket can be observed to close with code 1006 after aiohttp sends CLOSED code 257. Pycord is unable to connect to voice even after retrying, likely due to the closed websocket. problem2.log should contain relevant lines, although more important ones are replicated below.
3) problem3.log contains the tail end of a session in which only the following actions occurred:
In this case, the codes observed are aiohttp WS CLOSING 256 and Websocket closed with error 4000, and later we can see the same CLOSED 257 / code 1000 behavior.