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
* 1/2 Improve HTTP2/PING timeout logic
Improve PING timeout logic to avoid premature closing of the connection that
can occur due to scheduling or flushing delays.
* 2/2 Improve HTTP2/PING timeout logic
Improve PING timeout logic, by allowing data frame packets to reset the timer.
Since the goal is to identify and tear down a dead connection, receiving
data packets serve as activity as well. This will help in case of scheduling
and network delays if the PING ACK is not received in time.
* Add changelog
* Fix tests based on new ping timeout logic
* Address review comments
"description": "Improve HTTP2/PING timeout logic. Improvements are to reset the ack timers on incoming data packets because it supports liveness of the connection. Also avoiding premature timeouts due to delays in flushing or scheduling."
Copy file name to clipboardExpand all lines: core/sdk-core/src/test/java/software/amazon/awssdk/core/internal/http/timers/HttpClientApiCallTimeoutTest.java
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,8 @@ public class HttpClientApiCallTimeoutTest {
56
56
57
57
privateAmazonSyncHttpClienthttpClient;
58
58
59
+
privatefinalstaticintEPSILON_MILLIS = 10;
60
+
59
61
@Before
60
62
publicvoidsetup() {
61
63
httpClient = testClientBuilder()
@@ -70,7 +72,7 @@ public void successfulResponse_SlowResponseHandler_ThrowsApiCallTimeoutException
Copy file name to clipboardExpand all lines: http-clients/netty-nio-client/src/main/java/software/amazon/awssdk/http/nio/netty/internal/http2/Http2PingHandler.java
Copy file name to clipboardExpand all lines: http-clients/netty-nio-client/src/test/java/software/amazon/awssdk/http/nio/netty/fault/PingTimeoutTest.java
+19-5Lines changed: 19 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -99,23 +99,37 @@ public void methodTeardown() throws InterruptedException {
99
99
netty = null;
100
100
}
101
101
102
+
/**
103
+
* Default ping timeout value is 5000ms, so when the channel has no activity including
104
+
* no data packets received or ping acks received for the timeout value, the connection
105
+
* will be closed. During connection setup for testing, there will be Setting frame and
106
+
* the SettingsAck frame exchanged which counts as activity on the channel, so the channel
107
+
* should timeout during the second interval which is 10 seconds.
Copy file name to clipboardExpand all lines: http-clients/netty-nio-client/src/test/java/software/amazon/awssdk/http/nio/netty/fault/ServerNotRespondingTest.java
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -54,6 +54,7 @@
54
54
importjava.time.Duration;
55
55
importjava.util.concurrent.CompletableFuture;
56
56
importjava.util.concurrent.atomic.AtomicInteger;
57
+
importjava.util.logging.Level;
57
58
importorg.junit.jupiter.api.AfterEach;
58
59
importorg.junit.jupiter.api.BeforeEach;
59
60
importorg.junit.jupiter.api.Test;
@@ -114,8 +115,9 @@ public void connectionNotAckPing_newRequestShouldUseNewConnection() throws Inter
114
115
// First request should succeed
115
116
firstRequest.join();
116
117
117
-
// Wait for Ping to close the connection
118
-
Thread.sleep(200);
118
+
// Wait for Ping to close the connection, it takes 2 * healthCheckPingPeriod (200ms)
0 commit comments