-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Http2Stream throws a wrapped Http2ConnectionException on GO_AWAY #54625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Http2Stream throws a wrapped Http2ConnectionException on GO_AWAY #54625
Conversation
|
Tagging subscribers to this area: @dotnet/ncl Issue DetailsIf server sends Fixes #42472
|
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Stream.cs
Outdated
Show resolved
Hide resolved
ManickaP
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general, just a question about the exception handling.
Thanks!
| } | ||
| catch (Exception) | ||
| { | ||
| if (_resetException is Exception resetException) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check and throw the exception the same way as CheckResponseBodyState does in:
runtime/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Stream.cs
Lines 923 to 931 in 56778f0
| if (_resetException is Exception resetException) | |
| { | |
| if (_canRetry) | |
| { | |
| ThrowRetry(SR.net_http_request_aborted, resetException); | |
| } | |
| ThrowRequestAborted(resetException); | |
| } |
ProcessGoAwayFrame sets _canRetry to true AFAICT and we're not handling it here.
Could we just directly call CheckResponseBodyState in the exception handling block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_canRetry check has been added, but we cannot call CheckResponseBodyState here because it asserts for a lock like this
Debug.Assert(Monitor.IsEntered(SyncObject));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just take the lock and call it, then?
CheckResponseBodyState also checks for _responseProtocolState == ResponseProtocolState.Aborted; should we be checking that here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should not check _responseProtocolState here because SendDataAsync is called to send request data, so I believe it should control request-related logic only. That's another reason why I think we shouldn't call CheckResponseBodyState here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@geoffkizer Could you please check out my reply above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, your comment sounds right to me.
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs
Outdated
Show resolved
Hide resolved
|
@geoffkizer @ManickaP All comments are addressed. Please, review. |
ManickaP
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
| { | ||
| if (_resetException is Exception resetException) | ||
| { | ||
| if (_canRetry) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to take the lock around checking _resetException and _canRetry. Otherwise we may see an inconsistent view of these two values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I overlooked it. Fixed.
geoffkizer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from the locking issue I just mentioned above, LGTM.
* origin/main: (27 commits) [mono][llvm] Only emit 'LLVM failed' messages on verbosity > 0. (dotnet#55060) Http2Stream throws a wrapped Http2ConnectionException on GO_AWAY (dotnet#54625) [main] Update dependencies from dnceng/internal/dotnet-optimization dotnet/arcade dotnet/xharness dotnet/hotreload-utils (dotnet#55007) disable a failing test. (dotnet#55063) [mono][wasm] Disable some tests which crash on AOT. (dotnet#55054) Fix fix_allocation_context for regions (dotnet#54931) Delete stale references to System.IO.FileSystem.Primitives (dotnet#55041) Add binplaced analyzers to ASP.NET transport package (dotnet#55042) [mono] Enable many HardwareIntrinsic tests on wasm Delete `compQuirkForPPP`. (dotnet#55050) [Mono] Condition Workload AOT import to be osx only (dotnet#55040) package native quic library (dotnet#54992) Make GlobalizationMode code consistent (dotnet#55039) Expand PerfMap format to support metadata for symbol indexation (dotnet#53792) [debugger]Componentize debugger (dotnet#54887) [Mono] Include loaded interpreter methods as EventPipe session rundown method events. (dotnet#54953) Delete stale ActiveIssue from HttpHeadersTest (dotnet#55027) Poison address-exposed user variables in debug (dotnet#54685) Recategorize emsdk dependency (dotnet#55028) Remove the the wasm AOT specific test project exclusions (dotnet#54988) ...
If server sends
GO_AWAYto client,Http2Connectionhandles it and sets a correctHttp2ConnectionExceptionto_resetExceptionfield followed by resetting all active Http2Streams. Each of these streams is expected to rethrow that_resetExceptionto communicate the original protocol error to the application code. However, the methodHttp2Stream.SendDataAsynccurrently doesn't take into account that field, thus when it gets cancelled as part of a stream reset it just throwsOperationCanceledExceptionwhich doesn't contain any details. This PR fixes that and makesHttp2Stream.SendDataAsyncthrow the originalHttp2ConnectionExceptionwrapped byIOException.Fixes #42472