[New-bugs-announce] [issue40657] Resource leaks with threading.Thread

Rosen Tomov report at bugs.python.org
Sun May 17 04:07:51 EDT 2020


New submission from Rosen Tomov <poceh at yahoo.com>:

In my project I'm using intensively threading to transfer HTTP data - reading is in separate thread and the process run smoothly. However when I've try to optimize stopping of the process and attempt to use the daemon threads. The result was 'Can't start new thread' error under Linux. In order to investigate the issue I've create small test program and found more interesting problem: using non daemon threads leaks handles (under Windows/x64 Semaphore type), while under Linux looks like leaks some other resource, can't say exactly what. When using a daemon threads no leaks handles under Windows but under Linux, after long time running the problem arrives, the only one solution is to reboot of Linux/ARM64, restarting the Python process didn't help! Of course the problem could be race condition or some locking problem, didn't investigate further and in Python's core source. 
Attached test programs reveals the problem very quickly, using Python 3.8.x interpreters. Also I've testing with lambdas and deletion and found that they do not influence the behavior.

----------
components: Interpreter Core
files: thread.py
messages: 369102
nosy: POCEH
priority: normal
severity: normal
status: open
title: Resource leaks with threading.Thread
type: resource usage
versions: Python 3.8
Added file: https://bugs.python.org/file49162/thread.py

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


More information about the New-bugs-announce mailing list