Fix flaky DuplexTest.duplexWithAuthChallenge#9564
Closed
kamilkrzywanski wants to merge 1 commit into
Closed
Conversation
Same race as duplexWithRedirect: the client can process the 401 and reset the stream before MockSocketHandler finishes writing the challenge body. Wait for that write (as duplexWithRedirect already does) before continuing past request headers. Fixes lysine-dev#9370
Collaborator
|
See #9563 (comment) |
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.
Summary
Fixes #9370.
On Windows (and occasionally elsewhere),
duplexWithAuthChallengefails with:The client can act on the 401 and cancel the HTTP/2 stream while the server is still writing the duplex challenge body. That is the same race fixed for
duplexWithRedirectin #4788.Change
Reuse that pattern:
CountDownLatchcounted down after the server sends"please authenticate!\n"EventListener.requestHeadersEndawaits the latch so the client does not process the 401 (and reset the stream) until that write has finishedTest plan
./gradlew :okhttp:jvmTest --tests okhttp3.DuplexTest.duplexWithAuthChallenge(×5)./gradlew :okhttp:jvmTest --tests okhttp3.DuplexTest.duplexWithRedirect