Skip to content

Scary (but harmless) warnings when transaction streams and connections are closed #397

@da-tanabe

Description

@da-tanabe

These usually happy when the connection is being closed while it's still trying to serve a stream:

async def find_first_event():
    async with connect(...) as conn:
        async with conn.query(...) as stream:
            async for ev in stream:
                return ev

In this case, the stream is broken because each context (async with) is closed, and dazl and grpcio aren't quite smart enough to suppress CancelledError exceptions when in-use streams are open against an underlying channel that is also being closed.

Ideally nothing would be logged in this case, because the errors aren't actually errors—they're just objects that are naturally being closed. Unfortunately Python signals "normal" flow using exceptions sometimes, and so some special handling has to happen somewhere to prevent these expected exceptions from being logged.

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