Skip to content

feat(native): reflect windows support for crashpad-wait-for-upload in… #13864

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

Merged
merged 2 commits into from
Jun 5, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ sidebar_order: 2000
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.

## Waiting for `Crashpad` to Finish
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.
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`](https://docs.sentry.io/platforms/native/configuration/options/#crashpad-wait-for-upload) allows the application to wait for the `crashpad_handler` to finish before a shutdown-after-crash.

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:
In SDK versions older than `0.8.3`/`0.9.0`, you could use a script similar to the example below to tie container shutdown to the `crashpad_handler` process:
```bash
#!/bin/bash

Expand All @@ -29,3 +29,20 @@ if [ -n "$crashpad_pid" ]; then
fi
fi
```
on Linux, or for Windows PowerShell
```powershell
# Start-Process -FilePath ".\main-app.exe" -Wait

$crashpadTimeoutSec = 10
$crashpadProcessName = "crashpad_handler"
$crashpadProcess = Get-Process -Name $crashpadProcessName -ErrorAction SilentlyContinue | Sort-Object StartTime -Descending | Select-Object -First 1
if ($null -ne $crashpadProcess) {
Write-Output "Waiting for crashpad to finish..."
$finished = $crashpadProcess.WaitForExit($crashpadTimeoutSec * 1000)
if (-not $finished) {
Write-Output "The crashpad process did not finish within $crashpadTimeoutSec seconds"
} else {
Write-Output "The crashpad process finished successfully"
}
}
```