Skip to content

fix(qqbot): add backoff upper-bound for QQCloseError reconnect (salvage #13074)#14341

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-17b001fb
Apr 23, 2026
Merged

fix(qqbot): add backoff upper-bound for QQCloseError reconnect (salvage #13074)#14341
teknium1 merged 2 commits into
mainfrom
hermes/hermes-17b001fb

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvages #13074 by @fengtianyu88 onto current main.

The QQCloseError branch of _listen_loop incremented backoff_idx on failed reconnect but never bailed out once it exceeded MAX_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_ATTEMPTS check + logger.error + return pattern that the sibling branches already use. Parity fix.

Closes #13074. Author attribution preserved via cherry-pick.

fengtianyu88 and others added 2 commits April 22, 2026 21:15
…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.
@teknium1 teknium1 merged commit bf039a9 into main Apr 23, 2026
10 of 11 checks passed
@teknium1 teknium1 deleted the hermes/hermes-17b001fb branch April 23, 2026 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants