Repository navigation
[#1208] Read the request body in the redirecting test servers of openam-certs, so that a POST to them no longer fails at random on Windows with JDK 11 - #1209
Merged
vharseko merged 1 commit intoOct 28, 2026
Conversation
…test servers of openam-certs, so that a POST to them no longer fails at random on Windows with JDK 11 On JDK 11 a response sent with no body leaves the request body unread, and the server closes the connection over it with a reset. On Windows the reset discards the response the fetcher has already received, so the POST to the redirector in AMCRLStoreDpFetchTest returned null at random.
maximthomas
approved these changes
Oct 28, 2026
maximthomas
left a comment
Contributor
There was a problem hiding this comment.
praise: The drain sits exactly where the reset comes from, and it reaches every test that POSTs to a redirector.
TestHttpServer.redirectTo(int, String)andredirectAfternow read the body beforesendResponseHeaders(status, -1). A raw-socket probe on JDK 11.0.25 shows the effect: after a 303 to an unread POST the server closes the connection (second request:Broken pipe, 3/3). Once the body is read, the connection stays open. The source agrees:ExchangeImplqueuesWriteFinishedEventon the-1path, andServerImplcloses the connection when!is.isEOF().- Every POST to a redirector in
AMCRLStoreDpFetchTest(storeWithUriParams, lines 387-482, including the two wrapped inrecording(...)) goes throughredirectTo. The two inline 302 handlers at lines 181-205 only ever get body-less GETs fromnewStore().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
AMCRLStoreDpFetchTest.theParametersDroppedAtASeeOtherStayDroppedForTheRestOfTheChainfails at random inbuild-maven (windows-latest, 11)withbut was: null(master run 39647411735, attempt 2; #1201 run 40639954288).The test POSTs to
TestHttpServer.redirectTo, which answers withsendResponseHeaders(status, -1)without reading the request body. On JDK 11 the server does not drain the body in that case, and closes the connection with the body still unread, which resets it. On Windows the reset discards the response the client has already received. JDK 17 and later drain the body there.Changes
TestHttpServer.redirectToandredirectAfterread the request body before answering. Every test that POSTs to a redirector goes through one of them.Verification
HttpURLConnectiondoes, to a handler that answers 303 with-1:Connection resetafter the responsemacOS hands over the response before the reset, so the failure itself does not reproduce there; it has been seen only on
windows-latestwith JDK 11, in the two runs above.mvn -pl openam-certs testwith JDK 11: 148 tests, 0 failures.Fixes #1208