-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Problem
Session listen routine shutdown at a random point after reconnecting, which causes the bot to go offline.
Information
{"level":"info","time":"2025-02-20T22:38:53.563828089Z","session":"3857a104cdfd6f67916ac62cd8fe5394","message":"reconnecting session due to Opcode 7 Reconnect"}
{"level":"info","time":"2025-02-20T22:38:54.625509618Z","session":"3857a104cdfd6f67916ac62cd8fe5394","client":"948649712649662524","message":"connecting session"}
{"level":"info","time":"2025-02-20T22:38:54.714353538Z","session":"3857a104cdfd6f67916ac62cd8fe5394","message":"received Resumed event"}
{"level":"info","time":"2025-02-20T23:17:38.520428786Z","session":"3857a104cdfd6f67916ac62cd8fe5394","message":"closed listen routine"}This log is not copied and pasted as-is.
Here is the behavior after the listen routine shuts down.
{"level":"info","time":"2025-02-20T23:18:06.012564258Z","session":"3857a104cdfd6f67916ac62cd8fe5394","message":"queued heartbeat"}
{"level":"info","time":"2025-02-20T23:18:47.262763072Z","session":"3857a104cdfd6f67916ac62cd8fe5394","message":"queued heartbeat"}
{"level":"info","time":"2025-02-20T23:19:28.513469149Z","session":"3857a104cdfd6f67916ac62cd8fe5394","message":"queued heartbeat"}This behavior shows the pulse attempting to queue heartbeats, but cannot hear anything back since there is no listen routine. So, the bot goes offline on Discord as the bot doesn't beat.
The bot should also shutdown when a routine returns an error, which also cancels the the context. So, context isn't closed but listen returns nil.
What could cause a listen routine to go down?
Here are some things.
New refactor involves context changes.
-- context: https://github.com/switchupcb/disgo/blob/v10/wrapper/session_routine_manager.go#L180
-- context: https://github.com/switchupcb/disgo/blob/v10/wrapper/session_routine_manager_actions.go#L83
Reproducing the issue before any changes are made.