fix!: fix CI and JDK HttpClient failures on JDK 25.0.5 caused by query response trailers #20717
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.50) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 567 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.379
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #20717"
general
weight: 0.35
gianm
Description
Since #16672, Brokers and Historicals always declare
Trailer: X-Druid-Response-Completeand send that trailer after the last chunk of every streamed/druid/v2and/druid/v2/sqlresponse.JDK-8383439 ("Enhance HTTP Client Response Handling", October 2026 CPU) shipped in JDK 17.0.21, 21.0.13 and 25.0.5. It makes
java.net.http.HttpClientrequire CRLF right after the last chunk (newChunkedBodyParser.tryConsumeCRLF). A trailer section now fails the response withjava.net.ProtocolException: CR expected. Older JDKs skipped those 2 bytes without checking them. So on current JDKs, anyjava.net.httpclient that queries a Broker or Historical directly fails at the end of the response. That includes the Druid JDBC driver (DruidHttpClientImpl) andResponseIdentityHeaderTest, which now fails deterministically on CI sincesetup-javapicked up Zulu 25.0.5. RFC 9112 §7.1 includes the trailer section in the chunked body grammar, so this looks like a JDK regression. I found no public OpenJDK report; JDK-8383439 itself is not public.Fix
QueryResultPushernow declares and sends trailers only when the request hasTE: trailers, which is how RFC 9110 §10.1.4 has a client say it accepts trailers. Without that header, responses are unchanged apart from the missingTrailerheader and trailer section.No Druid code reads
X-Druid-Response-CompleteorX-Error-Message(DirectDruidClientdoesn't). The Router drops trailers anyway, because Jetty's proxy treatsTEandTraileras hop-by-hop headers (AbstractProxyServlet.HOP_HEADERS). So Broker→Historical and Router traffic behaves the same as before.Evidence
Zulu 25.0.5+8(2026-10-24 03:25 UTC). InResponseIdentityHeaderTest, the three query tests (Broker native, Broker SQL, Historical native) fail withjava.net.ProtocolException: CR expected; the four GET tests pass.unit tests (25, R,B,P), onZulu 25.0.5+8, with the same threeResponseIdentityHeaderTesterrors.Zulu 25.0.4+1.1(01:49 UTC the same day) andResponseIdentityHeaderTestpassed 7/7. Master is green only because nothing has merged sincesetup-javaswitched to 25.0.5. It will also start failing on the 17 and 21 jobs once they resolve 17.0.21 and 21.0.13./druid/v2/sqlresponse ends with0\r\nX-Druid-Response-Complete: true\r\n\r\n.jdk-17.0.21-ga,jdk-21.0.13-gaandjdk-25.0.5-ga.Release note
Brokers and Historicals now send the
X-Druid-Response-CompleteandX-Error-MessageHTTP trailers only when the request includes theTE: trailersheader. Clients that read these trailers must send that header. This fixes query failures (java.net.ProtocolException: CR expected) injava.net.http.HttpClient-based clients, including the Druid JDBC driver, on JDK 17.0.21, 21.0.13 and 25.0.5.<hr>
##### Key changed/added classes in this PR
QueryResultPusher*
QueryResponseTrailerTest(new embedded test: raw-socket wire check with and withoutTE: trailers, plusHttpClientreads from Broker and Historical)<hr>
This PR has: