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.

Author vstinner
Recipients davin, serhiy.storchaka, vstinner
Date 2017-04-26.13:52:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1493214770.49.0.943228970697.issue30171@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2017-04-26 13:52:50vstinnersetrecipients: + vstinner, serhiy.storchaka, davin
2017-04-26 13:52:50vstinnersetmessageid: <1493214770.49.0.943228970697.issue30171@psf.upfronthosting.co.za>
2017-04-26 13:52:50vstinnerlinkissue30171 messages
2017-04-26 13:52:50vstinnercreate