We are using Mono::share and if the mono recive a TimeOut exception the mono execution is canceled
Expected Behavior
I expect that a timeout don't cancel a Mono return by share() method.
Actual Behavior
The mono is cancelled
Steps to Reproduce
@Test
void reproCase() {
var stream = Mono.just("Hola")
.doOnNext(next -> System.out.println("Learning to say hi: " + next))
.delayElement(Duration.of(5, ChronoUnit.SECONDS))
.doOnNext(next -> System.out.println("Say hi: " + next))
.share();
System.out.println("Init ...");
var result = stream
.subscribeOn(Schedulers.boundedElastic())
.timeout(Duration.of(1, ChronoUnit.SECONDS))
.onErrorReturn(TimeoutException.class, "Timeout :(")
.block();
System.out.println("Result: " + result);
stream.subscribe();
Thread.sleep(10_000);
}
Result:
Init ...
Learning to say hi: Hola
Result: Timeout :(
Learning to say hi: Hola
Say hi: Hola
Note the two "Learning to say ...."
but
@Test
void workingCase() {
var stream = Mono.just("Hola")
.doOnNext(next -> System.out.println("Learning to say hi: " + next))
.delayElement(Duration.of(5, ChronoUnit.SECONDS))
.doOnNext(next -> System.out.println("Say hi: " + next))
.share();
System.out.println("Init ...");
stream.subscribe();
var result = stream
.subscribeOn(Schedulers.boundedElastic())
.timeout(Duration.of(1, ChronoUnit.SECONDS))
.onErrorReturn(TimeoutException.class, "Timeout :(")
.block();
System.out.println("Result: " + result);
Thread.sleep(10_000);
}
Result:
Init ...
Learning to say hi: Hola
Result: Timeout :(
Say hi: Hola
Your Environment
- Reactor version(s) used: 3.4.30
- JVM version (
java -version): Java version: 17.0.4, vendor: GraalVM Community,
We are using
Mono::shareand if the mono recive a TimeOut exception the mono execution is canceledExpected Behavior
I expect that a timeout don't cancel a Mono return by share() method.
Actual Behavior
The mono is cancelled
Steps to Reproduce
Result:
Note the two "Learning to say ...."
but
Result:
Your Environment
java -version): Java version: 17.0.4, vendor: GraalVM Community,