[issue21817] `concurrent.futures.ProcessPoolExecutor` swallows tracebacks

Ram Rachum report at bugs.python.org
Sat Jun 21 00:13:22 CEST 2014


New submission from Ram Rachum:

When you use `concurrent.futures.ProcessPoolExecutor` and an exception is raised in the created process, it doesn't show you the traceback. This makes debugging very annoying.

Example file:

    #!python
    
    import sys
    import concurrent.futures 
    
    def f():
        # Successful assert:
        assert True
        return g()
    
    def g():
        # Hard-to-find failing assert:
        assert False
    
        
    if __name__ == '__main__':
        with concurrent.futures.ProcessPoolExecutor(max_workers=1) as executor:
            assert isinstance(executor, concurrent.futures.Executor)
            future = executor.submit(f)
            future.result()
        print('Main process finished')
        
        
If you run this under Windows, you get this: 

    Traceback (most recent call last):
      File "./bug.py", line 20, in <module>
        future.result()
      File "c:\python34\lib\concurrent\futures\_base.py", line 402, in result
        return self.__get_result()
      File "c:\python34\lib\concurrent\futures\_base.py", line 354, in __get_result
        raise self._exception
    AssertionError

This is the traceback of the main process, while we want the traceback of the process that failed.

----------
components: Library (Lib)
messages: 221128
nosy: cool-RR
priority: normal
severity: normal
status: open
title: `concurrent.futures.ProcessPoolExecutor` swallows tracebacks
type: behavior
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21817>
_______________________________________


More information about the Python-bugs-list mailing list