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 bquinlan
Recipients Steven.Barker, bquinlan
Date 2019-05-07.18:51:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557255075.8.0.641381100936.issue31783@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-05-07 18:51:15bquinlansetrecipients: + bquinlan, Steven.Barker
2019-05-07 18:51:15bquinlansetmessageid: <1557255075.8.0.641381100936.issue31783@roundup.psfhosted.org>
2019-05-07 18:51:15bquinlanlinkissue31783 messages
2019-05-07 18:51:15bquinlancreate