[New-bugs-announce] [issue39360] python3.8 regression - ThreadPool join via __del__ hangs forever
gaborbernat
report at bugs.python.org
Thu Jan 16 08:23:44 EST 2020
New submission from gaborbernat <gaborjbernat at 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 <report at bugs.python.org>
<https://bugs.python.org/issue39360>
_______________________________________
More information about the New-bugs-announce
mailing list