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
mgr: fixes python error handling #21005
Conversation
src/mgr/PyModule.cc
Outdated
try { | ||
formatted_list = format_exception(hexc,hval, htb); | ||
} catch (error_already_set const &) { | ||
return "exception raised in traceback.format_exception_only"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/format_exception_only/format_exception/g
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
07332b4
to
49575ca
Compare
Out of curiousity, what was the exception that format_exception_only was throwing? |
I was wondering the same thing. Do we care that this piece is effectively invisible? |
49575ca
to
77229b6
Compare
First of all, this problem only occurs when running ceph-mgr daemon with python 3.
I updated the PR fix to show the exception type, plus exception value, when the For instance, when calling the |
The current `handle_pyerror` function implementation relies in the `traceback.format_exception_only` python function to format the exception object. The problem is that this python function might also raise an exception. This commit fixes it by enclosing that python function call in try...catch block. Fixes: http://tracker.ceph.com/issues/23406 Signed-off-by: Ricardo Dias <rdias@suse.com>
77229b6
to
072699d
Compare
@tserong removed the two unused variables from the code |
jenkins retest this please |
1 similar comment
jenkins retest this please |
The current
handle_pyerror
function implementation relies in thetraceback.format_exception_only
python function to format theexception object. The problem is that this python function might also
raise an exception. This commit fixes it by enclosing that python
function call in try...catch block.
Fixes: http://tracker.ceph.com/issues/23406
Signed-off-by: Ricardo Dias rdias@suse.com