This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: RLocks leak references when used in raw threads
Type: resource usage Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: pitrou
Priority: normal Keywords: patch

Created on 2009-11-08 00:00 by pitrou, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
rlock_leak.patch pitrou, 2009-11-08 00:00
rlock_leak2.patch pitrou, 2009-11-09 11:59
Messages (3)
msg95029 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-11-08 00:00
When you use an RLock from a thread which wasn't created through the
high-level `threading` API (but, for example, using
thread.start_new_thread()), the RLock creates a DummyThread object by
calling current_thread(), and that DummyThread is immortal (as well as
its attributes etc.). This implementation wart can easily lead to
reference leaks for unsuspecting users.

One simple solution is not to call current_thread() in RLock, but use
get_ident() instead. Patch attached.
msg95074 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-11-09 11:59
An updated patch with test.
msg95089 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-11-09 16:54
Committed in r76172-r76175.
History
Date User Action Args
2022-04-11 14:56:54adminsetgithub: 51531
2009-11-09 16:54:48pitrousetstatus: open -> closed
resolution: fixed
messages: + msg95089

stage: patch review -> resolved
2009-11-09 11:59:17pitrousetfiles: + rlock_leak2.patch

messages: + msg95074
2009-11-08 00:00:39pitroucreate