Repository navigation
Conversation
Only decrement pending subscriptions when the confirmation matches a registered callback. Ignore unknown confirmations through the existing unmatched-reply path, preserving handling of legitimate subscriptions. Cover channels and patterns in RESP2 and RESP3 with reader-fed tests. Fixes redis#1393
Codex Review Summary: ✅ CompletedThis 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.
Fixes #1393.
An unexpected
subscribeorpsubscribeconfirmation for an unregistered channel aborts an assertion-enabled client and dereferences a null callback in release builds. Decrement the pending counter only when a callback was found. Unknown confirmations then follow the existing unmatched-reply handling, while registered subscriptions continue to receive their callbacks.Add eight checks covering unknown and expected confirmations for channels and patterns in RESP2 and RESP3. They reproduce the assertion failure on unchanged upstream; an independent release build with
NDEBUGalso reproduces the null access under ASan/UBSan. The fixed release build passes all eight checks under both sanitizers.Validation: warning-free Make and CMake builds; full TLS/async test run against Redis 7.4: 233 passed, 0 skipped.
Note
Low Risk
Narrow guard around pub/sub bookkeeping; registered subscriptions behave as before, with regression tests added.
Overview
Fixes a crash when the async client receives a
subscribeorpsubscribeconfirmation for a channel or pattern that has no registered callback.__redisGetSubscribeCallbackinasync.cnow decrementspending_subsonly when a matching callback exists, so stray confirmations are dropped like other unmatched pub/sub replies instead of tripping an assertion or null-dereferencing in release builds.Adds
test_unexpected_subscribe_repliesintest.cwith eight synthetic RESP2/RESP3 checks (channel and pattern, unknown vs known) to lock in the ignore and callback paths.Reviewed by Cursor Bugbot for commit b26e460. Bugbot is set up for automated code reviews on this repo. Configure here.