Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

@davidfowl
Copy link
Member

@davidfowl davidfowl commented Apr 18, 2019

  • lock the entire Write operation
  • Added a test that Completes both reader and writer in the middle of writing a large buffer

cc @benaadams

Found in ASP.NET Core test

- lock the entire Write operation
- Added a test that Completes both reader and writer in the middle of writing a large buffer
@davidfowl davidfowl requested review from jkotalik and pakrym April 18, 2019 06:18
@benaadams
Copy link
Member

Still think TestHost.ResponseStream also needs fixing so you can't call write and complete at the same time on different threads.

@davidfowl
Copy link
Member Author

Still think TestHost.ResponseStream also needs fixing so you can't call write and complete at the same time on different threads.

Yep. Looking at that.

{
for (int i = 0; i < 1000; i++)
{
var buffer = new byte[10000000];

Choose a reason for hiding this comment

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

Nit: Allocate this array outside of the try.

{
// This is the multi segment copy
WriteMultiSegment(source.Span);
}

Choose a reason for hiding this comment

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

Is there any concern of acquiring and releasing the lock immediately between here and FlushAsync? Can a call interleave in here that would affect the write call? I doubt it, but it's the only cause for concern I see.

Copy link
Member Author

Choose a reason for hiding this comment

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

Should be fine. Efficiency.

@davidfowl davidfowl merged commit 90d98b9 into master Apr 18, 2019
@stephentoub stephentoub deleted the davidfowl/pipelines-null-ref branch April 18, 2019 17:42
@karelz karelz added this to the 3.0 milestone May 4, 2019
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
- lock the entire Write operation
- Added a test that Completes both reader and writer in the middle of writing a large buffer

Commit migrated from dotnet/corefx@90d98b9
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants