From 322715ff3c1ba79c29e14ddc5a6659362df5a18c Mon Sep 17 00:00:00 2001 From: "datadog-prod-us1-5[bot]" <266081015+datadog-prod-us1-5[bot]@users.noreply.github.com> Date: Mon, 20 Apr 2026 15:18:35 +0000 Subject: [PATCH 1/3] Fix flaky test exception by closing response in HttpServerTest DD_C0320J Co-authored-by: janhavis --- .../datadog/trace/agent/test/base/HttpServerTest.groovy | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy b/dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy index 0b2a28d954b..076f7c7e2a9 100644 --- a/dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy +++ b/dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy @@ -1210,6 +1210,8 @@ abstract class HttpServerTest extends WithHttpServer { if (bubblesResponse()) { assert response.body().string().contains(ERROR.body) assert response.code() == ERROR.status + } else { + response.close() } and: @@ -1239,7 +1241,6 @@ abstract class HttpServerTest extends WithHttpServer { } } - @Flaky(value = "https://github.com/DataDog/dd-trace-java/issues/9396", suites = ["PekkoHttpServerInstrumentationAsyncHttp2Test"]) def "test exception"() { setup: def method = "GET" @@ -1255,6 +1256,8 @@ abstract class HttpServerTest extends WithHttpServer { response.code() == EXCEPTION.status if (testExceptionBody()) { assert response.body().string() == EXCEPTION.body + } else { + response.close() } and: @@ -1299,6 +1302,7 @@ abstract class HttpServerTest extends WithHttpServer { expect: response.code() == NOT_FOUND.status + response.close() and: assertTraces(1) { From fdd744d9f9d9ae5b35152356ef4bb7b9c394ee97 Mon Sep 17 00:00:00 2001 From: Janhavi Sahasrabuddhe Date: Mon, 20 Apr 2026 12:08:18 -0400 Subject: [PATCH 2/3] Close response body in redirect and blocking tests to prevent HTTP/2 flow control issues Co-Authored-By: Claude Sonnet 4.6 (1M context) --- .../groovy/datadog/trace/agent/test/base/HttpServerTest.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy b/dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy index 076f7c7e2a9..0b8d537cfbf 100644 --- a/dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy +++ b/dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy @@ -1170,6 +1170,7 @@ abstract class HttpServerTest extends WithHttpServer { } response.body().contentLength() < 1 || redirectHasBody() + response.close() and: assertTraces(1) { @@ -1840,6 +1841,7 @@ abstract class HttpServerTest extends WithHttpServer { response.code() == 301 response.header('location') == 'https://www.google.com/' !handlerRan + response.close() when: TEST_WRITER.waitForTraces(1) @@ -2121,6 +2123,7 @@ abstract class HttpServerTest extends WithHttpServer { } response.code() == 301 response.header("Location") == 'https://www.google.com/' + response.close() TEST_WRITER.waitForTraces(1) def trace = TEST_WRITER.get(0) From b36d2dde8aa1b045544138940fa6eea606e23b31 Mon Sep 17 00:00:00 2001 From: Janhavi Sahasrabuddhe Date: Mon, 20 Apr 2026 14:05:57 -0400 Subject: [PATCH 3/3] Re-add @Flaky annotation on test exception until fix is verified in CI Co-Authored-By: Claude Sonnet 4.6 (1M context) --- .../groovy/datadog/trace/agent/test/base/HttpServerTest.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy b/dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy index 0b8d537cfbf..ac7e2fd17b7 100644 --- a/dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy +++ b/dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy @@ -1242,6 +1242,7 @@ abstract class HttpServerTest extends WithHttpServer { } } + @Flaky(value = "https://github.com/DataDog/dd-trace-java/issues/9396", suites = ["PekkoHttpServerInstrumentationAsyncHttp2Test"]) def "test exception"() { setup: def method = "GET"