-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Expect 100 Continue Hang #38774
Expect 100 Continue Hang #38774
Conversation
5a90ae0
to
9bcbf28
Compare
test failure seems related |
Why this is different than case without 100Continue? If server does not respond at all, we would also block until timeout fires, right? |
The hang happens only if we fail to send request content after For customers, the covering the content exception with timeout is making this issue supper hard to troubleshoot. |
9bcbf28
to
05d4cad
Compare
{ | ||
await SendRequestContentAsync(request, stream, async, cancellationToken).ConfigureAwait(false); | ||
} | ||
catch (Exception) when (timerExpired) |
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.
We're adding a decent amount of complication to be able to pass around both sendRequestContent and timerExpired. Could we instead just always call Dispose in this case if SendRequestContentAsync throws? As you said, we're talking about the combination of a faulty request content + Expect: 100-continue. If we get an exception in that case, regardless of the timer, seems like it'd be fine to just get rid of the connection in that case.
05d4cad
to
d674782
Compare
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs
Show resolved
Hide resolved
Tagging subscribers to this area: @dotnet/ncl |
src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs
Outdated
Show resolved
Hide resolved
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 except for some small issues commented on below.
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs
Show resolved
Hide resolved
src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs
Outdated
Show resolved
Hide resolved
cbfb705
to
5826443
Compare
Failing tests are unrelated. |
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
{ | ||
public partial class ThrowingContent : HttpContent | ||
{ | ||
protected override void SerializeToStream(Stream stream, TransportContext context, CancellationToken cancellationToken) |
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.
Is this needed?
Shouldn't the default SerializeToStream(stream, context, cancellationToken)
end up calling SerializeToStream(stream, context)
?
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.
TL;DR yes
This is the only sync implementation we provide for ThrowingContent
. The one in shared code is async and there's now automatic/default sync-over-async in any of our HttpContent
classes.
triggering CI |
Inside sendRequestContentTask recognizes that it's invoked from a timer thread and if request content fails, unblocks SendAsyncCore and eventually propagates the exception from the content to the outside. Fixes the issue for H2 as well. Fixes dotnet#36717
Inside
sendRequestContentTask
recognizes that it's invoked from a timer thread and if request content fails, unblocksSendAsyncCore
and eventually propagates the exception from the content to the outside.Fixes #36717