Repository navigation
improve error handling on failed Http/2 handshake - #37050
Conversation
|
There are no test changes/additions in this PR. Is this difficult to have automated tests? How did you test these changes? |
|
I set up HTTP 1.1 server and I used ssl proxy in front of it advertising HTTP2 via ALPN. So HttpClient would fall to HTTP2 processing while server does not understand it. After second thought I modified old Loopback server and added test for this. |
|
/azp run corefx-outerloop-linux |
|
/azp run corefx-outerloop-osx |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run corefx-outerloop-windows |
|
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
outerloop failures seems unrelated. |
|
If I understand correctly, this change means we will wait to receive the initial SETTINGS from the server before trying to actually use the connection to send requests. Correct? Per spec, we are allowed to start sending requests before we receive the initial SETTINGS from the server. Forcing us to wait for the server SETTINGS may introduce a perf issue here. I'm not sure why we can't keep the SETTINGS handling on the background task, and just handle the exception better? |
|
We do send frames out before this in SetupAsync() so we are not waiting. Do you have specific recommendation how to get exceptions back? There was recent discussion about sending request in parallel with receiving response for gRPC and it will be useful there as well. |
These are just the connection establishment frames though, right? I'm talking about sending actual requests.
I'm not sure what you are asking. What exactly are we trying to fix here? There are lots of ways the connection can fail once it's established, why is this particular case any different? |
|
I have two goals:
Aside from the CreditManager, I have also seen disposed exceptions on SslStream. |
|
I updated code to avoid delay. Now we will throw: |
|
I sync up with #37223. However even with that change, _abortException did not bubble up and we were still getting ObjectDisposedException on CreditManager. I made some updates as well as I updated new test to check for type of InnerException as everything now gets wrapped in HttpRequestException. |
Where didn't it bubble up? |
|
to caller of client.GetStringAsync() e.g. test in this case: This is because the inner exception does not come through Http2Stream. |
Ah. My PR only changed call sites to throw _abortException when they were checking for the aborted state; this doesn't appear to be doing that. |
|
The stream it self should be in aborted state but the exception comes directly from |
It's not; different streams could have different abort exceptions due to an RST_STREAM frame specific to that stream. |
|
/azp run |
|
Azure Pipelines successfully started running 4 pipeline(s). |
|
That make sense @stephentoub . I look at it again and proposed change should work as intended as it brings connection-level errors from Abort() outerloop failures are not related to this PR. |
|
/azp run corefx-outerloop-windows |
|
/azp run corefx-outerloop-linux |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run corefx-outerloop-osx |
|
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
outerloop failures seems unrelated. |
|
@wfurt why did you merge this PR when all legs were failing? because of a build error? https://github.com/dotnet/corefx/blob/master/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs#L1351 is missing a bracket: |
|
I commited directly into master to fix the build break: 3075793 |
|
sorry @ViktorHofer There was merge conflict I tried to resolve using github UI. and obviously I did not do it quite right. |
* improve error handling on failed Http/2 handshake * remove extra space * add test for HTTP2 client talking to HTTP1 server. * fix broken tests * improve exception handling * update exception handling * ws update * fix bad merge * update test and changes from dotnet/corefx#37223 * use _abortException only if the stream is not aborted already * fix IsAborted check * updates to syncup with recent changes Commit migrated from dotnet/corefx@c412fa7
The issue described in #36665 was misconfiguration. However getting ObjectDisposedException on internal objects is not very helpful.
The RFC says:
This change modifies SetupAsync() to check for server preface and throw error immediately instead of aborting connection in background task. It will also log few bytes from response if tracing is enable so it is easier to diagnose this in field.
with this called would get following exception instead of ObjectDisposedException:
closes #36665