Skip to content

Memory leak on multiple async connections. #42

@T-256

Description

@T-256

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

import asyncio

async def leak():
    async with httpx.AsyncClient(timeout=21) as client:
        async with httpx_ws.aconnect_ws(
            f"https://socketsbay.com/wss/v2/1/demo/",
            client,
        ) as ws_client:
            pass

input("before")
asyncio.run(asyncio.gather(*[leak() for _ in range(100)]))
input("after")

Expected behavior

No memory leak

Configuration

  • Python version: 3.7 (32 bit) on win 11 (64 bit)
  • httpx-ws version: 0.4.1

Additional context

In my run of above code memory bump from 10MB to 80MB

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions