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 |