Skip to content

Conversation

@gfr-g
Copy link
Contributor

@gfr-g gfr-g commented Apr 18, 2022

Http Response fails when writing more than 255MB

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.

IISHttpContext.WriteBody now handles big buffers according to the limitation of IHttpResponse::WriteEntityChunks
by slicing the buffer and feeding a max of 65535 chunks per call to the native method.

Fixes #14191

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Apr 18, 2022
@gfr-g
Copy link
Contributor Author

gfr-g commented Apr 18, 2022

One note about why const ushort RESPONSE_BODY_MAX_CHUNKS = 65533; and not 65535.

Apparently, despite the documentation states that more than 65535 chunks will throw an exception, it seems that 65535 is the limit already.

Also, there seems to be a problem when slicing a ReadOnlySequence on segment borders I discovered working on this issue which is tracked here.

Copy link
Contributor

@dougbu dougbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the submodule updates from this PR

@gfr-g
Copy link
Contributor Author

gfr-g commented Apr 18, 2022

@dougbu sorry, missed that, hope it's fixed now

using Microsoft.AspNetCore.Server.IIS.FunctionalTests;
using Microsoft.AspNetCore.Testing;

namespace IIS.Tests;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Tratcher is it worth running this test in any other functional permutations like IISExpress.Tests?

Copy link
Member

@davidfowl davidfowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't in the right layer, it should be closer to the call where the limit actually applies.

@gfr-g gfr-g marked this pull request as draft April 19, 2022 07:59
@adityamandaleeka adityamandaleeka assigned davidfowl and unassigned HaoK May 18, 2022
Copy link
Member

@halter73 halter73 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good. I only have minor feedback.

@halter73 halter73 requested review from davidfowl and halter73 July 29, 2022 00:07
@halter73
Copy link
Member

@sebastienros Do we have any benchmarks like plaintext or json that would verify we're not regressing IIS perf for normal response body writes without 65k+ memory chunks?

@halter73 halter73 enabled auto-merge (squash) August 1, 2022 19:40
@halter73
Copy link
Member

halter73 commented Aug 1, 2022

I just updated some of the comments to use // instead of /*, remove trailing spaces and rephrase a couple things. This change is great. Thanks for sticking with it @gfr-g! I got it set to auto-merge once the CI passes again.

@halter73 halter73 dismissed davidfowl’s stale review August 1, 2022 19:44

He is OOF and asked me to take this over.

@gfr-g
Copy link
Contributor Author

gfr-g commented Aug 1, 2022

I just updated some of the comments to use // instead of /*, remove trailing spaces and rephrase a couple things. This change is great. Thanks for sticking with it @gfr-g! I got it set to auto-merge once the CI passes again.

No worries, appreciated. Thank you all for the help and the reviews.

@halter73 halter73 merged commit 5974136 into dotnet:main Aug 2, 2022
@ghost ghost added this to the 7.0-rc1 milestone Aug 2, 2022
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Http Response fails when writing more than 255MB

7 participants