Skip to content

InvalidStateError on output stream close in BiDi API #13

@BumaldaOverTheWater94

Description

@BumaldaOverTheWater94

When using the BiDi API and closing the output stream, I always see low-level CRT futures that raise concurrent.futures.InvalidStateError

This seems to be occurring because CRTResponseBody._on_complete() is invoking future.set_result(b"") when the future is already in a CANCELLED state.

Although the error is mostly cosmetic, it still interrupts any higher-level async task loops.

Please add a guard or something like:

if not future.cancelled():
    future.set_results(b"")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions