Scary (but harmless) warnings when transaction streams and connections are closed
Opened this issue · 0 comments
da-tanabe commented
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.