Skip to content

Assert in _drain_helper when sending websocket message #2934

Closed
@willmcgugan

Description

Long story short

We see bursts of the following exception on our websocket server.

Traceback (most recent call last):
  File "", line 378, in _on_packet
    await self.dispatch(packet)
  File "", line 67, in dispatch
    await method(self, packet)
  File "", line 550, in handle_request_send
    packet.data
  File "", line 216, in route
    packets.Route(route_no, data)
  File ", line 289, in send
    if not await self.send_bytes(packet_bytes):
  File "", line 297, in send_bytes
    await self.ws.send_bytes(packet_bytes)
  File "lib/python3.6/site-packages/aiohttp/web_ws.py", line 263, in 
    await self._writer.send(data, binary=True, compress=compress)
  File "lib/python3.6/site-packages/aiohttp/http_websocket.py", line 607, 
    return await self._send_frame(message, WSMsgType.BINARY, compress)
  File "lib/python3.6/site-packages/aiohttp/http_websocket.py", line 588, 
    await self.protocol._drain_helper()
  File "lib/python3.6/asyncio/streams.py", line 214, in _drain_helper
    assert waiter is None or waiter.cancelled()
AssertionError

(paths censored at client's request)

I'm guessing its a flow control issue? We're essentially copying data from one websocket to another and rely on back pressure to keep things running.

I can't reproduce it easily, but happy to investigate if it would help.

Your environment

A websocket server running aiohttp==3.1.0 on Linux

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