New submission from Alexander Mohr:

When upgrading to 3.5.3 we noticed that the requests module was leaking memory 
rather quickly.  This led to me logging the issue: 
https://github.com/kennethreitz/requests/issues/3933.  After more investigation 
I've found that the leak is caused by the raw python SSL sockets.  I've created 
a test file here: 
https://gist.github.com/thehesiod/ef79dd77e2df7a0a7893dfea6325d30a which allows 
you to reproduce the leak with raw python ssl socket (CLIENT_TYPE = 
ClientType.RAW), aiohttp or requests.  They all leak in a similar way due to 
their use of the python SSL socket objects.  I tried tracing the memory usage 
with tracemalloc but nothing interesting popped up so I believe this is a leak 
in the native code.

A docker cloud image is available here: amohr/testing:stretch_request_leak 
based on:
```
FROM debian:stretch

COPY request_https_leak.py /tmp/request_https_leak.py

RUN apt-get update && \
    apt-get install -y python3.5 python3-pip git

RUN python3 -m pip install requests 
git+git://github.com/thehesiod/pyca.git@fix-py3#egg=calib setproctitle requests 
psutil
```

I believe this issue was introduced in python 3.5.3 as we're not seeing the 
leak with 3.5.2.  Also I haven't verified yet if this happens on non-debian 
systems.  I'll update if I have any more info.  I believe 3.6 is similarly 
impacted but am not 100% certain yet.

----------
assignee: christian.heimes
components: SSL
messages: 289954
nosy: christian.heimes, thehesiod
priority: normal
severity: normal
status: open
title: ssl socket leak
type: resource usage
versions: Python 3.5

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

Reply via email to