New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
concurrent.futures.ProcessPoolExecutor
swallows tracebacks
#66016
Comments
When you use 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. |
Hello. Here's a patch based on c4f92b597074, which adds something similar to multiprocessing.pool. concurrent.futures.process.RemoteTraceback:
"""
Traceback (most recent call last):
File "D:\Projects\cpython\lib\concurrent\futures\process.py", line 153, in _process_worker
r = call_item.fn(*call_item.args, **call_item.kwargs)
File "D:\Projects\cpython\PCbuild\a.py", line 9, in f
return g()
File "D:\Projects\cpython\PCbuild\a.py", line 13, in g
assert False
AssertionError
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "a.py", line 20, in <module>
future.result()
File "D:\Projects\cpython\lib\concurrent\futures\_base.py", line 402, in result
return self.__get_result()
File "D:\Projects\cpython\lib\concurrent\futures\_base.py", line 354, in __get_result
raise self._exception
AssertionError It's a little better than the current output, even though it's a little verbose. |
Any type of feedback regarding this approach will be appreciated. |
Hi Claudiu, sorry for the silence. This output looks great. I'd love to see that go into Python. |
Here's the updated version of this patch. |
Hi, here are some comments about the patch:
|
Thanks, Antoine! Here's the new version, with your comments addressed. |
New changeset a36b402b099b by Antoine Pitrou in branch 'default': |
Thank you very much. Everything is now committed. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: