New submission from Recursing <buonanno.lore...@gmail.com>:

Minimal code to reproduce:
```
import ssl
import certifi
import gc
import asyncio


ca_path = certifi.where()
async def make_async_context() -> None:
    context = ssl.SSLContext(ssl.PROTOCOL_TLS)
    context.load_verify_locations(ca_path)
    await asyncio.sleep(1)


async def main(n: int) -> None:
    await asyncio.wait([make_async_context() for _ in range(n)])


gc.collect()
asyncio.run(main(2000))
input("Finished run, still using lots of memory :(")
gc.collect()
input("gc.collect() does not help :(")
```

Running this code on several linux machines (with python from 3.6.9 to 3.9.0a5, 
and openSSL from 1.1.1  11 Sep 2018 to 1.1.1g  21 Apr 2020) causes a 
significant memory leak, while on windows memory usage peaks around 1 GB but 
gets freed

----------
assignee: christian.heimes
components: Library (Lib), SSL, asyncio
messages: 369573
nosy: Recursing, asvetlov, christian.heimes, yselivanov
priority: normal
severity: normal
status: open
title: SSLContext.load_verify_locations leaks memory on Linux in async code
type: resource usage
versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40727>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to