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 drougge
Recipients drougge
Date 2020-08-17.11:37:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1597664250.53.0.724586569237.issue41567@roundup.psfhosted.org>
In-reply-to
Content
If several threads try to start a multiprocessing.Pool at the same time when no pool has been started before this often fails with an exception like this (the exact import varies):

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/tmp/py3.9.0rc1/lib/python3.9/threading.py", line 950, in _bootstrap_inner
    self.run()
  File "/tmp/py3.9.0rc1/lib/python3.9/threading.py", line 888, in run
    self._target(*self._args, **self._kwargs)
  File "/tmp/py3.9.0rc1/lib/python3.9/multiprocessing/context.py", line 118, in Pool
    from .pool import Pool
ImportError: cannot import name 'Pool' from partially initialized module 'multiprocessing.pool' (most likely due to a circular import) (/tmp/py3.9.0rc1/lib/python3.9/multiprocessing/pool.py)

This happens even if Pool was imported before starting the threads and is new in 3.9. It's easy to work around by starting a pool in the main thread before starting the other threads.

I have attached a minimal example that triggers it. Tested on Debian stable and FreeBSD 11.3.
History
Date User Action Args
2020-08-17 11:37:30drouggesetrecipients: + drougge
2020-08-17 11:37:30drouggesetmessageid: <1597664250.53.0.724586569237.issue41567@roundup.psfhosted.org>
2020-08-17 11:37:30drouggelinkissue41567 messages
2020-08-17 11:37:30drouggecreate