You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 71e79a8
Browse filesBrowse the repository at this point in the historyBrowse files
Version 1.0.0 makes `native` the default backend on Windows, macOS,
and Linux, versions shared library names, splits the global scope,
and removes deprecated APIs.
Rework the backend tradeoffs page, which was still built around
`crashpad` as the default. It now starts from the choice between
out-of-process and in-process crash handlers.
Document the isolation scope, scope batching, and trace propagation
without a transaction, and update the install docs for versioned
library names and `pkg-config`.
Remove the pre-release alert from the migration guide.
Copy file name to clipboardExpand all lines: docs/platforms/native/advanced-usage/backend-tradeoffs/index.mdx
+38-50Lines changed: 38 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,48 +5,45 @@ sidebar_order: 1000
5
5
---
6
6
The Native SDK lets users decide at compile-time between multiple crash backends:
7
7
8
+
*`native` (default on Windows, macOS, and Linux)
8
9
*`crashpad`
9
-
*`native`
10
10
*`breakpad`
11
-
*`inproc`
11
+
*`inproc` (default on Android)
12
12
13
-
### Why is `crashpad` the default?
13
+
### When do I choose an out-of-process crash handler?
14
14
15
-
Currently, `crashpad`is the default on all desktop platforms because it
15
+
`native` and `crashpad`handle crashes out of process. Choose one of them whenever your environment allows it, because an out-of-process crash handler
16
16
17
-
* has an external `handler` process that allows for external snapshots and sending crash reports immediately (instead of on the next successful start of your application)
18
-
* further, snapshotting, report management, and uploading outside the crashed process are safer because the `crashpad_handler` is not affected by any corruptions that led to a crash
17
+
* has an external process (`sentry-crash` or `crashpad_handler`) that allows for external snapshots and sending crash reports immediately (instead of on the next successful start of your application)
18
+
* further, snapshotting, report management, and uploading outside the crashed process are safer because the handler is not affected by any corruptions that led to a crash
19
19
* supports more error types on [Linux](/platforms/native/advanced-usage/signal-handling/#signals-of-interest) and Windows (`abort()` and other `fast-fail` crashes, handling of heap corruptions)
20
-
* on macOS, the `crashpad_handler` will receive `EXC_CRASH` Mach exceptions, which the kernel generates during process exit if a terminal POSIX signal hasn't been handled. None of the other backends will catch this exception.
21
-
* is more maintained upstream (although most changes affect new platforms like Fuchsia)
22
-
* is the primary target for Sentry-developed extensions to the upstream implementation of backend handlers (most of which aren't a particular upside vs. the other backends, but changes to reach parity), including
23
-
* client-side stack traces (this is currently not available on `breakpad`)
24
-
* attachment handling
25
-
* retry mechanism for failed report uploads
26
-
* HTTP proxy support
27
-
* GCC and MinGW support
28
-
*`FirstChanceHandler` on Windows and extension of its synchronization to support Sentry hooks
29
-
* cooperation with Epic's Easy Anti-Cheat
30
-
* CMake build scripts (some users use our backend handler forks solely because of this reason)
31
-
32
-
<Alert>
33
-
When your deployment scenario should wait for the `crashpad_handler` to finish its work before a shutdown-after-crash (systemd, Docker), in Linux environments since SDK version [0.8.3](https://github.com/getsentry/sentry-native/releases/tag/0.8.3), and Windows environments since SDK version [0.9.0](https://github.com/getsentry/sentry-native/releases/tag/0.9.0), you can enable the [option `crashpad_wait_for_upload`](/platforms/native/configuration/options/#crashpad-wait-for-upload) to delay application shutdown until the upload of the crash report is completed.
34
-
</Alert>
35
-
### When shouldn't I use the `crashpad` backend?
36
-
37
-
Sentry decided on `crashpad` as the default on all platforms because it offers numerous advantages. However, there are use cases where `crashpad` cannot be used or makes distribution or deployment much harder. We provide other backends for situations when
38
-
39
-
* you cannot package or deploy an additional executable (the `crashpad_handler`)
20
+
21
+
### When shouldn't I use an out-of-process crash handler?
22
+
23
+
There are use cases where an out-of-process crash handler cannot be used or makes distribution or deployment much harder. We provide `breakpad` and `inproc`, which handle crashes in-process, for situations when
24
+
25
+
* you cannot package or deploy an additional executable (`sentry-crash` or `crashpad_handler`)
40
26
* you cannot allow a secondary process to connect via `ptrace` to your application (AWS Lambda, Flatpak-, Snap-Sandboxes)
41
-
* IPC between your process and the `crashpad_handler` is inhibited by security settings or not available in your deployment target
42
-
* you want to distribute your application via the macOS App Store
43
-
* you want to define crash hooks on macOS because there, error handling happens entirely in the `crashpad_handler`, whereas on Linux and Windows, at least the initial handling happens in your process, after which `crashpad_handler` takes over and snapshots the process to send a crash report
27
+
* IPC between your process and the handler is inhibited by security settings or not available in your deployment target
28
+
29
+
### How do I decide between `native` and `crashpad`?
30
+
31
+
Since SDK version 1.0.0, `native` is the default on Windows, macOS, and Linux because it
32
+
33
+
* is implemented as part of the Native SDK and built on the SDK's own event, envelope, transport, attachment, options, and hook infrastructure, so there's no external crash-handler dependency
34
+
* sends client-side stack traces by default and can [report an event, a minidump, or both](/platforms/native/configuration/backends/native/#crash-reporting-modes)
35
+
* uploads crash reports with the SDK's HTTP transport, so options such as `ca_certs` and `transfer_timeout` apply to them
36
+
* calls crash hooks on all desktop platforms, provides crash metadata to `on_crash`, and supports `before_screenshot`
37
+
* returns control to [Windows Error Reporting](/platforms/native/advanced-usage/windows-error-reporting/) after capturing a crash
38
+
* runs inside the macOS App Sandbox
39
+
* is fully compatible with TSAN and ASAN builds
40
+
* is written in C, so it does not rely on a C++ runtime library
44
41
45
-
In the above cases, if you cannot loosen the requirements of your environment, you have to choose another backend (meaning either `native`, `breakpad`, or `inproc`).
42
+
Choose `crashpad` instead if you need `EXC_CRASH` Mach exceptions on macOS, which the kernel generates during process exit if a terminal POSIX signal hasn't been handled. The `crashpad_handler` receives these exceptions, whereas none of the other backends will catch them.
46
43
47
-
### How do I decide between `native`, `breakpad`, and `inproc`?
44
+
### How do I decide between `breakpad` and `inproc`?
48
45
49
-
`native` is the closest alternative to `crashpad` because it keeps crash handling out of process. If your constraints rule out an additional executable, the remaining options are `breakpad` and `inproc`, which are comparable in how they differ from `crashpad` and `native`. However, there are also considerable differences between the two:
46
+
`breakpad` and `inproc` are comparable in how they differ from `crashpad` and `native`. However, there are also considerable differences between the two:
50
47
51
48
*`inproc` only provides the backtrace of the crashing thread. `breakpad` records all threads in the minidump.
52
49
* similar to `crashpad`, `breakpad` uses the lowest level error handling mechanism on each platform (macOS: mach exception ports, Windows: `UnhandledExceptionFilter`, Linux: signal handlers), it does cover a smaller range of errors, though, as mentioned above.
@@ -57,14 +54,6 @@ In the above cases, if you cannot loosen the requirements of your environment, y
57
54
*`inproc` is exceptionally lightweight and written entirely in C, meaning it does not rely on a weighty C++ runtime library, which is also more often affected by ABI incompatibilities
58
55
*`breakpad` generates minidumps (like `crashpad` and `native` by default), whereas `inproc` follows the Sentry event structure and primarily defers to the OS-provided unwinder and symbolication capabilities. Sentry processing infrastructure can extract more information from the provided minidump than from just a stack trace and registers. However, it also means that the crash context inside the minidump will remain opaque until it is processed in the backend. In contrast, if required, a local `relay` instance (or another application-level proxy) could process an entire `inproc` event with only JSON parsing capabilities.
59
56
60
-
### So when do I choose `native`?
61
-
62
-
Since SDK version [0.13.2](https://github.com/getsentry/sentry-native/releases/tag/0.13.2), the Native SDK comes with an out-of-process backend called `native`. It is implemented as part of the Native SDK and built on the SDK's own event, envelope, transport, attachment, options, and hook infrastructure.
63
-
64
-
The main advantages are tighter integration with the Native SDK and no external crash-handler dependency. As an out-of-process backend, `native` runs crash handling in the lightweight `sentry-crash` daemon and can send crash reports at crash time, similar to `crashpad`. Because crash collection is implemented in the SDK, `native` can call SDK-level hooks such as `before_screenshot`, and can [report an event, a minidump, or both](/platforms/native/configuration/backends/native/). The backend is also fully compatible with TSAN and ASAN builds.
65
-
66
-
Consider `native` when you want out-of-process crash handling with SDK-managed crash collection, when you need sanitizer compatibility, or when `crashpad` does not fit your deployment model.
67
-
68
57
### So when do I choose `inproc`?
69
58
70
59
`inproc` is currently the backend of choice for Android because it allows us to bundle it with our fork of the platform unwinder, `libunwindstack`, which provides a complete interface for unwinding and symbolication (rather than relying on the minimal user-space interface). This enables us to support a broad range of Android versions. Additionally, stack walking on-device on Android is preferred since we do not have access to all system symbols for server-side symbolication. A [best-effort symbol collection exists](https://github.com/getsentry/symbol-collector), but that'll never be as reliable as stackwalking on-device.
@@ -84,24 +73,23 @@ If you dive into the details, you will find many trade-offs in the selection of
84
73
85
74
Sentry suggests the following sequence for your backend evaluations:
86
75
87
-
*`crashpad` (default on Windows, macOS, and Linux), or `native`
88
-
*`breakpad`
89
-
*`inproc` (default on Android)
76
+
*`native` (default on Windows, macOS, and Linux), or `crashpad`
77
+
*`breakpad`, or `inproc` (default on Android)
90
78
91
79
from most feature-complete to least, where a step down should only be triggered by environmental inhibitors, as summarized in the following table:
Copy file name to clipboardExpand all lines: docs/platforms/native/advanced-usage/container-environments/index.mdx
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,9 @@ sidebar_order: 2000
7
7
## Database Path on a Mounted Volume
8
8
The Sentry Native SDK uses a [database path](/platforms/native/configuration/options/#database-path) to store events and crash reports. When you are using a containerized environment, you may want to mount a volume to persist the database across container restarts to avoid losing this data.
9
9
10
+
## Waiting for the `native` Backend to Finish
11
+
By default, the `native` backend keeps the crashed application blocked until the `sentry-crash` daemon finishes uploading or the [option `shutdown_timeout`](/platforms/native/configuration/options/#shutdown_timeout) expires. To let the application exit earlier, see the [option `crash_upload_mode`](/platforms/native/configuration/options/#crash_upload_mode).
12
+
10
13
## Waiting for `Crashpad` to Finish
11
14
Starting with SDK version [0.8.3](https://github.com/getsentry/sentry-native/releases/tag/0.8.3) for Linux and [0.9.0](https://github.com/getsentry/sentry-native/releases/tag/0.9.0) for Windows, the [option `crashpad_wait_for_upload`](/platforms/native/configuration/options/#crashpad-wait-for-upload) allows the application to wait for the `crashpad_handler` to finish before a shutdown-after-crash.
This function is called once during `sentry_init()` with the global scope, before the crash backend starts, so the data it sets is available to crash reports, including those of out-of-process crash handlers. Configure the scope with the `sentry_scope_*` functions rather than global functions such as `sentry_set_tag`.
181
+
This function is called once during `sentry_init()` with the isolation scope, before the crash backend starts, so the data it sets is available to crash reports, including those of out-of-process crash handlers. Configure the scope with the `sentry_scope_*` functions rather than global functions such as `sentry_set_tag`.
182
182
183
183
</SdkOption>
184
184
@@ -370,6 +370,6 @@ Sets the path to a file containing the SSL certificates used for verification. O
Uploads attachments above an internal size threshold in a separate request before the envelope is sent, instead of embedding them in the envelope. Without it, Sentry rejects oversized uploads. This requires the `projects:relay-upload-endpoint` server-side feature.
373
+
Uploads attachments above an internal size threshold in a separate request before the envelope is sent, instead of embedding them in the envelope. Without it, Sentry rejects oversized uploads. This requires the `projects:relay-upload-endpoint` server-side feature. Since SDK version 1.0.0, interrupted uploads resume from the offset the server provides, and uploads are compressed if the SDK is built with `SENTRY_TRANSPORT_COMPRESSION`.
Copy file name to clipboardExpand all lines: docs/platforms/native/common/enriching-events/attributes/index.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ Attributes can currently be used to enrich the following:
24
24
25
25
Passing the same attributes to every call gets repetitive once a group of logs or metrics shares context. Set them on a scope instead, and everything captured with that scope inherits them.
26
26
27
-
`sentry_set_attribute` writes to the global scope, so every log and metric the SDK sends carries the attribute:
27
+
`sentry_set_attribute` writes to the isolation scope, so every log and metric the SDK sends carries the attribute:
28
28
29
29
```c
30
30
sentry_set_attribute("cache.backend",
@@ -47,6 +47,6 @@ sentry_scope_free(scope);
47
47
48
48
Both setters have an `_n` variant that takes an explicit key length, and `sentry_remove_attribute` / `sentry_scope_remove_attribute` remove an attribute again.
49
49
50
-
Attribute precedence is resolved from most to least specific: **per-call attributes** > **passed scope** > **global scope**. Attributes are merged from every source, so differently named attributes from all three are included on the resulting log or metric. When the same attribute is set in more than one source, the most specific one is used.
50
+
Attribute precedence is resolved from most to least specific: **per-call attributes** > **passed scope** > **isolation scope** > **global scope**. Attributes are merged from every source, so differently named attributes from all sources are included on the resulting log or metric. When the same attribute is set in more than one source, the most specific one is used.
51
51
52
52
See [Scopes](/platforms/native/enriching-events/scopes/) for how scopes are created and freed.
0 commit comments