Skip to content

Deadlock on Stream.ReadAsync #165

@Banyc

Description

@Banyc

Describe the bug

ReadAsync will hang forever at the second call with the different offset and count.

To Reproduce
Steps to reproduce the behavior:

To run the code below:

await using (Stream stream = await file.OpenReadAsync()) {
    int fileSize = (int)fileInfo.Size;
    int start = 0;
    int end = 0;
    do
    {
        end = start + bufferSize;
        if (end > fileSize)
        {
            end = fileSize;
        }

        await stream.ReadAsync(buffer, start, end - start);
        
        start += bufferSize;

    } while (end < fileSize);
}

Expected behavior

No deadlock or forever-hanging.

Screenshots

Unrelated.

Project type
'Server-side'/'SSB' or 'Client-side'/'CSB' (or when applicable, specify 'Both SSB/CSB')

  • Server-side

Environment

  • Browser [e.g. chrome, safari]
    • Chrome
  • Version of Blazor.FileReader
    • 2.1.0.20274
  • Version of .net sdk
    • 3.1.401

Additional context

Chunk uploading.

Metadata

Metadata

Assignees

Labels

need more infoRequest or question needs to be completed with more info from poster

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions