fix: handle Redis "unauthenticated multibulk length" error with re-auth retry - #49
Merged
johnlanni merged 1 commit intoMay 14, 2026
Conversation
…th retry When Envoy cluster configuration changes (e.g. upstreamIdleTimeout update), the connection pool may be drained and recreated. New TCP connections to Redis lack the AUTH state that was established during RedisInit(). Redis 6+ returns "ERR Protocol error: unauthenticated multibulk length" instead of "NOAUTH Authentication required" when an unauthenticated client sends a RESP multibulk command. The existing retry logic only matched "NOAUTH Authentication required", so this error variant was not caught and not retried. This commit broadens the error detection to also match "unauthenticated", covering both error variants and enabling automatic re-authentication and retry. Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: zhaobingkun.zbk <zhaobingkun.zbk@alibaba-inc.com> Co-authored-by: Cursor <cursoragent@cursor.com>
sjtuzbk
force-pushed
the
fix/redis-unauthenticated-multibulk-retry
branch
from
May 14, 2026 03:00
8652faa to
259c3e4
Compare
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.
Summary
redisCallInternalto also match"unauthenticated"keyword, in addition to the existing"NOAUTH Authentication required"check.upstreamIdleTimeoutchanges), causingERR Protocol error: unauthenticated multibulk lengtherrors that were not caught by the existing retry logic.Background
When Envoy gateway configuration changes (such as updating
upstreamIdleTimeoutwhich modifiesHttpProtocolOptions.common_http_protocol_options.idle_timeouton all clusters), the cluster connection pool may be drained and recreated. The new TCP connections to Redis lack the AUTH state that was established duringRedisInit().Redis 6+ has a security feature where it refuses to parse RESP commands from unauthenticated clients, returning
ERR Protocol error: unauthenticated multibulk lengthinstead of the more commonNOAUTH Authentication required. The existing retry logic inredis_wrapper.goonly checked for the latter, so this error variant bypassed the automatic re-authentication mechanism.Changes
In
pkg/wrapper/redis_wrapper.go, the error matching condition is changed from:to:
Test plan
NOAUTH Authentication requirederrors still trigger re-auth retry (existing behavior preserved)ERR Protocol error: unauthenticated multibulk lengtherrors now also trigger re-auth retryMade with Cursor