Keep Pipe readable after FormPipeReader error#18939
Conversation
|
Please make sure to fill in the template before putting |
DescriptionPrior to this fix, when FormPipeReader.ReadFormAsync() threw due to some limit being exceeded, it would not call PipeReader.AdvanceTo() which can leave the request body pipe in an unusable state. This can interfere with Kestrel's ability to process the next request on the connection causing Kestrel to abruptly close the connection. We should also consider changes to Kestrel to improve resiliency against this across requests, but this is the simpler fix. Customer Impact
Regression?Yes. This bug did not exist prior to 3.0. In 3.0, we started using FormPipeReader instead of the Stream-based FormReader from the FormFeature. RiskVery minimal. It's catching and rethrowing an exception after putting the request body Pipe back in a readable state. |
|
Thanks @halter73 ! |
When FormPipeReader.ReadFormAsync() threw due to some limit being exceeded, it would not call PipeReader.AdvanceTo() which can leave the request body pipe in an unusable state. We should also consider changes to Kestrel to improve resiliency against this across requests, but this is the simpler fix.
Fixes #17723
@anurse I think we should take this as a 3.1 servicing patch.