Describe the bug spring-cloud-netflix 2.2.2.RELEASE springboot 2.2.7.RELEASE
Sample
public class CommonService {
public Mono<String> cal(String name) {
if ("error".equals(name)) {
return Mono.error(new RuntimeException("get error"));
} else {
return Mono.just("cal for " + name);
}
}
}
@GetMapping("/breaker")
public Mono<String> breaker(String name) {
return HystrixCommands.from(commonService.cal(name))
.commandName("test")
.groupName("default")
.toMono();
}
call /breaker?name="error" several times breaker will be open,then call /breaker?name="ok" in half-open status the call is success and next call still return Hystrix circuit short-circuited and is OPEN
HystrixCommands use PublisherHystrixCommand, function commandIsScalar()return false ,in com.netflix.hystrix.AbstractCommand.executeCommandAndObserve()will not call circuitBreaker.markSuccess(). circuitbreaker can't switch true to false seems to be caused by this. Its a bug or my useage is wrong?
Comment From: spencergibb
Those are in the upstream hystrix project.
Comment From: twogoods
PublisherHystrixCommand is org.springframework.cloud.netflix.hystrix.PublisherHystrixCommand in this project
private static class PublisherHystrixCommand<T> extends HystrixObservableCommand<T> {
// override this seems will resolve this problem
@Override
protected boolean commandIsScalar() {
return true;
}
}
or you think hystrix HystrixObservableCommand should default return true in commandIsScalar function?
Comment From: spencergibb
I guess I'm not sure what should go there.
Comment From: spencergibb
This module has entered maintenance mode. This means that the Spring Cloud team will no longer be adding new features to the module. We will fix blocker bugs and security issues, and we will also consider and review small pull requests from the community.