Skip to content
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

Merged
merged 1 commit into from Feb 28, 2023

Conversation

andy-slac
Copy link
Collaborator

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.

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes

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
Copy link

codecov bot commented Feb 28, 2023

Codecov Report

Patch coverage: 50.00% and project coverage change: -0.02 ⚠️

Comparison is base (62b5552) 82.36% compared to head (79dfb72) 82.34%.

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              
Impacted Files Coverage Δ
tests/test_executors.py 90.82% <50.00%> (-0.25%) ⬇️

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -186,6 +187,8 @@ class TaskMockCrash:

def runQuantum(self):
_LOG.debug("TaskMockCrash.runQuantum")
# Disable fault handler to suppress long scary traceback.
faulthandler.disable()
Copy link
Member

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?

Copy link
Collaborator Author

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.

Copy link
Member

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.

Copy link
Collaborator Author

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.

@andy-slac andy-slac merged commit 2a71bd6 into main Feb 28, 2023
@andy-slac andy-slac deleted the tickets/DM-38165 branch February 28, 2023 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants