-
-
Notifications
You must be signed in to change notification settings - Fork 160
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
fix: Setting the default level for crash events in Crashpad to fatal
#852
Conversation
fatal
fatal
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.
A note to other reviewers:
The call down below to crashpad_backend_flush_scope
has previously applied the default "warning"
level based on the scope, which then ended up in the event/scope file that is written to disk and being sent by crashpad.
With this solution, the customer also has a way to manually overwrite this value in their crash hook if they want to.
As this code is in the crash hook, what I believe is still missing is making sure this works on mac as well, which does not call these hooks, but rather just picks up the event file that is regularly written on scope changes.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #852 +/- ##
==========================================
- Coverage 82.53% 82.50% -0.03%
==========================================
Files 53 53
Lines 7362 7368 +6
Branches 1186 1186
==========================================
+ Hits 6076 6079 +3
- Misses 1176 1179 +3
Partials 110 110 |
This hits at the core of whether this should be allowed. But yes, the idea was to enable hook users to overwrite the default behavior based on whatever they retrieve from the crash event since the scope application also checks whether
I am also unhappy with the asymmetry, but as far as I understood, the push for this change comes from the unreal-minidump handler in |
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.
LGTM, if @Swatinem does agree with my points in the last comment (and yeah, changelog :P ).
I am reluctant to this change because I think I still don't understand what happened in the backend that requires that change. I just tested Was your suggestion @Swatinem to initialize the level in the scope to |
Effects of backend changes unclear at point of approval.
Okay, I found it: getsentry/sentry#50717. Sorry, @bitsandfoxes, I misunderstood the severity of that change in our sync yesterday. There is no quick way to adapt to this cleanly in the Native SDK. Changing it only in the We could change the scope defaults. But this is a breaking change, and I wonder if it is okay from an SDK pov. For I am open to alternative proposals, though. |
The fundamental problem here is:
|
Yeah, I understood it the same way. The problem - at least from my current understanding - is that changing the default in the scope affects every envelope we send and not only crashes. So if a user doesn't explicitly set the level in either the event or change it in the scope, everything we send will be I think the most sensible approach would be to
# FIXME(supervacuus): remove this when we implement a FirstChanceHandler in macOS crashpad.
if os == "macOS" and backend == "crashpad" and response.get("crashed") is not None and response["crashed"]:
# we crashed on macOS using the crashpad backend, so let us ignore the level from the SDK
data["level"] = "fatal"
else:
# do what is currently implemented
if response.get("crashed") is not None and data.get("level") is None:
data["level"] = "fatal" if response["crashed"] else "info" This way we don't create a dance around shifting defaults, and the problem is solved for all in a somewhat future-proof way. The level coming from the SDK is only ignored for crashpad-on-macOS if it actually crashed... a situation where SDK users cannot override anyway. Horrible? Please let me know! |
sentry_value_set_by_key( | ||
event, "level", sentry__value_new_level(SENTRY_LEVEL_FATAL)); |
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.
Why?
The failing sentry-native/src/backends/sentry_backend_breakpad.cpp Lines 119 to 121 in 6ac1404
which can be removed. |
We should extend the integration tests with checks for all crashes to be |
// FIXME: This should be handled in the FirstChanceHandler but that does | ||
// not exist for macOS just yet. |
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.
Thanks! ❤️
So the story goes like this:
An Unreal crash report lands in relay but the
crash_reason
got ignored and asserts and ensures ended up with the severityFATAL
.Relay now reads the reason from the Unreal context and sets the level appropriately.
Unfortunately, Sentry simply overwrite the level set in Relay with
FATAL
anyway. With this PR, previously set levels get respected.This PR aims to initialize crash events with
FATAL
but still allow users to overwrite the level.