Skip to content

Commit

Permalink
[Test] Flush response body for progress (elastic#115177)
Browse files Browse the repository at this point in the history
In JDK23, response headers are no longer always immediately sent. See
also https://bugs.openjdk.org/browse/JDK-8331847 This PR adds flush call
for the response body to make progress.

Resolves: elastic#115145 Resolves: elastic#115164
  • Loading branch information
ywangd authored and jfreden committed Nov 4, 2024
1 parent dc2db99 commit f78a7f0
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -586,16 +586,16 @@ public void handle(HttpExchange exchange) throws IOException {
),
-1
);
exchange.getResponseBody().flush();
} else if (randomBoolean()) {
final var bytesSent = sendIncompleteContent(exchange, bytes);
if (bytesSent < meaningfulProgressBytes) {
failuresWithoutProgress += 1;
} else {
exchange.getResponseBody().flush();
}
} else {
failuresWithoutProgress += 1;
}
exchange.getResponseBody().flush();
exchange.close();
}
}
Expand Down Expand Up @@ -640,6 +640,7 @@ public void handle(HttpExchange exchange) throws IOException {
failureCount += 1;
Streams.readFully(exchange.getRequestBody());
sendIncompleteContent(exchange, bytes);
exchange.getResponseBody().flush();
exchange.close();
}
}
Expand Down

0 comments on commit f78a7f0

Please sign in to comment.