Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/io/lettuce/core/RedisPublisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -761,13 +761,13 @@ protected void doOnComplete() {

if (getOutput() != null) {

Object result = getOutput().get();

if (getOutput().hasError()) {
onError(ExceptionFactory.createExecutionException(getOutput().getError()));
return;
}

Object result = getOutput().get();

if (!(getOutput() instanceof StreamingOutput<?>) && result != null) {

if (dissolve && result instanceof Collection) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
package io.lettuce.core.probabilistic;

import javax.inject.Inject;
import java.time.Duration;
import java.util.List;

import io.lettuce.core.RedisCommandExecutionException;
import io.lettuce.core.Value;
import io.lettuce.core.api.StatefulRedisConnection;
import io.lettuce.core.api.reactive.RedisReactiveCommands;
Expand Down Expand Up @@ -138,4 +140,16 @@ void cfInsertReturnsFalseWhenFilterIsFull() {
}
}

/**
* Reproduces the reactive hang on server errors: {@code RedisPublisher.SubscriptionCommand#doOnComplete()} used to call
* {@code getOutput().get()} before checking {@code getOutput().hasError()}, so a {@link CfInfoValueParser#parse} failure on
* a {@code null} payload (server error, no data) threw before the error signal could reach the subscriber, leaving the
* {@code Mono} hanging forever instead of erroring.
*/
@Test
void cfInfoOnMissingKeyErrorsInsteadOfHanging() {
StepVerifier.create(reactive.cfInfo("does-not-exist-key")).expectError(RedisCommandExecutionException.class)
.verify(Duration.ofSeconds(5));
}

}
Loading