New submission from Florian Streibelt <git...@f-streibelt.de>:
The docs at the url https://docs.python.org/3/library/multiprocessing.html#module-multiprocessing.pool state in a red warning box: "Warning multiprocessing.pool objects have internal resources that need to be properly managed (like any other resource) by using the pool as a context manager or by calling close() and terminate() manually. Failure to do this can lead to the process hanging on finalization." however, when using the context manager, as it is also shown in the examples, the context manager will call terminate() instead of close() and join() on the pool, possible leading to deadlocks if I understand the documentation correct. It seems the only safe way of using a Pool as Context Manager is to manually call pool.close() and pool.join() prior to leaving it, which, to be honest, does not make sense to me. see pool.py: def __exit__(self, exc_type, exc_val, exc_tb): self.terminate() ---------- assignee: docs@python components: Documentation messages: 397360 nosy: docs@python, mutax priority: normal severity: normal status: open title: Multiprocessing Pool example and comments incomplete/wrong? versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44615> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com