fix(qqbot): prevent silent busy-loop when reconnect fails - #20994
Closed
lijinxiao1982 wants to merge 1 commit into
Closed
fix(qqbot): prevent silent busy-loop when reconnect fails#20994lijinxiao1982 wants to merge 1 commit into
lijinxiao1982 wants to merge 1 commit into
Conversation
When _reconnect() fails (e.g. DNS resolution error), self._ws was left
pointing to the stale closed WebSocket. _read_events() would detect
ws.closed=True and return immediately without raising an exception,
causing _listen_loop to reset backoff_idx=0 on each iteration — an
infinite tight loop with no reconnect attempts and no log output.
Clean up self._ws in the failure path so _read_events() raises
RuntimeError('WebSocket not connected'), which triggers the proper
backoff retry logic in _listen_loop.
This was referenced May 13, 2026
This was referenced May 20, 2026
Closed
Closed
2 tasks
Contributor
|
Automated hermes-sweeper review: this busy-loop fix is already implemented on current main. Evidence:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When _reconnect() fails (e.g. DNS resolution error on api.sgroup.qq.com), self._ws was left pointing to the stale closed WebSocket. _read_events() would detect ws.closed=True and return immediately without raising an exception, causing _listen_loop to reset backoff_idx=0 on each iteration — an infinite tight loop with no reconnect attempts and no log output.
Fix
Clean up self._ws in the _reconnect() failure path so _read_events() raises RuntimeError on next call, triggering the proper backoff retry logic.
Testing
Reproduced on a production gateway (DNS fluctuation caused 78+ minute outage). Applied fix, restarted, QQ Bot reconnected normally.