You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HttpContext.Abort results in different error code for UseKestrel vs UseHttpSys #12256
affected-very-fewThis issue impacts very few customersarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsbugThis issue describes a behavior which is not expected - a bug.severity-nice-to-haveThis label is used by an internal tool
When the server aborts an HTTP/2 request, a RST_STREAM frame is sent. If UseKestrel is used, this frame contains an INTERNAL_ERROR error code. If UseHttpSys is used, this frame contains a CANCEL error code. CANCEL seems more correct to me, but regardless, seems we should be consistent.
CANCEL seems more correct to me, but regardless, seems we should be consistent.
Consistency between HttpSysServer and Kestrel is not necessarily a requirement for us, servers differ in behavior all the time. Having said that, it sounds like CANCEL is more correct. Technically a client could be relying on the old behavior and would be broken by using CANCEL, but we think that's a pretty rare case.
Let's change to cancel in 3.0. We can quirk it in a patch if necessary.
Sure, but it cannot be too difficult to distinguish user-initiated aborts. We were thinking about having an HTTP/2 specific abort API that let you specify the error code anyway for gRPC.
I think I see what you mean though. It would be interesting to see if Http.Sys uses the CANCEL error code for the other cases too, like the app throwing an exception. In that case, I hope even Http.Sys uses the INTERNAL_ERROR error code.
What seems most appropriate here is to use CANCEL for HttpContext.Abort and INTERNAL_ERROR for app exceptions. Consistency doesn't feel like a significant motivator here to me, and if anything indicates we should be pushing for more control over this in Http.Sys (which I believe we are already working on since gRPC uses the RST_STREAM error code as part of the protocol)
affected-very-fewThis issue impacts very few customersarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsbugThis issue describes a behavior which is not expected - a bug.severity-nice-to-haveThis label is used by an internal tool
Activity
analogrelay commentedon Jul 16, 2019
Consistency between HttpSysServer and Kestrel is not necessarily a requirement for us, servers differ in behavior all the time. Having said that, it sounds like CANCEL is more correct. Technically a client could be relying on the old behavior and would be broken by using CANCEL, but we think that's a pretty rare case.
Let's change to cancel in 3.0. We can quirk it in a patch if necessary.
Tratcher commentedon Jul 17, 2019
Kestrel has several abort-ish code paths and does not currently distinguish the error code for them.
halter73 commentedon Jul 17, 2019
Sure, but it cannot be too difficult to distinguish user-initiated aborts. We were thinking about having an HTTP/2 specific abort API that let you specify the error code anyway for gRPC.
halter73 commentedon Jul 17, 2019
I think I see what you mean though. It would be interesting to see if Http.Sys uses the CANCEL error code for the other cases too, like the app throwing an exception. In that case, I hope even Http.Sys uses the INTERNAL_ERROR error code.
Tratcher commentedon Jul 17, 2019
Native Http.Sys doesn't expose any granular API there, I expect the error code is always cancel.
Kestrel already has the Reset API that lets you specify the error code.
stephentoub commentedon Jul 17, 2019
Http.Sys uses CANCEL for both HttpContext.Abort and an exception getting thrown.
Tratcher commentedon Jul 17, 2019
Yeah, both call HttpCancelHttpRequest. https://msdn.microsoft.com/en-us/windows/desktop/aa814335
analogrelay commentedon Jul 17, 2019
What seems most appropriate here is to use
CANCELforHttpContext.AbortandINTERNAL_ERRORfor app exceptions. Consistency doesn't feel like a significant motivator here to me, and if anything indicates we should be pushing for more control over this in Http.Sys (which I believe we are already working on since gRPC uses theRST_STREAMerror code as part of the protocol)analogrelay commentedon Jul 26, 2019
The 3.0 door has closed. We still believe this would be a valuable change though, so Backlogging.