Skip to content

ArrowStreamReader.GetSchema (async) does synchronous IO when stream is empty #80

Description

@spanglerco

Describe the bug, including details regarding any error messages, version, and platform.

When given an empty stream, calls to ArrowStreamReader.GetSchema() first calls ArrowStreamReaderImplementation.GetSchemaAsync() and then retrieves the Schema property. When the stream is empty, GetSchemaAsyncreturns early without setting _schema.

Then, the Schema property getter, seeing that _schema is still null, calls ArrowStreamReaderImplementation.GetSchema() (the synchronous version). This ends up performing a synchronous read on the (still empty) stream.

In particular, this is an issue when the stream is an HTTP request body from Kestrel (ASP.NET), which blocks synchronous IO by default. The result is an InvalidOperationException.

I'm willing to provide a PR if someone else doesn't get to it. My initial reaction would be to change ArrowReaderImplementation.GetSchemaAsync() to return a ValueTask<Schema>, but that's not the only possible solution.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions