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

feat: Support for ignored signals with SIGN_IGN #1489

Merged
merged 5 commits into from
Dec 2, 2021

Conversation

alokedesai
Copy link
Contributor

@alokedesai alokedesai commented Nov 29, 2021

📜 Description

💡 Motivation and Context

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

#1472

💚 How did you test it?

Tested locally--by using the local version of Sentry and ensuring sending the SIGPIPE signal (kill -SIGPIPE {pid}) didn't cause a sentry issue to be created. Tested that other signals were not ignored. Would love a way to add tests for this (I assume via an integration test) but from looking at the code it's not clear me to if there's infrastructure to do that currently.

📝 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • Review from the native team if needed
  • No breaking changes

🔮 Next steps

@alokedesai alokedesai changed the title Don't set a Signal handler if a signal is ignored via SIGN_IGN Don't set a signal handler if the signal is ignored via SIGN_IGN Nov 29, 2021
@philipphofmann philipphofmann changed the title Don't set a signal handler if the signal is ignored via SIGN_IGN feat: Don't set a signal handler if the signal is ignored via SIGN_IGN Nov 30, 2021
@alokedesai
Copy link
Contributor Author

@philipphofmann would you mind taking a pass on this PR? It's been sitting for a few days. Thanks so much!

@philipphofmann philipphofmann changed the title feat: Don't set a signal handler if the signal is ignored via SIGN_IGN feat: Support for ignored signals with SIGN_IGN Dec 1, 2021
Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add an entry to the Changelog, please? As I'm not an expert on signal handlers, I need someone from the native team to review this PR.

@Swatinem, can you help us out here, and do you know how to add tests for this? I have no idea how to test signal handlers.

@codecov-commenter
Copy link

codecov-commenter commented Dec 1, 2021

Codecov Report

Merging #1489 (cbbed26) into master (8564e3a) will not change coverage.
The diff coverage is n/a.

❗ Current head cbbed26 differs from pull request most recent head c88e911. Consider uploading reports for the commit c88e911 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1489   +/-   ##
=======================================
  Coverage   95.93%   95.93%           
=======================================
  Files         157      157           
  Lines        7003     7003           
=======================================
  Hits         6718     6718           
  Misses        285      285           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6e716c6...c88e911. Read the comment docs.

@alokedesai
Copy link
Contributor Author

Can you please add an entry to the Changelog, please? As I'm not an expert on signal handlers, I need someone from the native team to review this PR.

@Swatinem, can you help us out here, and do you know how to add tests for this? I have no idea how to test signal handlers.

Sure--added an entry to the changelog. Tried my best to match existing wording but lmk if there are any edits you'd like me to make to it

@philipphofmann philipphofmann merged commit 0b468b8 into getsentry:master Dec 2, 2021
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.

4 participants