Repository navigation
Conversation
Run CI on `v1` like on `master`, and dispatch console compatibility checks to the same-named console branch for commits cut from `v1`.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2196 +/- ##
==========================================
+ Coverage 75.71% 75.87% +0.15%
==========================================
Files 104 105 +1
Lines 28706 31254 +2548
Branches 5265 5830 +565
==========================================
+ Hits 21736 23715 +1979
- Misses 5609 6089 +480
- Partials 1361 1450 +89 🚀 New features to boost your workflow:
|
The collective PR runs CI on every push to v1 already.
Pull request analyses are stored against the merge ref, so PRs into v1 had no baseline and compared against master.
Set CMake [`VERSION`](https://cmake.org/cmake/help/latest/prop_tgt/VERSION.html) and [`SOVERSION`](https://cmake.org/cmake/help/latest/prop_tgt/SOVERSION.html) properties. Close: #1428
* ci: include version in the release archive name Fixes: #745 * ci: keep a stable archive name for latest downloads Create a `sentry-native.zip` copy for the GCS `latest/` path so each release replaces the same object. Keep versioned archive names for GitHub and version-specific GCS paths.
BREAKING CHANGE: Linux, macOS, and Windows builds now default to the `native` backend instead of `crashpad`.
The custom capture hook required private SDK types, while screenshot options were still experimental. BREAKING CHANGE: Implement sentry_screenshot_capture(const char *, uint32_t), returning 0 on success.
The factory used a private-style `sentry__`-prefixed name even though custom transports must provide its implementation. Give it a public-style name and document the contract for custom implementations. BREAKING CHANGE: Custom transport implementations must define: ``` sentry_transport_t *sentry_transport_new_default(void) ```
Keep the scope write lock across a batch while allowing the owning thread to use existing scope accessors without relocking. Defer backend scope flushes until the outermost batch completes.
Split the existing global scope into an internal, read-only global scope for SDK/OS metadata and configured defaults, and a mutable isolation scope used by top-level APIs. Move user data, observers, and backend flushing to the isolation scope. Add `sentry_scope_acquire()` and `sentry_scope_release()` for direct isolation scope access. Implement Sentry's three-scope model with global -> isolation -> local scope layering. Retain parent references and merge layers when preparing events, telemetry, and attachments. Local values take precedence over isolation and global defaults. The SDK follows the global mode used by other Sentry SDKs for client applications: all threads share the same process-wide isolation scope. Changes made through top-level APIs or an acquired reference are shared across all threads. See: - https://develop.sentry.dev/sdk/foundations/state-management/scopes/#isolation-scope
Provide exception metadata, registers, and a basic crashing-thread stack for crash identification in native `on_crash`, matching `inproc`. Use the same payload for `before_send` when `on_crash` is unset. - Capture up to 128 fault-context IPs and unwind source in shared memory. Retain the faulting IP when available. - Linux: SDK `libunwind` with signal-safe logging. - macOS: SDK frame-pointer walker, guarded Mach reads, PAC stripping, `__DARWIN_OPAQUE_ARM_THREAD_STATE64` accessors, and `instruction_addr_adjustment=none`. - Android/Linux without `libunwind`: bounded frame-pointer capture via `process_vm_readv`; avoids `libunwindstack`'s C++ allocation. - Windows: MSVC x64 `RtlLookupFunctionEntry`/`RtlVirtualUnwind` walking without DbgHelp; SP progress permits recursive frames. Frame-pointer capture on x86/ARM64 and other x64 builds. - ARM32 frame-pointer fallbacks retain only the faulting IP. The daemon reuses partial captures and enriches existing frames. Preserve exception/register/frame edits and removals, and honor callback rejection.
Skip Windows frame symbol lookup when symbolize_stacktraces is disabled, including crash frames captured before daemon processing.
Add length-prefixed frames and app-to-daemon IPC based on Unix domain stream socket pairs and an anonymous pipe on Windows. Ref: #1834
* perf(native): Sync scope over IPC Instead of flushing the whole scope/event on disk on every scope change, send an initial scope snapshot and then minimal incremental updates to the crash daemon over IPC. Keep the latest complete state in daemon memory for crash reports. Discard interrupted messages and preserve crash callback changes through a final event and attachment snapshot. Close: #1834 * handle SENTRY_CRASH_STATE_CRASHING * signal.h
The inproc-based Android NDK uses `SENTRY_TRANSPORT=none` and installs a JNI function transport that writes to `outbox/`, leaving HTTP delivery to Java. Tests substitute it with an stdout callback to inspect envelopes without Java or HTTP. However, the Native daemon in #1725 cannot use the function transport from the separate daemon process. Provide (an internal) built-in stdout transport (`SENTRY_TRANSPORT=stdout`) that both the SDK and daemon can instantiate. This is mostly for out own integration testing purposes, but it's also super handy for quick experiments: ```sh $ make build SENTRY_BACKEND=inproc SENTRY_TRANSPORT=stdout ... $ ./build/sentry_example_crash ... [sentry] DEBUG sending envelope {"event_id":"0e1d5355-5ba8-42cb-9e96-c6610d4ee9c1",...} {"type":"event","length":2823} {"event_id":"0e1d5355-5ba8-42cb-9e96-c6610d4ee9c1","timestamp":"2026-10-16T16:19:26.968633Z","platform":"native","level":"fatal","exception":...} [sentry] INFO entering signal handler ... ```
The crash daemon treated a clean transport shutdown as a sent crash, but the transport also shuts down cleanly after dropping an envelope it could not prepare or queue. On Android this deleted the only copy of the crash, and on other platforms the crash envelope was removed as soon as it was queued. Retain the crash envelope until the transport has sent it, whether or not the upload succeeds. Otherwise, it stays in the run folder. Ref: #2196 (comment)
The crash daemon treated a clean transport shutdown as a sent crash, but the transport also shuts down cleanly after dropping an envelope it could not prepare or queue. On Android this deleted the only copy of the crash, and on other platforms the crash envelope was removed as soon as it was queued. Retain the crash envelope until the transport has sent it, whether or not the upload succeeds. Otherwise, it stays in the run folder. Ref: #2196 (comment)
`pytest.exit` without a `returncode` keeps the session's exit status, which is still `OK` when the run stops early, so a job could pass after repeated build failures. Exit with `TESTS_FAILED` instead. Ref: #2196 (comment)
On sanitizer builds the 64 large breadcrumbs and the 2 MiB extra alone can use up the 5s budget of the stall updates test. Allow 30s under ASan, TSan and kcov, which still catches updates that each wait for the 1s send timeout. The killed-daemon bound stays at 5s. Ref: #2196 (comment)
* fix(native): Retain crash envelopes until they are sent The crash daemon treated a clean transport shutdown as a sent crash, but the transport also shuts down cleanly after dropping an envelope it could not prepare or queue. On Android this deleted the only copy of the crash, and on other platforms the crash envelope was removed as soon as it was queued. Retain the crash envelope until the transport has sent it, whether or not the upload succeeds. Otherwise, it stays in the run folder. Ref: #2196 (comment) * check nil id * ref: Add sentry__uuid_eq for comparing UUIDs Compare the crash daemon's event IDs with the helper instead of `memcmp` on the UUID bytes. * fix(native): Ignore nil event IDs on Android A crash envelope without an event ID matched the transport's nil last event ID, so a dropped send reported `SENTRY_ANDROID_SEND_SENT` and removed the pending backup. Require a non-nil event ID. Ref: #2320 (comment) * Update CHANGELOG.md * ref(native): Drop redundant options NULL checks in crash processing CodeChecker reports a NULL dereference in `sentry__process_crash`: ```text sentry_crash_daemon.c:4463:25: Access to field 'run' results in a dereference of a null pointer (loaded from variable 'options') [core.NullDereference] ``` The function checks `options` for NULL in some places but not in others, so the analyzer follows the NULL branch into the unchecked uses. `options` is never NULL there, because the only caller stops when `sentry_options_new()` fails. The report appeared with the crash envelope retention changes on this branch, although the checks predate them. Ref: https://github.com/getsentry/sentry-native/actions/runs/44108383447/job/134127788577?pr=2320
`sentry__thread_join` only waits for the thread. On Windows, each `sentry__thread_spawn` creates a `HANDLE` that only `sentry__thread_free` closes, so the test leaked both worker handles. Ref: #2196 (comment)
The crash handler stops waiting after 10s, while the daemon spends the whole 10s shutdown timeout after processing the crash. That leaves `wait_for_daemon` only 10s for the crash processing, which includes copying the 100 MiB attachment into the cache. A 5s shutdown timeout still interrupts the throttled upload. Ref: #2196 (comment)
* fix(native): omit crash metadata in minidump-only mode Since #2174, crash events include crash metadata provided to `on_crash`. Drop the metadata in minidump-only mode to avoid sending the event as-is, resulting in a native-with-minidump -like event. * Update CHANGELOG.md
`otool -L` also lists the dependencies of `libsentry`, and `libSystem.B.dylib` always has `compatibility version 1.0.0`, which matched the expected compatibility version of the 1.x library. Check both versions on the `libsentry` install name line instead. Ref: #2196 (comment)
`crash_daemon_shutdown_during_crash` published `CRASHED` 100 ms after the daemon signaled ready, but the daemon starts its transport and crash handler before its first receive. On a slow run, the daemon read `SHUTDOWN` only after `CRASHED`, and the test passed without exercising the `CRASHING` guard. Wait until `SIOCOUTQ` reports that the daemon has read the message. Ref: #2196 (comment)
#2315) * build: apply `SENTRY_ERROR_ON_WARNINGS` to breakpad and crashpad Build breakpad with `/W3` on MSVC and `-Wall` elsewhere, and treat breakpad's and crashpad's warnings as errors with `SENTRY_ERROR_ON_WARNINGS`. Bump breakpad and crashpad to fix their warnings. * build: respect `SENTRY_ERROR_ON_WARNINGS` on MSVC Add `/WX` to sentry, crashpad and breakpad when the option is enabled, like `-Werror` on other compilers. * build: suppress the warnings new in clang-cl 21 clang-cl maps `-Wall` to `-Weverything`, so the warnings that clang 21 added fail the `sentry` build with the clang-cl 22.1.3 that ships with Visual Studio 2026. ```text include\sentry.h(955,11): error: identifier 'wchar_t' conflicts with a C++ keyword [-Werror,-Wc++-keyword] src\sentry_attachment.c(233,12): error: not eliding copy on return [-Werror,-Wnrvo] src\backends\sentry_backend_inproc.c(147,31): error: padding struct 'struct sentry_inproc_backend_config_s' with 3 bytes to align 'handler_strategy' [-Werror,-Wpadded] ``` * build: bump breakpad and crashpad to the merged warning fixes Bump to the merge commits of getsentry/breakpad#47 and getsentry/crashpad#181. * build: copy the sentry warning options to sentry-crash on MSVC `sentry-crash` copied the warning options from `sentry` only on GCC and Clang, so `SENTRY_ERROR_ON_WARNINGS` did not reach the daemon on MSVC. Ref: #2315 (comment) * ci: add a ClangCL job for VS 2026 Run the ClangCL build and tests on `windows-2025-vs2026` as well, which ships a newer clang-cl than VS 2022. Let CMake pick the installed Visual Studio instead of forcing the VS 2022 generator. * build: respect `SENTRY_ERROR_ON_WARNINGS` on clang-cl clang-cl always built `sentry` with `-Werror`, so each new clang-cl warning broke the build for everyone. Leave it to the `/WX` that `SENTRY_ERROR_ON_WARNINGS` adds.
| while (!sentry__crash_ipc_flush(ipc)) { | ||
| sentry__crash_ipc_receive(ipc, 0); | ||
| } | ||
| sentry_value_t snapshot = scope_snapshot(); | ||
| TEST_CHECK(sentry__crash_ipc_send( | ||
| ipc, SENTRY_CRASH_IPC_MESSAGE_SCOPE_SNAPSHOT, snapshot)); |
There was a problem hiding this comment.
Drain the final flushed frame before sending the snapshot in the Linux/Android test
In crash_ipc_awaiting_ready, the final nonblocking flush can leave the release frame unread in the socket, leaving too little send-buffer space for the following blocking snapshot send. Drain with sentry__crash_ipc_receive after the flush loop, as crash_ipc_stalled_stream does, to avoid a configuration-dependent test failure.
Evidence
crash_ipc_awaiting_readycallssentry__crash_ipc_receiveonly whilesentry__crash_ipc_flushreturns false, then sends the snapshot without draining after the successful flush.sentry__crash_ipc_flushsends the torn frame nonblocking;sentry__crash_ipc_sendsends the subsequent snapshot blocking once the ready signal is consumed, and can return false if the send times out partway through.crash_ipc_stalled_streamdrains after its flush loop before sending a snapshot, showing the missing drain in this test; the affected test is enabled for native Linux and Android.
Identified by Warden · native-test-review · RFT-QFN
The last nonblocking flush in `crash_ipc_awaiting_ready` can leave part of the release frame unread. The snapshot that follows is a blocking send, so with too little buffer space left, it can time out and fail the test. Receive once after the flush loop, as `crash_ipc_stalled_stream` does. Ref: #2196 (comment)
sentry-dotnet preloads the crash handler so that it is installed before the .NET runtime's `SIGSEGV` handler, which turns null dereferences in Native AOT-compiled managed code into `NullReferenceException`. With the handler already installed (#2268), `sentry__crash_handler_init()` ignored its callback (#2220), so sentry-crash never called `dump_crash_queue()`.
# Conflicts: # include/sentry.h # ndk/gradle.properties # src/sentry_thread_stackwalk_posix.c # tests/__init__.py
* fix(native): Recover interrupted crash reports If the crash daemon is killed abruptly, or has not attached yet, the crash is lost: the next launch deletes its `__sentry-event` with the old run folder. This is more likely on Android, where the daemon runs in a service process that the system can kill independently of the app, for example under memory pressure, and that may not have connected yet when the app crashes. Recover the event instead. The daemon removes the file once it has sent the crash or kept its own envelope. * Update CHANGELOG.md * fix(native): Recover the crash envelope of an interrupted daemon A daemon killed after writing `__sentry-crash.envelope` but before removing `__sentry-event` left both files, and the next launch invoked `on_crashed_last_run` for each. Send the daemon's envelope instead and remove the event. * test(native): verify which crash the recovery sends
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a29bd9f. Configure here.
* fix(native): Recover interrupted crash reports If the crash daemon is killed abruptly, or has not attached yet, the crash is lost: the next launch deletes its `__sentry-event` with the old run folder. This is more likely on Android, where the daemon runs in a service process that the system can kill independently of the app, for example under memory pressure, and that may not have connected yet when the app crashes. Recover the event instead. The daemon removes the file once it has sent the crash or kept its own envelope. * Update CHANGELOG.md * fix(native): Recover the crash envelope of an interrupted daemon A daemon killed after writing `__sentry-crash.envelope` but before removing `__sentry-event` left both files, and the next launch invoked `on_crashed_last_run` for each. Send the daemon's envelope instead and remove the event. * fix(android): Fall back to a file for crash IPC without memfd `memfd_create` needs Linux 3.17, so creating the crash service's shared memory failed on older kernels, and the SDK disabled native crash reporting. When `memfd_create` fails, create an unlinked file in the database directory instead. Preallocate it with `posix_fallocate()`, because a sparse file raises `SIGBUS` on write when the disk is full. Java passes the directory to the new `SentryNdk.createCrashShm(String)` overload, and `createCrashShm()` keeps using memfd only. * docs(android): Say that createCrashShm() needs memfd The overload without a database directory has no file fallback, so it needs a kernel with memfd rather than a specific API level. * ci(android): Run the e2e tests on API 21, 26, 31 and 35 Match the Android API levels and NDK versions in `ci.yml`. The crash IPC now works without memfd, so drop the fixture's API 30 `minSdk` and the tests' API 30 skips. * ci(android): Check out the sentry-java API 21 branch for e2e tests The API 21 and 26 e2e jobs need the sentry-java side of running the crash service below API 30. * Update CHANGELOG.md * test(android): Fix the e2e tests on API 31 and 36 API 31 tombstones leave dex frames unnamed, so the merged event has no Java method names. Check them only on later API levels. The fixture crashed 1 s after setting the scope, but sentry-java syncs the scope to native on its single-threaded executor, behind the startup work of the tombstone integration. Now that the crash service starts without waiting, that work can still run when the crash fires, and the event misses the `test.id` tag. Queue the crash on the executor, so that it follows the scope sync. Print logcat when an Android e2e test fails. * test(android): Run the native backend tests on API 21 `has_native` was false below API 23, so the API 21 e2e job skipped all Android tests and never exercised the file fallback for crash IPC. API 21 is the minimum, so drop the Android clause. * test(android): Replace undecodable bytes in the logcat dump A non-UTF-8 byte in `adb logcat` output raised `UnicodeDecodeError` in the fixture teardown and lost the logcat dump of a failed test. * test(android): Run the native backend integration test on API 21 The API 23 skip blamed `process_vm_readv`, but below API 23 `sentry__process_vm_readv()` calls the raw syscall. * ci(android): Use the default emulator image for e2e tests The e2e tests do not use Google Play services. Use the smaller AOSP images, like the regular Android CI jobs. * fix(android): Don't wait for the crash service on a crashed main thread Below API 29, the app receives the crash service connection on its main thread. A native crash on the main thread before the daemon attached froze the app for 10 s, waiting for a daemon that couldn't attach, and then chained. Don't notify it in that case, so the crash chains at once. A crash on another thread still waits, since the main thread is free to attach the daemon. * fix(android): Don't consume the crash service ready signal A crash on the main thread checks whether the crash service attached without the writer lock. A concurrent send could read the ready signal between the crash handler's poll and read, and the handler then blocked on the drained pipe. Poll without reading, so that every caller sees the signal. A reattach replaces the pipe, which drops the old signal. * test(android): Crash right after init in the e2e test The e2e fixture crashed 1 s after `SentryAndroid.init`, so no test covered a crash on the main thread before the crash service connects. Add an early variant that crashes as soon as the scope is synced. It runs on API 29 and later, where the service connects on a binder thread while the crash handler waits. * test(android): Report an early main-thread crash below API 29 Crash synchronously right after init, so that below API 29 the main looper cannot connect the crash service first, and relaunch the app to send the crash.
* feat: Add offline mode to pause uploads Add sentry_offline_mode_enable/disable/is_enabled. While offline mode is enabled, nothing is uploaded: envelopes are cached when http_retry is enabled and discarded otherwise. Disabling it sends the cached envelopes immediately. Like user consent, the setting is persisted in the database directory and loaded by sentry_init before envelopes from previous runs are sent, so an app that starts while still offline does not try to upload them. The Crashpad handler and the native crash daemon follow it as well. Logs and metrics are still discarded while offline, as they are today while consent is revoked. Refs #929 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ref: Rename offline mode API to sentry_set_offline/sentry_is_offline Replace sentry_offline_mode_enable/disable with sentry_set_offline(int) and sentry_offline_mode_is_enabled with sentry_is_offline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(transport): Don't send queued envelopes while uploads are blocked Offline mode and user consent are checked when an envelope is submitted, but envelopes already queued in the HTTP transport were still sent afterwards. Without connectivity, each of them waited for a network timeout, so sentry_close() could still hit the shutdown timeout after sentry_set_offline(1). Check the upload gate in http_send_task right before sending, and handle a blocked envelope like a network failure, so the existing failure path caches it for retry when http_retry is enabled. Refs #929 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(native): Apply offline mode before the daemon sends dumped envelopes The crash daemon submitted the logs, sessions and transactions dumped by the crashing app before copying user consent and offline mode from shared memory into its run. With offline mode enabled, those envelopes were still uploaded (or timed out without connectivity), and with user consent given, they were held back as if consent was missing. Copy both values before anything is submitted. Refs #929 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Warning
WIP 🚧🔨⏳⛔
Close: #2044
#skip-changelog (WIP)