Skip to content

Commit 71e79a8

Browse files
authored
docs(native): update for 1.0
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.
1 parent 525cd80 commit 71e79a8

18 files changed

Lines changed: 159 additions & 101 deletions

File tree

‎docs/platforms/native/advanced-usage/backend-tradeoffs/index.mdx‎

Lines changed: 38 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,45 @@ sidebar_order: 1000
55
---
66
The Native SDK lets users decide at compile-time between multiple crash backends:
77

8+
* `native` (default on Windows, macOS, and Linux)
89
* `crashpad`
9-
* `native`
1010
* `breakpad`
11-
* `inproc`
11+
* `inproc` (default on Android)
1212

13-
### Why is `crashpad` the default?
13+
### When do I choose an out-of-process crash handler?
1414

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
1616

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
1919
* 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`)
4026
* 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
4441

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.
4643

47-
### How do I decide between `native`, `breakpad`, and `inproc`?
44+
### How do I decide between `breakpad` and `inproc`?
4845

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:
5047

5148
* `inproc` only provides the backtrace of the crashing thread. `breakpad` records all threads in the minidump.
5249
* 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
5754
* `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
5855
* `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.
5956

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-
6857
### So when do I choose `inproc`?
6958

7059
`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
8473

8574
Sentry suggests the following sequence for your backend evaluations:
8675

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)
9078

9179
from most feature-complete to least, where a step down should only be triggered by environmental inhibitors, as summarized in the following table:
9280

93-
| Feature | `crashpad` | `native` | `breakpad` | `inproc` |
94-
| ------- | ---------- | -------- | ---------- | -------- |
81+
| Feature | `native` | `crashpad` | `breakpad` | `inproc` |
82+
| ------- | -------- | ---------- | ---------- | -------- |
9583
| Deployment | Library <sup>1</sup> + executable | Library <sup>1</sup> + executable | Library <sup>1</sup> | Library <sup>1</sup> |
9684
| Crash handler | Out-of-process | Out-of-process | In-process | In-process |
9785
| Crash upload | At crash time | At crash time | Next restart | Next restart |
98-
| Crash report | Minidump | Event/minidump/both | Minidump | Event |
99-
| Screenshots | Windows <sup>2</sup> | Windows | Windows | Windows |
100-
| Stack walking | Server-side<br />+ client-side build option | Client-side<br />+ server-side minidump mode | Server-side | Client-side |
86+
| Crash report | Event/minidump/both | Minidump | Minidump | Event |
87+
| Screenshots | Windows | Windows <sup>2</sup> | Windows | Windows |
88+
| Stack walking | Client-side<br />+ server-side minidump mode | Server-side<br />+ client-side build option | Server-side | Client-side |
10189
| Captured threads | All | All | All | Crashing |
102-
| Crash hooks | ✅ Windows/Linux<br />❌ macOS | ✅ | ✅ Windows/macOS<br />⚠️ Linux (no context) | ✅ |
90+
| Crash hooks | ✅ | ✅ Windows/Linux<br />❌ macOS | ✅ Windows/macOS<br />⚠️ Linux (no context) | ✅ |
10391
| Windows WER / fast-fail | ✅ | ✅ | ❌ | ❌ |
104-
| macOS App Sandbox | ❌ | ✅ | ✅ | ✅ |
92+
| macOS App Sandbox | ✅ | ❌ | ✅ | ✅ |
10593

10694
* <sup>1</sup> The library supports shared and static builds.
10795
* <sup>2</sup> The `before_screenshot` hook is not supported with `crashpad`.

‎docs/platforms/native/advanced-usage/container-environments/index.mdx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ sidebar_order: 2000
77
## Database Path on a Mounted Volume
88
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.
99

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+
1013
## Waiting for `Crashpad` to Finish
1114
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.
1215

‎docs/platforms/native/common/configuration/options.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ This function is called during `sentry_init()` for every envelope of a crash fro
178178

179179
<SdkOption name="initial_scope" type="function" availableSince="0.16.7">
180180

181-
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`.
182182

183183
</SdkOption>
184184

@@ -370,6 +370,6 @@ Sets the path to a file containing the SSL certificates used for verification. O
370370

371371
<SdkOption name="enable_large_attachments" type="bool" defaultValue="false" availableSince="0.13.9">
372372

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.
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`.
374374

375375
</SdkOption>

‎docs/platforms/native/common/enriching-events/attributes/index.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Attributes can currently be used to enrich the following:
2424
2525
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.
2626
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:
2828
2929
```c
3030
sentry_set_attribute("cache.backend",
@@ -47,6 +47,6 @@ sentry_scope_free(scope);
4747
4848
Both setters have an `_n` variant that takes an explicit key length, and `sentry_remove_attribute` / `sentry_scope_remove_attribute` remove an attribute again.
4949
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.
5151
5252
See [Scopes](/platforms/native/enriching-events/scopes/) for how scopes are created and freed.

0 commit comments

Comments
 (0)