[New-bugs-announce] [issue30171] Emit ResourceWarning in multiprocessing Queue destructor
STINNER Victor
report at bugs.python.org
Wed Apr 26 09:52:50 EDT 2017
New submission from STINNER Victor:
A multiprocessing Queue object managers multiple resources:
* a multiprocessing Pipe
* a thread
* (a lock and a semaphore)
If a Queue is not cleaned up properly, your application may leak many resources.
Try attached queue_leak.py to see an example "leaking a thread".
I suggest to emit a ResourceWarning warning in Queue destrutor. I don't know what should be the test to decide if a warning must be emitted?
* if the queue wasn't closed yet?
* if the thread is alive?
* if the queue wasn't closed yet and/or the thread is alive? (my favorite choice)
Other examples of objects emitting ResourceWarning:
* io files: io.FileIO, io.TextIOWrapper, etc.
* socket.socket
* subprocess.Popen: I recently added a ResourceWarning on that one
* asyncio transports and event loops
----------
components: Library (Lib)
files: queue_leak.py
messages: 292346
nosy: davin, haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Emit ResourceWarning in multiprocessing Queue destructor
type: resource usage
versions: Python 3.7
Added file: http://bugs.python.org/file46830/queue_leak.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30171>
_______________________________________
More information about the New-bugs-announce
mailing list