Repository navigation
Signal onError instead of hanging when a reactive complex-output command errors - #3851
Merged
Merged
Conversation
…and errors Reactive commands backed by EncodedComplexOutput (CF.INFO, BF.INFO, TOPK.LIST, TS.INFO, ...) hang until the command timeout fires when the server replies with an error. SubscriptionCommand.doOnComplete() calls getOutput().get() before checking hasError(); get() runs the ComplexDataParser, which throws on the null payload left by an error reply. That throw escapes doOnComplete() after the completion state has already flipped to COMPLETE, so completeExceptionally() skips onError and the Flux/Mono never terminates. Check hasError() before get(), matching AsyncCommand.completeResult() and MultiOutput. The normal path is unchanged; only error replies are affected, and they now surface as onError instead of hanging.
Collaborator
|
Hey @HwangRock |
Contributor
Author
|
@a-TODO-rov Done, opened #3855 with the repro, root cause, and affected scope. This PR is the fix for it. |
HwangRock
added a commit
to HwangRock/lettuce
that referenced
this pull request
Sep 7, 2026
The RedisPublisher reactive error-handling hang (redis#3851) is fixed and present on this branch via the upstream merge, so the test no longer hangs and is re-enabled. Verified against the dockerized 8.10 environment.
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 #3855
Motivation
Reactive commands backed by
EncodedComplexOutput—CF.INFO,BF.INFO,TOPK.INFO,TOPK.LIST, and any other command whose output is decoded by aComplexDataParser— hang until the command timeout fires when the server replies with an error.Reproduction against a live server:
Before this change the
Mononever terminates; the subscriber waits until the client-side command timeout (default 60s).Root cause
SubscriptionCommand.doOnComplete()inRedisPublishercallsgetOutput().get()before checkinghasError():On an error reply the output holds an error and a
nullpayload.get()runs theComplexDataParser, which throwsIllegalArgumentExceptionon thenulldata. That throw escapesdoOnComplete(), which runs insideCommandWrapper.complete()after the completion state has already been flipped toCOMPLETE.CommandHandlercatches the throw and callscompleteExceptionally(), but itsconsumers != COMPLETEguard is now false, soonErroris never signalled and theFlux/Mononever terminates.The non-reactive paths do not have this problem because they check
hasError()first:AsyncCommand.completeResult()andMultiOutputboth surface the error without ever callingget(). Only the reactive path had the ordering reversed. This was latent untilComplexDataParser-based outputs (RESP3 complex replies) madeget()able to throw.Modification
Check
hasError()beforeget()indoOnComplete(), matchingAsyncCommand.completeResult():The
dissolve/onNext/StreamingOutputlogic is unchanged. The normal path (hasError() == false) is byte-for-byte identical; only error replies change behaviour, and they now surface asonErrorinstead of hanging. Normal empty replies (hasError() == false,data == null) are unaffected — the parser returnsnullas before.Result
cfInfoOnMissingKeyErrorsInsteadOfHangingtoRedisCuckooFilterReactiveIntegrationTests. Fails with a 5s timeout before the change, passes after.redis:8.Note
Medium Risk
Touches reactive command completion in RedisPublisher, a core path for all reactive subscribers. The change is a small reorder of existing error handling and only affects error replies.
Overview
Reactive commands with complex parsers (
CF.INFO,BF.INFO,TOPK.INFO, etc.) no longer hang when Redis returns an error.SubscriptionCommand.doOnComplete()now checkshasError()beforeget(), matchingAsyncCommand.completeResult(), so anullerror payload is not parsed and the subscriber getsRedisCommandExecutionExceptioninstead of waiting until timeout.Adds
cfInfoOnMissingKeyErrorsInsteadOfHangingto cover the missing-keyCF.INFOcase.Reviewed by Cursor Bugbot for commit 8f55099. Bugbot is set up for automated code reviews on this repo. Configure here.