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 DarinTay
Recipients DarinTay
Date 2020-04-29.22:52:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1588200729.96.0.263407738291.issue40444@roundup.psfhosted.org>
In-reply-to
Content
I ran into a deadlock that I've reduced to a small and consistent repro, tested on 3.7.5 and 3.8.0.


Reading through https://bugs.python.org/issue6721 now I suspect it is just another case of that, but not certain.


In particular, I'm not using any explicit threads, though presumably multiprocessing.Pool is using one under-the-hood.  If so, it seems a bit rough that multiprocessing can by itself cause the fork issues it tries to warn about ("Note that safely forking a multithreaded process is problematic.")



# This very quickly and consistently hangs after a few attempts on my machines
def run(x):
    print("Worker with ", x)
    return x

def main():
    for i in range(1000):
        print("Attempt #", i)
        from multiprocessing import Pool

        with Pool(processes=16, maxtasksperchild=1) as p:
            for entry in p.imap_unordered(run, range(50)):
                print("Main received back ", entry)


if __name__ == "__main__":
    main()
History
Date User Action Args
2020-04-29 22:52:09DarinTaysetrecipients: + DarinTay
2020-04-29 22:52:09DarinTaysetmessageid: <1588200729.96.0.263407738291.issue40444@roundup.psfhosted.org>
2020-04-29 22:52:09DarinTaylinkissue40444 messages
2020-04-29 22:52:09DarinTaycreate