fix(qqbot): add backoff upper-bound for QQCloseError reconnect (salvage #13074)#14341
Merged
Conversation
…path The QQCloseError (non-4008) reconnect path in _listen_loop was missing the MAX_RECONNECT_ATTEMPTS upper-bound check that exists in both the Exception handler (line 546) and the 4008 rate-limit handler (line 486). Without this check, if _reconnect() fails permanently for any non-4008 close code, backoff_idx grows indefinitely and the bot retries forever at 60-second intervals instead of giving up cleanly. Fix: add the same guard after backoff_idx += 1 in the general QQCloseError branch, consistent with the existing Exception path.
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.
Salvages #13074 by @fengtianyu88 onto current main.
The QQCloseError branch of
_listen_loopincrementedbackoff_idxon failed reconnect but never bailed out once it exceededMAX_RECONNECT_ATTEMPTS— unlike the generic-Exception branch (lines 486/549) which already checks. Result: a QQ server persistently closing the connection would retry forever in an exponentially-backed-off tight loop, leaking resources and masking the underlying service issue.Adds the same
backoff_idx >= MAX_RECONNECT_ATTEMPTScheck +logger.error+returnpattern that the sibling branches already use. Parity fix.Closes #13074. Author attribution preserved via cherry-pick.