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.

classification
Title: multiprocessing.Server swallows original exception traceback
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: davin, pitrou, salgado
Priority: normal Keywords: patch

Created on 2018-07-11 15:20 by salgado, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 8254 open python-dev, 2018-07-11 15:37
Messages (1)
msg321480 - (view) Author: Guilherme Salgado (salgado) * Date: 2018-07-11 15:20
multiprocessing.Server swallows original exception traceback, making it hard to debug. For example, the following code:

```
from multiprocessing.managers import BaseManager

class FooBar(object):
    def m(self):
        self._raise()
    def _raise(self):
        raise ValueError

class MyManager(BaseManager):
    pass

MyManager.register('Foo', callable=FooBar)
manager = MyManager()
manager.start()
manager.Foo()._callmethod('m')
manager.shutdown()
```
Gives me the following exception:

```
Traceback (most recent call last):
  File "/tmp/foo.py", line 15, in <module>
    manager.Foo()._callmethod('m')
  File "/usr/lib/python3.6/multiprocessing/managers.py", line 772, in _callmethod
    raise convert_to_error(kind, result)
ValueError
```

Ideally, I'd like to get something like this:

```
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/salgado/src/cpython/Lib/multiprocessing/managers.py", line 254, in serve_client
    res = function(*args, **kwds)
  File "/tmp/foo.py", line 5, in m
    self._raise()
  File "/tmp/foo.py", line 7, in _raise
    raise ValueError
ValueError
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/tmp/foo.py", line 15, in <module>
    manager.Foo()._callmethod('m')
  File "/home/salgado/src/cpython/Lib/multiprocessing/managers.py", line 811, in _callmethod
    raise convert_to_error(kind, result)
ValueError
```
History
Date User Action Args
2022-04-11 14:59:03adminsetgithub: 78279
2019-03-25 22:49:56cheryl.sabellasetnosy: + pitrou, davin
2018-07-11 15:37:03python-devsetkeywords: + patch
stage: patch review
pull_requests: + pull_request7786
2018-07-11 15:20:31salgadocreate