Closed as not planned
Description
Bug report
Bug description:
python3.9 without uvloop doesn't leaks memory (or noticeably smaller).
python3.11+ (and others?) leaks memory A LOT under load (with or without uvloop) - up to +2gb per every test!
test commands:
ab -n50000 -c15000 -r https://127.0.0.1/
(apt install apache2-utils)
import asyncio, ssl, uvloop
class HTTP(asyncio.Protocol):
def __init__(self):
self.transport = None
def connection_made(self, transport):
self.transport = transport
def data_received(self, data):
self.transport.write(
b'HTTP/1.1 200 OK\r\nContent-Length: 0\r\nConnection: keep-alive\r\n\r\n'
)
self.transport.close()
def make_tls_context():
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
ctx.load_cert_chain('cert.crt', 'cert.key')
return ctx
tls_context = make_tls_context()
loop = uvloop.new_event_loop()
async def start_server(loop):
return await loop.create_server(
HTTP, '127.0.0.1', 443, backlog=65535,
ssl=tls_context)
loop.run_until_complete(start_server(loop))
loop.run_forever()
CPython versions tested on:
3.9, 3.11, 3.12
Operating systems tested on:
Debian Linux
Linked PRs
- gh-109534: Asyncio sslproto memleak #113338
- gh-109534: fix reference leak when SSL handshake fails #114074
- gh-109534: switch from sock_call to sock_call_ex in sock_send #114311
- pythongh-109534: close transport if waiter is done #114367
- [3.12] gh-109534: fix reference leak when SSL handshake fails (GH-114074) #114829
- [3.11] gh-109534: fix reference leak when SSL handshake fails (GH-114074) #114830
- pythongh-109534: get rid of bytearray as class member #115643
Metadata
Metadata
Assignees
Labels
Projects
Status
Done