make Http2_RequestFailsWithAppropriateHttpProtocolException test more deterministic #94112
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.
When I look at the normal passing run I see something like
when it fails, the exchange looks like
So it seems like if the GOAWAY is sent before the client even start making request the test fails with
Couldn't find HttpProtocolException with matching error code in exception: System.Net.Http.HttpRequestException: An HTTP/2 connection could not be established because the server did not complete the HTTP/2 handshake.
This may (or may not) be caused by the connection pool refactor. Since the requests are now detached, the connection can be closed by the 'GOAWAY` and the request does not fail with protocol error.
To minimize risk, I only changed the test to wait for beginning of the request to arrive so when
HttpClient
process the response it would produce deterministic result. I was running tests in loop with this change and I did not see failure. It was failing for me before frequently with less than 20-50 iterations.fixes #92647