You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The sequence for acquiring the connection will be cancelled after the request ends.
Actual Behavior
The sequence for acquiring the connection was not cancelled after the request ended.
Steps to Reproduce
I recently encountered a small issue while using Spring Cloud Gateway. After the request reaches the responseTimeout value and the response is sent back (due to a connection timeout), the program continues to retry connecting to other DNS-resolved addresses. (For example, responseTimeout = 8s, connectionTimeout = 5s, and there are three addresses in the DNS resolution result.)
It seems that after the outer sequence is cancelled, the inner sequence responsible for acquiring the connection is not able to detect this cancellation. Does this behavior align with the phenomenon simulated in the following flow? (I’m just trying to learn.)
publicstaticvoidmain(String[] args) throwsInterruptedException {
execute();
Thread.sleep(20000);
}
publicstaticvoidexecute() {
// Similar to PooledConnectionAllocator#connectChannelMono.<String>create(sink -> acquireConnection(sink))
// Simulate request
.flatMap(connection -> Mono.just("send request and receive response"))
// Set response timeout to 8 seconds
.timeout(Duration.ofSeconds(8), Mono.just("read timeout!"))
.subscribe(System.out::println);
}
publicstaticvoidacquireConnection(MonoSink<String> sink) {
// Similar to TransportConnector#connectMono.just("acquire connection")
// Set connection timeout to 5 seconds
.delayElement(Duration.ofSeconds(5))
.doOnNext(connection -> {
System.out.println("connection timeout!");
thrownewRuntimeException();
})
.onErrorResume(Exception.class, e ->
Mono.defer(() -> Mono.just("acquire connection")
.delayElement(Duration.ofSeconds(5))
.doOnNext(connection -> {
System.out.println("connection timeout!");
thrownewRuntimeException();
})
)
// Retry connecting other DNS-resolved addresses.
.retryWhen(RetrySpec.max(2))
)
.subscribe(connection -> sink.success(connection));
}
Possible Solution
Your Environment
Reactor version(s) used: 1.1.20
JVM version: 17
The text was updated successfully, but these errors were encountered:
Expected Behavior
The sequence for acquiring the connection will be cancelled after the request ends.
Actual Behavior
The sequence for acquiring the connection was not cancelled after the request ended.
Steps to Reproduce
I recently encountered a small issue while using Spring Cloud Gateway. After the request reaches the
responseTimeout
value and the response is sent back (due to a connection timeout), the program continues to retry connecting to other DNS-resolved addresses. (For example,responseTimeout = 8s
,connectionTimeout = 5s
, and there are three addresses in the DNS resolution result.)It seems that after the outer sequence is cancelled, the inner sequence responsible for acquiring the connection is not able to detect this cancellation. Does this behavior align with the phenomenon simulated in the following flow? (I’m just trying to learn.)
Possible Solution
Your Environment
The text was updated successfully, but these errors were encountered: