Issue:
When a client disconnects during a server streaming RPC, the async generator is never closed. The generator continues yielding indefinitely and each yield produces a failed socket write and an asyncio warning:
WARNING:asyncio:socket.send() raised exception
Expected (or at least what I think should be happening):
the framework should monitor receive() for http.disconnect and call aclose() or something along those lines.
Reproduce:
- Create server streaming endpoint a generator that yields indefinitely (e.g. a watch rpc)
- Connect to it with a client
- Kill the client
- Observe the server logging the
socket.send() raised exception indefinitely
Workaround:
ASGI middleware that queues receive()