You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when MemoryObjectReceiveStream.close() is called, it completes the asyncio.Event for the senders, this should allow any senders awaiting the Event to continue.
But it does not remove the sender Event objects from the MemoryObjectStreamState. This appears to lead to BrokenResourceErrors in MemoryObjectSendStream.send() as they have not been removed from the dictionary, but they were completed by calling event.set().
This appears to at least happen when using async with on an MemoryObjectReceiveStream object.
Is this expected behavior when MemoryObjectReceiveStream.close() is called? To prevent raising an exception, what better way would there be beside using an async context manager on the MemoryObjectReceiveStream object?
Just to note, I'm tracking this down from its use in Starlette where we periodically see this exception raised.
The text was updated successfully, but these errors were encountered:
Currently, when
MemoryObjectReceiveStream.close()
is called, it completes theasyncio.Event
for the senders, this should allow any senders awaiting the Event to continue.anyio/src/anyio/streams/memory.py
Lines 142 to 145 in 48efdec
But it does not remove the sender Event objects from the
MemoryObjectStreamState
. This appears to lead toBrokenResourceErrors
inMemoryObjectSendStream.send()
as they have not been removed from the dictionary, but they were completed by callingevent.set()
.anyio/src/anyio/streams/memory.py
Lines 220 to 221 in 48efdec
This appears to at least happen when using
async with
on anMemoryObjectReceiveStream
object.Is this expected behavior when
MemoryObjectReceiveStream.close()
is called? To prevent raising an exception, what better way would there be beside using an async context manager on theMemoryObjectReceiveStream
object?Just to note, I'm tracking this down from its use in Starlette where we periodically see this exception raised.
The text was updated successfully, but these errors were encountered: