Message341795
Great report Steven!
I was able to reproduce this with the attached patch (just adds some sleeps and prints) and this script:
from threading import current_thread
from concurrent.futures import ThreadPoolExecutor
from time import sleep
pool = ThreadPoolExecutor(100)
def f():
print("I'm running in: ", current_thread().name)
def g():
print("I'm running in: ", current_thread().name)
for _ in range(100):
pool.submit(f)
sleep(0.1)
pool.submit(g)
sleep(1.5)
The output for me was:
👶 Creating new thread: ThreadPoolExecutor-0_0
I'm running in: ThreadPoolExecutor-0_0
Setting _shutdown
💀 Killing 1 workers 💀
👶 Creating new thread: ThreadPoolExecutor-0_1
I'm running in: ThreadPoolExecutor-0_1
So another thread was created *after* shutdown.
It seems like the most obvious way to fix this is by adding a lock for the global _shutdown variable. |
|
Date |
User |
Action |
Args |
2019-05-07 18:51:15 | bquinlan | set | recipients:
+ bquinlan, Steven.Barker |
2019-05-07 18:51:15 | bquinlan | set | messageid: <1557255075.8.0.641381100936.issue31783@roundup.psfhosted.org> |
2019-05-07 18:51:15 | bquinlan | link | issue31783 messages |
2019-05-07 18:51:15 | bquinlan | create | |
|