Skip to content

Server streaming handler not cancelled on client disconnect #174

@wolves-fc

Description

@wolves-fc

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:

  1. Create server streaming endpoint a generator that yields indefinitely (e.g. a watch rpc)
  2. Connect to it with a client
  3. Kill the client
  4. Observe the server logging the socket.send() raised exception indefinitely

Workaround:

ASGI middleware that queues receive()

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