Skip to content

Commit bfad3e0

Browse files
feat(native): clarifying crashpad behavior (#13689)
Vercel previews - [backend tradeoffs](https://sentry-docs-lawi0tyqh.sentry.dev/platforms/native/advanced-usage/backend-tradeoffs/) - [container environments](https://sentry-docs-lawi0tyqh.sentry.dev/platforms/native/advanced-usage/container-environments/) ## DESCRIBE YOUR PR (from Slack) > lots to clarify, crashpad behavior, min version needed, docker entry point script waiting for the handler etc. We already have some pages that detail aspects of this, but we want to make sure this is as clear as possible: - https://docs.sentry.io/platforms/native/advanced-usage/backend-tradeoffs/ - https://docs.sentry.io/platforms/native/configuration/backends/ ## Current changes/fixes - [x] repositioning `wait_for_upload` line in backend tradeoffs; otherwise, search showed it under "When shouldn't I use the crashpad backend?". Also added new heading above for it to fall under. (note: search doesn't seem to update right away) <details> before ![image](https://github.com/user-attachments/assets/2d57893a-652d-4e72-a838-eda5525525f1) after (this is where I'd put a screenshot of the search pointing to `Why is crashpad the default` ([preview](https://sentry-docs-lawi0tyqh.sentry.dev/platforms/native/advanced-usage/backend-tradeoffs/#why-is-crashpad-the-default)) instead, but seems to not update on Vercel 🤔 ) </details> - [x] added min. version to `wait_for_upload` mention - [x] add docker entry point script to wait for handler (for people below 0.8.3/non-linux) ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [x] None: Not urgent, can wait up to 1 week+ --------- Co-authored-by: Alex Krawiec <[email protected]>
1 parent d58199f commit bfad3e0

File tree

2 files changed

+36
-2
lines changed
  • docs/platforms/native/advanced-usage

2 files changed

+36
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ The Native SDK lets users decide at compile-time between three crash backends:
99
* `breakpad`
1010
* `inproc`
1111

12+
### Why is `crashpad` the default?
13+
1214
Currently, `crashpad` is the default on all desktop platforms because it
1315

1416
* 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)
@@ -26,6 +28,9 @@ Currently, `crashpad` is the default on all desktop platforms because it
2628
* cooperation with Epic's Easy Anti-Cheat
2729
* CMake build scripts (some users use our backend handler forks solely because of this reason)
2830

31+
<Alert>
32+
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), 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.
33+
</Alert>
2934
### When shouldn't I use the `crashpad` backend?
3035

3136
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,8 +43,6 @@ Sentry decided on `crashpad` as the default on all platforms because it offers n
3843

3944
In the above cases, if you cannot loosen the requirements of your environment, you have to choose an in-process backend (meaning either `breakpad` or `inproc`).
4045

41-
When your deployment scenario should wait for the `crashpad_handler` to finish its work before a shutdown-after-crash (systemd, Docker), 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.
42-
4346
### How do I decide between `breakpad` or `inproc`?
4447

4548
Both backends are comparable in how they differ from `crashpad`. However, there are also considerable differences between the two:
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: Container Environments
3+
description: "How to use the Sentry Native SDK in container environments."
4+
sidebar_order: 2000
5+
---
6+
7+
## Database Path on a Mounted Volume
8+
The Sentry Native SDK uses a [database path](https://docs.sentry.io/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+
10+
## Waiting for `Crashpad` to Finish
11+
Starting with SDK version [0.8.3](https://github.com/getsentry/sentry-native/releases/tag/0.8.3), the [option `crashpad_wait_for_upload`](https://docs.sentry.io/platforms/native/configuration/options/#crashpad-wait-for-upload) allows the application (on Linux) to wait for the `crashpad_handler` to finish before a shutdown-after-crash.
12+
13+
In SDK versions older than 0.8.3, you could use a script similar to the example below to tie container shutdown to the `crashpad_handler` process:
14+
```bash
15+
#!/bin/bash
16+
17+
# ./execute-main-app
18+
19+
crashpad_timeout_s=10
20+
crashpad_process_name=crashpad_handler
21+
crashpad_pid=$(pgrep -n -f $crashpad_process_name)
22+
if [ -n "$crashpad_pid" ]; then
23+
echo "Waiting for crashpad to finish..."
24+
timeout $crashpad_timeout_s tail --pid=$crashpad_pid -f /dev/null
25+
if [ $? -eq 124 ]; then
26+
echo "The crashpad process did not finish within $crashpad_timeout_s seconds"
27+
else
28+
echo "The crashpad process finished successfully"
29+
fi
30+
fi
31+
```

0 commit comments

Comments
 (0)