fix(weixin): don't swallow asyncio.TimeoutError as success in _get_updates - #34216
Closed
cedricwyh wants to merge 1 commit into
Closed
fix(weixin): don't swallow asyncio.TimeoutError as success in _get_updates#34216cedricwyh wants to merge 1 commit into
cedricwyh wants to merge 1 commit into
Conversation
…dates
The _get_updates() long-poll method catches asyncio.TimeoutError and
returns {"ret": 0, "msgs": []} — an empty success indistinguishable
from a legitimate poll that returned no messages. When the network
drops, the poll loop keeps seeing ret=0, resets consecutive_failures
to 0, and never detects the dead connection. The adapter remains
"connected" forever (zombie state).
Fix: return {"ret": -999, "errcode": -999} on timeout instead,
so _poll_loop treats it as a connectivity failure, increments
consecutive_failures, applies backoff, and can trigger reconnection.
Also fixed _is_stale_session_ret() to handle empty errmsg correctly
instead of crashing with AttributeError.
Fixes NousResearch#23523
Collaborator
Author
|
Closing — overlaps with #23529 (same root cause and fix approach). Let that one carry the fix. |
This was referenced Jul 31, 2026
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.
Fixes #23523
Problem
_get_updates()catchesasyncio.TimeoutErrorand returns{"ret": 0, "msgs": []}— an empty success that's indistinguishable from a legitimate long-poll with no messages. When the network drops, the poll loop keeps seeingret=0, resetsconsecutive_failures, and never detects the zombie connection.Fix
{"ret": -999, "errcode": -999, "errmsg": "connection timeout"}on timeout_poll_loopwill see non-zeroret, incrementconsecutive_failures, apply backoff, and trigger reconnection after 3 consecutive failures_is_stale_session_ret()to handle emptyerrmsgwithout crashing