New submission from gaborbernat <gaborjber...@gmail.com>:
Assume the following code: ```python from multiprocessing.pool import ThreadPool class A(object): def __init__(self): self.pool = ThreadPool() def __del__(self): self.pool.close() self.pool.join() a = A() print(a) ``` The code snippet above hangs forever on Python 3.8+ (works ok on Python 3.7 and earlier). An example output where I've added some extra prints on to the thread joins: ``` <__main__.A object at 0x1104d6070> join thread <Thread(Thread-13, started daemon 123145699672064)> None done join thread <Thread(Thread-14, stopped daemon 123145716461568)> None done join thread <Thread(Thread-15, stopped daemon 123145733251072)> None done join thread <Thread(Thread-13, stopped daemon 123145699672064)> None done join thread <Thread(Thread-14, stopped daemon 123145716461568)> None done join thread <Thread(Thread-15, stopped daemon 123145733251072)> None done join thread <DummyProcess(Thread-1, stopped daemon 123145498198016)> None done join thread <DummyProcess(Thread-2, stopped daemon 123145514987520)> None done join thread <DummyProcess(Thread-3, stopped daemon 123145531777024)> None done join thread <DummyProcess(Thread-4, stopped daemon 123145548566528)> None done join thread <DummyProcess(Thread-5, started daemon 123145565356032)> None ``` I've tested on MacOs, but could replicate on Linux too within the CI. ---------- components: Library (Lib) messages: 360119 nosy: gaborbernat, vstinner priority: normal severity: normal status: open title: python3.8 regression - ThreadPool join via __del__ hangs forever versions: Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39360> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com