Skip to content

Commit

Permalink
feat: Support for ignored signals with SIGN_IGN (#1489)
Browse files Browse the repository at this point in the history
Currently, if a signal is ignored via SIG_IGN (which is especially common for signals like SIGPIPE), Sentry will still report a fatal, unhandled crash even though the application never received the signal and continued to run just fine.

This PR fixes this behavior by only setting a signal handler to report a crash from signal if the original handler is NOT SIG_IGN.

Fixes GH-1472

Co-authored-by: Philipp Hofmann <[email protected]>
  • Loading branch information
alokedesai and philipphofmann authored Dec 2, 2021
1 parent 6e716c6 commit 0b468b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 7.5.4

- fix: Sending OOM when SDK is closed (#1487)
- feat: Don't mark a signal as a crash if the signal was ignored via `SIG_IGN` (#1489)

## 7.5.3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ installSignalHandler()
sigaction(fatalSignals[i], &g_previousSignalHandlers[i], NULL);
}
goto failed;
} else {
// The previous handler was `SIG_IGN` -- restore the original handler so
// we don't override the `SIG_IGN` and report a crash when the application
// would have ignored the signal otherwise.
if (g_previousSignalHandlers[i].sa_handler == SIG_IGN) {
sigaction(fatalSignals[i], &g_previousSignalHandlers[i], NULL);
}
}
}
SentryCrashLOG_DEBUG("Signal handlers installed.");
Expand Down

0 comments on commit 0b468b8

Please sign in to comment.