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
DM-38165: Suppress traceback for a crashing task in unit test #224
Conversation
Apparently `faulthandler` is now enabled by default (which is a good thing in general) and it prints a long confusing traceback for the unit test that uses signal to kill a task. Disabling `faulthandler` in that task is sufficient to suppress traceback.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #224 +/- ##
==========================================
- Coverage 82.36% 82.34% -0.02%
==========================================
Files 46 46
Lines 4031 4033 +2
Branches 769 769
==========================================
+ Hits 3320 3321 +1
- Misses 527 528 +1
Partials 184 184
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@@ -186,6 +187,8 @@ class TaskMockCrash: | |||
|
|||
def runQuantum(self): | |||
_LOG.debug("TaskMockCrash.runQuantum") | |||
# Disable fault handler to suppress long scary traceback. | |||
faulthandler.disable() |
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.
I'm not familiar with faulthandler
, but this looks like a global setting. Don't you need to re-enable it when the test is complete? Not sure how to do this if the task object is responsible for the setting, though; I'm guessing raise_signal
bypasses finally
blocks?
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.
This is indeed a global setting for the whole process, but in this case it's fine because the process that runs the task is killed immediately on the next line. This task is only ever used in a forked execution (otherwise signal would kill the whole test) so it does not affect faulthandler
in the parent process.
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.
Could you add a comment to that effect? It's not at all obvious in context that the task must only be run in an isolated environment.
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.
Sorry, I pushed "Merge" already. I'll try to remember adding that on some other ticket.
Apparently
faulthandler
is now enabled by default (which is a good thing in general) and it prints a long confusing traceback for the unit test that uses signal to kill a task. Disablingfaulthandler
in that task is sufficient to suppress traceback.Checklist
doc/changes