Repository navigation
Preserve reader limits across redisReconnect - #1392
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
redisReconnect() frees the context reader and creates a new one with the default settings, so any maxbuf, maxelements or maxdepth value set on c->reader (as the README describes) is silently reset after a reconnect. Copy these limits to the new reader.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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
redisReconnect()replacesc->readerwith a freshly created reader, which resetsmaxbuf,maxelementsandmaxdepthto their defaults. The README documents setting these fields oncontext->reader, so a reconnect silently undoes that configuration. Depending on the direction of the change, the client either starts rejecting replies it accepted before the reconnect, or loses a limit it set to bound memory use.This change copies the three limits from the old reader to the new one. If there is no old reader (for example after an earlier allocation failure), the defaults apply as before.
Fixes #1391
Testing
Reconnect preserves the reader limitstotest_blocking_connection_timeoutsintest.c. It sets non-default limits, callsredisReconnect(), and checks the values on the new reader.*** 2 TESTS FAILED ***). With the fix,./test.shreportsALL TESTS PASSED (0 skipped).makebuilds clean with the default-Wall -Wextra -Werror -pedanticflags.Note
Low Risk
Localized change to reconnect reader setup with a matching test; no auth or protocol behavior changes beyond keeping user-configured parse limits.
Overview
redisReconnect()used to allocate a freshredisReader, which resetmaxbuf,maxelements, andmaxdepthto library defaults and dropped any limits the app set oncontext->reader(as documented in the README).The reconnect path now snapshots those three fields from the existing reader before
redisReaderFree, then restores them on the new reader afterredisReaderCreate(). If there is no prior reader, behavior is unchanged (defaults apply).A regression test
Reconnect preserves the reader limitssets non-default values, calls reconnect, and asserts they survive on the new reader.Reviewed by Cursor Bugbot for commit 51c7946. Bugbot is set up for automated code reviews on this repo. Configure here.