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 arigo
Recipients arigo
Date 2017-07-19.08:53:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1500454402.66.0.425527808924.issue30966@psf.upfronthosting.co.za>
In-reply-to
Content
multiprocessing.queues.SimpleQueue should have a close() method.  This is needed to explicitly release the two file descriptors of the Pipe used internally.  Without it, the file descriptors leak if a reference to the SimpleQueue object happens to stay around for longer than expected (e.g. in a reference cycle, or with PyPy).

I think the following would do:

diff -r 0b72fd1a7641 lib-python/2.7/multiprocessing/queues.py
--- a/lib-python/2.7/multiprocessing/queues.py  Sun Jul 16 13:41:28 2017 +0200
+++ b/lib-python/2.7/multiprocessing/queues.py  Wed Jul 19 10:45:03 2017 +0200
@@ -358,6 +358,11 @@
             self._wlock = Lock()
         self._make_methods()

+    def close(self):
+        # PyPy extension: CPython doesn't have this method!
+        self._reader.close()
+        self._writer.close()
+
     def empty(self):
         return not self._reader.poll()
History
Date User Action Args
2017-07-19 08:53:22arigosetrecipients: + arigo
2017-07-19 08:53:22arigosetmessageid: <1500454402.66.0.425527808924.issue30966@psf.upfronthosting.co.za>
2017-07-19 08:53:22arigolinkissue30966 messages
2017-07-19 08:53:21arigocreate