Skip to content

Default to zero byte reads when we use PipeReader.Create - #43276

Merged
davidfowl merged 5 commits into
mainfrom
davidfowl/zero-byte-reads
Aug 15, 2022
Merged

davidfowl merged 5 commits into
mainfrom
davidfowl/zero-byte-reads

Conversation

@davidfowl

Copy link
Copy Markdown
Member
  • This will avoid allocating buffers until there's data available to read.

Fixes #42829

- This will avoid allocating buffers until there's data available to read.
@JamesNK

JamesNK commented Aug 14, 2022

Copy link
Copy Markdown
Member

Unit tests? I know there are tests for the stream adapter using zero byte reads, but I'd like some unit tests in asp.net core to ensure it never regresses.

@davidfowl

Copy link
Copy Markdown
Member Author

It's not worth it. Ideally I would be able to verify that the option is set in all of these cases but it's really not worth setting up scaffolding to verify that the option works.

- Riskier since the client runs on older .NET versions that may not support zero byte reads
@davidfowl

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@halter73 halter73 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It'd be nice to get benchmarks, but processing request with large bodies is usually bandwidth constrained. This is all the more reason to save memory.

@davidfowl

Copy link
Copy Markdown
Member Author

@halter73 I really hope we beef up our big body tests next release (both request and response)

@davidfowl
davidfowl merged commit 6d90a04 into main Aug 15, 2022
@davidfowl
davidfowl deleted the davidfowl/zero-byte-reads branch August 15, 2022 23:10
@ghost ghost added this to the 7.0-rc1 milestone Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable zero byte reads for StreamPipeReader usage in ASP.NET Core

4 participants