[New-bugs-announce] [issue44871] Threading memory leak

Andrei Zene report at bugs.python.org
Mon Aug 9 10:14:54 EDT 2021


New submission from Andrei Zene <andrei.zene at outlook.com>:

In an application where we were handling incoming requests in new threads, we noticed that the memory usage grew over time. After trying to understand what's going on, i was able to reproduce this with a smaller python script that i've attached.

What we do:
- start a thread
- the thread allocates some memory
- at some point later we join the thread

Notice that this seems to be more like a race-condition because it doesn't reproduce without adding some delays between the creation of different threads. I've added a comment in the file that basically commenting one time.sleep makes the leak to not reproduce anymore.

On the other side, I was able to reproduce this consistently with every version of python on mulitple systems but only on Linux. On windows it doesn't reproduce.

----------
files: threading_leak.py
messages: 399267
nosy: andzn
priority: normal
severity: normal
status: open
title: Threading memory leak
type: performance
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file50206/threading_leak.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44871>
_______________________________________


More information about the New-bugs-announce mailing list