Message360119
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. | |
Date | User | Action | Args | 2020-01-16 13:23:44 | gaborjbernat | set | recipients: + gaborjbernat, vstinner | 2020-01-16 13:23:44 | gaborjbernat | set | messageid: <1579181024.48.0.144429938254.issue39360@roundup.psfhosted.org> | 2020-01-16 13:23:44 | gaborjbernat | link | issue39360 messages | 2020-01-16 13:23:43 | gaborjbernat | create | | |