Do not report SignalExceptions in at_exit handler #477
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goal
The previous behaviour resulted in applications reporting errors even though they were gracefully and without any problems shut down. Example: the puma webserver relies on
SIGTERM
to gracefully shut down its workers and Bugsnag reported errors when it was normally shut down.With the
at_exit
handler introduced in #397, Bugsnag would catchSignalExceptions
on exit and report them as error, even though they are none.This PR changes the existing behaviour to add
SignalException
as a special case in which the exception should not be passed toBugsnag.notify
.Changeset
Added
Bugsnag.at_exit_handler
Changed
Bugsnag.register_at_exit
Tests
Due to the Ruby exiting when a
SignalException
is raised I had to refactor the code to make the actual handling of the exit-exceptions testable without the test suite quitting.Linked issues
For more information on puma's behaviour, see here: puma/puma#1438
Honeybadger also ignores
SignalException
s: honeybadger-io/honeybadger-ruby#267Review
For the submitter, initial self-review:
For the pull request reviewer(s), this changeset has been reviewed for: