Skip to content

Increasing number of asyncio tasks causing memory leak #699

@levesquejf

Description

@levesquejf

I have a Websockets client that is always running. Once in a while, the client is disconnected from the server. It’s either because of network issues between the client and the server or because it is connected for too long and the client just reconnects to balance the charge on the servers. The client automatically reconnects to the server. I am using the websockets.connect() context to build the connection.

After a few weeks, the number of asyncio tasks is very high. When I list the tasks with asyncio.Task.all_tasks(), I see hundreds of websocket finished tasks:

  • WebSocketCommonProtocol.close_connection()
  • WebSocketCommonProtocol.transfer_data()

I am running Python 3.6.9 and Websockets 8.1. Any idea what could be the cause and how to troubleshoot further?

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