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

fix: Setting the default level for crash events in Crashpad to fatal #852

Merged
merged 7 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@

## Unreleased

**Fixes**:

- Crash events are initialized with level `FATAL` ([#852](https://github.com/getsentry/sentry-native/pull/852))
- Fix MSVC compiler error with on non-Unicode systems ([#846](https://github.com/getsentry/sentry-native/pull/846), [crashpad#85](https://github.com/getsentry/crashpad/pull/85))

**Features**:

- crashpad_handler: log `body` if minidump endpoint response is not `OK` ([#851](https://github.com/getsentry/sentry-native/pull/851), [crashpad#87](https://github.com/getsentry/crashpad/pull/87))

**Thank you**:

Features, fixes and improvements in this release have been contributed by:

- [@xyz1001](https://github.com/xyz1001)

## 0.6.3

**Features**:
Expand All @@ -19,10 +30,6 @@
- Updated Breakpad backend to 2023-05-03. ([#836](https://github.com/getsentry/sentry-native/pull/836), [breakpad#35](https://github.com/getsentry/breakpad/pull/35))
- Updated Crashpad backend to 2023-05-03. ([#837](https://github.com/getsentry/sentry-native/pull/837), [crashpad#82](https://github.com/getsentry/crashpad/pull/82))

**Fixes**:

- Fix MSVC compiler error with on non-Unicode systems ([#846](https://github.com/getsentry/sentry-native/pull/846), [crashpad#85](https://github.com/getsentry/crashpad/pull/85))

## 0.6.2

**Features**:
Expand Down
5 changes: 2 additions & 3 deletions src/backends/sentry_backend_breakpad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ sentry__breakpad_backend_callback(
dump_path = sentry__path_new(descriptor.path());
#endif
sentry_value_t event = sentry_value_new_event();
sentry_value_set_by_key(
event, "level", sentry__value_new_level(SENTRY_LEVEL_FATAL));

SENTRY_WITH_OPTIONS (options) {
sentry__write_crash_marker(options);
Expand All @@ -116,9 +118,6 @@ sentry__breakpad_backend_callback(
if (should_handle) {
sentry_envelope_t *envelope = sentry__prepare_event(
options, event, nullptr, !options->on_crash_func);
// the event we just prepared is empty,
// so no error is recorded for it
sentry__record_errors_on_current_session(1);
sentry_session_t *session = sentry__end_current_session_with_status(
SENTRY_SESSION_STATUS_CRASHED);
sentry__envelope_add_session(envelope, session);
Expand Down
13 changes: 10 additions & 3 deletions src/backends/sentry_backend_crashpad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,14 @@ crashpad_backend_flush_scope(
// properties that we do not want here. But in case of a crash we use the
// crash-event filled in the crash-handler and on_crash/before_send
// respectively.
sentry_value_t event = sentry_value_is_null(data->crash_event)
? sentry_value_new_object()
: data->crash_event;
sentry_value_t event = data->crash_event;
if (sentry_value_is_null(event)) {
event = sentry_value_new_object();
// FIXME: This should be handled in the FirstChanceHandler but that does
// not exist for macOS just yet.
Comment on lines +111 to +112
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks! ❤️

sentry_value_set_by_key(
event, "level", sentry__value_new_level(SENTRY_LEVEL_FATAL));
Comment on lines +113 to +114
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why?

}

SENTRY_WITH_SCOPE (scope) {
// we want the scope without any modules or breadcrumbs
Expand Down Expand Up @@ -149,6 +154,8 @@ sentry__crashpad_handler(int signum, siginfo_t *info, ucontext_t *user_context)
auto *data = static_cast<crashpad_state_t *>(options->backend->data);
sentry_value_decref(data->crash_event);
data->crash_event = sentry_value_new_event();
sentry_value_set_by_key(data->crash_event, "level",
sentry__value_new_level(SENTRY_LEVEL_FATAL));

if (options->on_crash_func) {
sentry_ucontext_t uctx;
Expand Down