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 pablogsal
Recipients Andrew Nelson, Paul Silisteanu, cjrh, larsoner, pablogsal, ralf.gommers, stefanor
Date 2020-04-10.17:54:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1586541246.67.0.487531483042.issue38501@roundup.psfhosted.org>
In-reply-to
Content
> If that's out of contract, perhaps there should probably a big, visible warning at the top of the multiprocessning docs stating that creating one of these objects requires either using a context manager or ensuring manual `.close()`ing?

Why? This is a resource like any other and it requires proper resource management. Would you also put a big warning on "open()" stating that opening a file requires either using a context manager or ensure a manual close()?

>  the first Python 2.7 example in the docs 

Python 2.7 is not supported and the pool has changed *a lot* since Python 2. For instance, the pool now does more correct resource management, it does not leak threads and it supports more safe mechanisms as a context manager. The reason it didn't hang that much in Python2.7 is likely because some threads were being leaked.

> This is called automatically when the queue is garbage collected.

Yeah, and CPython does not promise that the __del__ method of any object will be called, so is not assured that the finalized will call close():

https://docs.python.org/3/reference/datamodel.html#object.__del__

"It is not guaranteed that __del__() methods are called for objects that still exist when the interpreter exits"
History
Date User Action Args
2020-04-10 17:54:06pablogsalsetrecipients: + pablogsal, cjrh, stefanor, ralf.gommers, larsoner, Andrew Nelson, Paul Silisteanu
2020-04-10 17:54:06pablogsalsetmessageid: <1586541246.67.0.487531483042.issue38501@roundup.psfhosted.org>
2020-04-10 17:54:06pablogsallinkissue38501 messages
2020-04-10 17:54:06pablogsalcreate