Skip to content

Lowering ack callback to avoid race condition #6012

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 14, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import software.amazon.awssdk.http.Protocol;
import software.amazon.awssdk.http.nio.netty.internal.ChannelAttributeKey;
import software.amazon.awssdk.http.nio.netty.internal.utils.NettyClientLogger;
import software.amazon.awssdk.testutils.retry.RetryableTest;

public class Http2PingHandlerTest {
private static final NettyClientLogger log = NettyClientLogger.getLogger(Http2PingHandler.class);
Expand Down Expand Up @@ -227,7 +228,7 @@ public void channelInactive_shouldCancelTaskAndForwardToOtherHandlers() {
assertThat(channel.runScheduledPendingTasks()).isEqualTo(-1L);
}

@Test
@RetryableTest(maxRetries = 3)
public void delayedPingFlushDoesntTerminateConnectionPrematurely() {
Logger.getLogger("").setLevel(Level.ALL);

Expand All @@ -238,7 +239,7 @@ public void delayedPingFlushDoesntTerminateConnectionPrematurely() {
EmbeddedChannel channel = createHttp2Channel(fastChecker, catcher, pingResponder, delayingWriter);

pingResponder.setCallback(() -> channel.writeInbound(new DefaultHttp2PingFrame(0, true)),
FAST_CHECKER_DURATION_MILLIS / 10 /* send ack in 10 ms after getting ping*/);
5 /* send ack in 5 ms after getting ping*/);

Instant runEnd = Instant.now().plus(1, SECONDS);
while (Instant.now().isBefore(runEnd)) {
Expand Down
Loading