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 xtreak
Recipients docs@python, kahara, xtreak
Date 2018-09-24.12:51:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1537793512.12.0.956365154283.issue34786@psf.upfronthosting.co.za>
In-reply-to
Content
I think it raises BrokenThreadPool . A sample program that I tried as below raising an exception in the initializer. Maybe I am wrong here. Can you please attach a script that triggers BrokenProcessPool?

# bpo34786.py

import concurrent.futures
import time

def bar(i):
    raise Exception(i) # Raise exception from the initializer

def foo(i):
    time.sleep(i)
    return "1"

with concurrent.futures.ThreadPoolExecutor(max_workers=5,
                                           initializer=bar, initargs=(1,)) as executor:
    future_to_url = {executor.submit(foo, i, 60): i for i in range(10)}
    for future in concurrent.futures.as_completed(future_to_url):
        try:
            data = future.result()
        except Exception as exc:
            print('generated an exception: %s' % (exc))
        else:
            print('%d bytes' % (len(data)))

# Run the program

./python.exe ../backups/bpo34786.py
Exception in initializer:
Traceback (most recent call last):
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/concurrent/futures/thread.py", line 69, in _worker
    initializer(*initargs)
  File "../backups/bpo34786.py", line 5, in bar
    raise Exception(i)
Exception: 1
Exception in initializer:
Traceback (most recent call last):
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/concurrent/futures/thread.py", line 69, in _worker
    initializer(*initargs)
  File "../backups/bpo34786.py", line 5, in bar
    raise Exception(i)
Exception: 1
Traceback (most recent call last):
  File "../backups/bpo34786.py", line 13, in <module>
    future_to_url = {executor.submit(foo, i, 60): i for i in range(10)}
  File "../backups/bpo34786.py", line 13, in <dictcomp>
    future_to_url = {executor.submit(foo, i, 60): i for i in range(10)}
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/concurrent/futures/thread.py", line 148, in submit
    raise BrokenThreadPool(self._broken)
concurrent.futures.thread.BrokenThreadPool: A thread initializer failed, the thread pool is not usable anymore



Thanks
History
Date User Action Args
2018-09-24 12:51:52xtreaksetrecipients: + xtreak, docs@python, kahara
2018-09-24 12:51:52xtreaksetmessageid: <1537793512.12.0.956365154283.issue34786@psf.upfronthosting.co.za>
2018-09-24 12:51:52xtreaklinkissue34786 messages
2018-09-24 12:51:52xtreakcreate