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

Created on 2009-11-08 00:00 by pitrou, last changed 2009-11-09 16:54 by pitrou.

Files
File name Uploaded Description Edit Remove
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) 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) Date: 2009-11-09 11:59
An updated patch with test.
msg95089 - (view) Author: Antoine Pitrou (pitrou) Date: 2009-11-09 16:54
Committed in r76172-r76175.
History
Date User Action Args
2009-11-09 16:54:48pitrousetstatus: open -> closed
resolution: fixed
messages: + msg95089

stage: patch review -> committed/rejected
2009-11-09 11:59:17pitrousetfiles: + rlock_leak2.patch

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