Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

ReferenceReadStream implementation doesn't properly implement Begin/End pattern #602

Closed
davidfowl opened this issue Mar 31, 2016 · 2 comments
Assignees
Milestone

Comments

@davidfowl
Copy link
Member

The null ref described in this issue Azure/azure-storage-net#202 occurs because of a bug in the Azure sdk and a bug in http abstractions. ReferernceReadStream implements BeginRead using ReadAsync (https://github.com/aspnet/HttpAbstractions/blob/dev/src/Microsoft.AspNetCore.Http/Internal/ReferenceReadStream.cs#L128), the code in ReadAsync always calls the callback, even if ReadAsync completes synchronously. This can cause stackoverflows in calling code and bugs like the null reference one in the storage sdk.

/cc @Tratcher

@davidfowl
Copy link
Member Author

Since we're using Task as the IAsyncResult implementation which never sets CompletedSynchronously to true, the easiest fix would be to dispatch the callback (aka Task.Run)

@Tratcher Tratcher self-assigned this Mar 31, 2016
@Tratcher
Copy link
Member

RE: #517 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants