Open bmourgues opened 6 months ago
Hello. Is this reproducible with a distro-default Python in any official/public container image? I'd rather not have a repro dependent on compiling CPython from scratch.
Is there a console log output that you can share?
Hello,
you can reproduce this issue on Debian bookworm (12.5)
I also managed to reproduce the same issue with cheroot version 10.0.0 in a virtual environment on the same system.
No log or console log, as everything works fine, but this memory leak
If needed, you can generate your certificate with following command :
openssl req -x509 -newkey rsa:2048 -nodes -keyout server.key -days 365 -out server.crt
After further investigation the leak appeared in version 8.3.0 Older versions do not seem to leak.
We suspect BuiltinSSLAdapter.get_environ(self, sock) method to be the root cause. Removing all code in this method except the first dict creation, seems to solve leak issue.
I hope this may help you to target the problem ...
❓ I'm submitting a ...
🐞 Describe the bug. What is the current behavior? When enabling ssl_adapter on
WSGIServer
, there is a memory leak each time a connection is received❓ What is the motivation / use case for changing the behavior?
💡 To Reproduce Using example code from cheroot with added
ssl_adapter
allows to reproduce the bugSteps to reproduce the behavior:
Run this server:
Make some requests:
for I in $(seq 2000); do wget --quiet -O /dev/null --no-check-certificate https://localhost:8078 ; done
See error:
read RSS value
from following command each time requests are made to serverps wu -p $(pgrep cheroot_test)
RSS value increases and never goes down.💡 Expected behavior Stable memory consumption for a server usage
📋 Details
📋 Environment
📋 Additional context
OpenSSL has been compiled from https://www.openssl.org/source/openssl-3.0.13.tar.gz without any special option (except install prefix)
Python has been compiled from source https://www.python.org/ftp/python/3.11.8/Python-3.11.8.tgz with following options
If you need more information or if I can help anyway tell me