Skip to content

feat!: 1.0 - #2196

Open
jpnurmi wants to merge 159 commits into
masterfrom
v1
Open

jpnurmi wants to merge 159 commits into
masterfrom
v1

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Warning

WIP    🚧🔨⏳⛔

Close: #2044

#skip-changelog (WIP)

Run CI on `v1` like on `master`, and dispatch console compatibility
checks to the same-named console branch for commits cut from `v1`.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread .github/workflows/console-check.yml Resolved
@codecov

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 74.84988% with 1089 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.86%. Comparing base (312ed43) to head (8e1af43).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2196      +/-   ##
==========================================
+ Coverage   75.71%   75.86%   +0.14%     
==========================================
  Files         104      105       +1     
  Lines       28706    31331    +2625     
  Branches     5265     5844     +579     
==========================================
+ Hits        21736    23769    +2033     
- Misses       5609     6121     +512     
- Partials     1361     1441      +80     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

The collective PR runs CI on every push to v1 already.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread .github/workflows/codeql.yml Resolved
Pull request analyses are stored against the merge ref, so PRs into v1
had no baseline and compared against master.
* 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)
```

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread src/sentry_options.c Resolved
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

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread src/sentry_scope.c Resolved
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.
Promote the 5-6 years old module API, also used by downstream SDKs,
now that it's usable for direct Native SDK users for comparing frame
addresses with module ranges.

Ref: #2102
Ref: #2116

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

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

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@jpnurmi jpnurmi added the v1 Targets 1.0 (v1 branch) label Oct 16, 2026

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

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
...
```
Comment thread src/backends/sentry_backend_native.c Resolved
Comment thread tests/test_e2e_sentry.py Resolved
Comment thread tests/test_integration_native.py Resolved
Comment thread tests/unit/test_cache.c Resolved
Native AOT apps failed to initialize sentry-native in .NET's chiseled
container images:

```text
failed to create database directory or there is no write access to this directory
```

The warning leaves users baffled. They never configured a database
directory, and nothing in the log says which one it means. Here it was
`.sentry-native` in the working directory, the default in both
sentry-native and the .NET SDK, and the apps run as a non-root user in
the root-owned `/app`. The warning now names the directory:

```text
failed to create database directory "/app/.sentry-native" or there is no write access to this directory
```

This matches the `using database path "..."` message that is logged
when the directory can be created.

Ref: getsentry/sentry-dotnet#5999
Comment thread ndk/build.gradle.kts Resolved
Comment thread src/backends/native/sentry_crash_ipc.c Resolved
Comment thread src/backends/sentry_backend_native.c Resolved
Comment thread src/backends/sentry_backend_native.c Resolved
Comment on lines +4539 to +4604
if (minidump_ref) {
add_minidump_ref(envelope, options, minidump_path, run_folder);
}

#if defined(SENTRY_PLATFORM_ANDROID)
sentry_path_t *android_native_envelope_path
= make_run_envelope_path(options->run, envelope);
#endif

SENTRY_DEBUG("Envelope loaded, capturing");

// Launch reporter, or fall back to transport (consent/caching in core).
if (!sentry__launch_external_crash_reporter(options, envelope)) {
if (options && options->transport && options->run) {
SENTRY_DEBUG("Capturing crash envelope");
sentry__capture_envelope(options->transport, envelope, options);
crash_captured = true;
SENTRY_DEBUG("Crash envelope captured (queued)");
} else {
SENTRY_WARN("No transport available for sending envelope");
sentry_envelope_free(envelope);
#if defined(SENTRY_PLATFORM_ANDROID)
// Tombstone merging needs the sentry-java crash service. The
// standalone daemon is only used in tests and is not supported in
// apps, so it handles the envelope as on Linux.
if (daemon && android_native_envelope_path) {
if (!options->run
|| !sentry__run_write_envelope(options->run, envelope)) {
SENTRY_WARN("Failed to dump crash envelope to run folder");
} else {
SENTRY_DEBUG(
"Crash envelope written for Android tombstone merging");
sentry__atomic_store(&ctx->state, SENTRY_CRASH_STATE_DONE);
SENTRY_DEBUG("Released crashed process for Android tombstone");
strncpy(daemon->envelope_path,
android_native_envelope_path->path,
sizeof(daemon->envelope_path) - 1);
daemon->envelope_path[sizeof(daemon->envelope_path) - 1] = '\0';
daemon->event = sentry_value_incref(base);
sentry_envelope_free(envelope);
envelope = NULL;
}
}
#endif
if (envelope) {
if (options->transport && options->run) {
SENTRY_DEBUG("Capturing crash envelope");
if (!sentry__run_should_skip_upload(options->run)) {
*event_id = sentry__envelope_get_event_id(envelope);
}
sentry__capture_envelope(options->transport, envelope, options);
crash_captured = true;
SENTRY_DEBUG("Crash envelope captured (queued)");
} else {
SENTRY_WARN("No transport available for sending envelope");
sentry_envelope_free(envelope);
}
}
} else {
crash_captured = true;
}

#if defined(SENTRY_PLATFORM_ANDROID)
sentry__path_free(android_native_envelope_path);
#endif

// A crash sent via transport keeps its event until the send has finished.
if (run_folder && sentry_uuid_is_nil(event_id)) {
sentry__crash_event_remove(run_folder);
}

// Keep the original crash envelope for the callback on the next launch.
if (!ctx->has_on_crashed_last_run) {
// A crash sent via transport keeps it until the send has finished.
if (!ctx->has_on_crashed_last_run && sentry_uuid_is_nil(event_id)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retained __sentry-crash.envelope lacks large-minidump attachment-ref

With enable_large_attachments, add_minidump_ref only updates the in-memory envelope, but the on-disk __sentry-crash.envelope is kept whenever event_id is set; on_crashed_last_run and interrupted next-launch recovery then read a crash envelope with no minidump and no attachment-ref. Rewrite envelope_path after adding refs, or stop retaining that file when minidump_ref is used.

Evidence
  • minidump_ref forces embedded_minidump to "", so the file written at envelope_path (__sentry-crash.envelope) has no minidump bytes.
  • add_minidump_ref() only mutates the in-memory envelope (materialize + cache sibling + attachment-ref item); nothing in this function rewrites envelope_path.
  • When transport capture sets *event_id, the new guard keeps that on-disk file (!sentry_uuid_is_nil(event_id) skips unlink) and leaves __sentry-event in place.
  • native_backend_process_old_run() reloads __sentry-crash.envelope for on_crashed_last_run and for interrupted recovery (__sentry-event still present), so those paths observe the incomplete envelope.

Identified by Warden · native-code-review · 2JU-W2Y

Comment thread src/backends/sentry_backend_native.c Resolved
Comment on lines 3043 to 3044
NULLIFY_DIR_ENTRY(5, MINIDUMP_STREAM_LINUX_PROC_STATUS);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NULLIFY_DIR_ENTRY sets stream_type instead of clearing it

On optional Linux stream failure, NULLIFY_DIR_ENTRY assigns the real stream type with size/rva 0, leaving typed empty directory slots instead of fully zeroed ignored entries; set stream_type to 0 (macro is just above this call).

Evidence
  • Local comments say failed optional entries should end as type/size/rva = 0 so consumers ignore the slot; directories is memset to 0 before stream writes.
  • Optional writers such as write_file_as_stream only fill dir after a successful write_data, so on failure the slot is still all zeros when NULLIFY_DIR_ENTRY runs.
  • The macro sets directories[idx].stream_type = (type) while only zeroing data_size and rva, so the failure path’s only effect is introducing a typed empty entry.
  • macOS sentry__write_minidump clears failed optional slots with stream_type = 0 (and rva/size 0), matching the documented Linux intent.

Identified by Warden · native-code-review · LEV-PGZ

Comment on lines +3887 to +3892
const char *content_type = sentry_value_as_string(content_type_val);

if (path && filename && !attachment_is_placeholder(options, path)) {
write_attachment_to_envelope(
fd, path, filename, attachment_type, content_type);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing attachment content_type written as empty string in crash envelope

sentry_value_as_string() returns "" for non-string/missing keys, so attachments without content_type get content_type:"" in the envelope item header; pass NULL when absent (e.g. sentry__attachment_get_content_type) so write_attachment_to_envelope omits the field.

Evidence
  • sentry_value_as_string() returns "" (never NULL) when the value is not a string (src/sentry_value.c).
  • write_attachment_to_envelope() only omits content_type when the pointer is NULL (if (content_type)), so "" is serialized into the item header.
  • Normal crash attachments from the manifest/IPC list often omit content_type; attachment_list/sentry__write_attachment_manifest only set the key when present.
  • The non-crash path uses sentry__attachment_get_content_type() / value_as_string_or_null and only sets the header when non-NULL (sentry__envelope_add_attachment).

Identified by Warden · native-code-review · TLK-PH3

Comment thread src/sentry_scope.c
Comment on lines +534 to +539
if (sentry_value_is_null(integrations)) {
integrations = sentry_value_new_list();
sentry_value_set_by_key(sdk, "integrations", integrations);
}
sentry_value_append(integrations, sentry_value_new_string(name));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UAF if creating sdk integrations list fails mid-set

When integrations is missing, a successful sentry_value_new_list() followed by a failed sentry_value_set_by_key() frees that list while integrations still aliases it, so the following sentry_value_append() is a use-after-free; re-fetch the list after a successful set or skip append when set fails.

Evidence
  • init_global_scope() does integrations = sentry_value_new_list(); sentry_value_set_by_key(sdk, "integrations", integrations); then always sentry_value_append(integrations, ...).
  • sentry_value_set_by_key() takes ownership of v and sentry_value_decref(v) on failure (e.g. OOM cloning the key or growing the object), freeing the new list.
  • The local integrations value is not cleared or re-read after a failed set, so append reads the freed thing_t.
  • Reachable when get_client_sdk() left no integrations list (SENTRY_BACKEND none/custom, or that set failed) and options has a named integration.

Identified by Warden · native-code-review · ZG7-74P

Comment thread tests/test_integration_crashpad.py Resolved
Comment thread tests/test_integration_native.py Resolved
* ci: run WER tests on Windows

WER ignores crashes in processes that inherit SEM_NOGPFAULTERRORBOX,
which CI runners and other non-interactive parents commonly set. Clear
it in pytest when WER tests are enabled, so that crashing test
processes reach WER.

Enable --with_wer on Windows, disable the WER UI so that a crash dialog
cannot hang a job, and log the runner's error mode and WER
configuration.

* ci: enable diagnostic data for WER

The runner images turn diagnostic data off, which makes WER discard
reports before storing them. Raise AllowTelemetry on the policy keys
so that the WER tests can find their reports.

* test(wer): decode crash output as UTF-8

The output contains the UTF-8 database path, which fails to decode
with the cp1252 locale encoding in UTF-8 path builds and leaves the
captured stdout empty.

* test: skip crashpad WER crash tests on MinGW

The fast-fail, stack buffer overrun, and invalid parameter crashes are
only available in MSVC builds.

* test(wer): declare unvirtualizedResources for the AppX fixture

Windows Server 2022 rejects the manifest without it, because the
mediumIL application and its error reporting extension require the
capability there.

* test(native): expect fast fail for ARM64 heap corruption

ARM64 reports the corrupted heap entry as a fast fail with
FAST_FAIL_UNEXPECTED_HEAP_EXCEPTION instead of raising
STATUS_HEAP_CORRUPTION.

* test: remove outdated WER CI comments

The WER tests now run on CI.

* test(wer): do not run breakpad and crashpad expected failures

Each one builds the backend and waits for a WER report that never
arrives, and the breakpad ones are retried three times via the flaky
marker. Not running them saves several minutes of CI time per Windows
job.

* ci: move WER configuration to a script

Drop the diagnostic logging now that the runner configuration is
known, and avoid New-Item -Force, which clears an existing key.

* ci: pass --with_wer on all platforms

The WER tests skip themselves outside Windows.
Comment thread src/unwinder/sentry_unwinder.c Resolved
Comment thread tests/unit/test_native_backend.c Resolved
Comment thread tests/unit/test_scope.c Resolved
Comment thread tests/unit/test_scope.c Resolved
…#2349)

* fix(native): detect daemon startup failure to avoid 10s stall on Linux

On Linux, a daemon that failed to exec or exited before signaling
ready stalled `sentry_init` until the ready timeout. Watch the message
socket during the wait, which only becomes readable when the daemon
exits.

Ref: getsentry/sentry-dart#3585

* Update CHANGELOG.md

* fix(native): detect daemon startup failure on Windows

A daemon that `CreateProcess` started but that exited before signaling
ready still stalled `sentry_init` until the ready timeout. Keep the
daemon's process handle and wait on it along with the ready event.

Ref: getsentry/sentry-dart#3585
Comment thread tests/test_integration_crashpad.py Resolved
Comment thread tests/test_integration_native.py Resolved
Comment thread tests/unit/test_cache.c Resolved
`sentry__parse_cache_filename` also accepts a bare `<uuid>.envelope`
with `attempt = -1`, so `count_cached_envelopes` counted keep-form
names as retry format, and the offline tests would pass if the SDK
wrote the wrong form.

Ref: #2196 (comment)
`sentry_value_as_string` returns an empty string for a missing key, so
the daemon wrote `"content_type": ""` for crash attachments without a
content type. Read it with `sentry__attachment_get_content_type`, which
returns `NULL`, so the item header omits it.

Ref: #2196 (comment)
Comment thread src/backends/sentry_backend_native.c Resolved
* fix(attachments): drop the hardcoded 1 GiB size limit

`sentry__attachment_validate()` rejected attachments over 1 GiB. That
matched Relay's former `max_upload_size` default. When Relay introduced
the upload endpoint, it only accepted the file as the body of the
creation request, so the client was already sending an oversized file
by the time Relay rejected it.

Since getsentry/relay#5685, Relay accepts a bodiless TUS creation
request followed by `PATCH` uploads, which is the flow the SDK uses. The
creation request declares `Upload-Length`, and Relay rejects anything
above `max_upload_size` with `413` before any attachment data is sent.
The SDK then drops the attachment-ref item, records a client report, and
sends the rest of the envelope.

getsentry/relay#6515 raised the default `max_upload_size` to 10 GiB,
leaving the SDK-side copy out of sync. Leave the size limit to the
server.

* docs: drop server feature flag from enable_large_attachments

The note named `projects:relay-upload-endpoint`, which Relay removed
when the upload endpoint became generally available in
getsentry/relay#6171. The remaining upload flags are temporary rollout
flags: `projects:resumable-uploads` makes uploads resumable, and
`projects:relay-minidump-uploads` gates minidump uploads. Naming them
in the API docs would go stale the same way.

* Update CHANGELOG.md
Comment thread tests/unit/test_cache.c
Comment on lines +945 to +972
SENTRY_TEST(cache_offline_mode)
{
#if defined(SENTRY_PLATFORM_NX) || defined(SENTRY_PLATFORM_PS)
SKIP_TEST();
#endif
SENTRY_TEST_OPTIONS_NEW(options);
sentry_options_set_dsn(options, "https://foo@sentry.invalid/42");
sentry_options_set_http_retry(options, true);
sentry_init(options);

sentry_path_t *cache_path
= sentry__path_join_str(options->database_path, "cache");
TEST_ASSERT(!!cache_path);
sentry__path_remove_all(cache_path);

sentry_set_offline(1);

sentry_capture_event(
sentry_value_new_message_event(SENTRY_LEVEL_INFO, "test", "offline"));

int retry_format = 0;
TEST_CHECK_INT_EQUAL(count_cached_envelopes(cache_path, &retry_format), 1);
TEST_CHECK_INT_EQUAL(retry_format, 1);

sentry_set_offline(0);
sentry__path_free(cache_path);
sentry_close();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cache_offline_mode triggers real HTTP retry under test_unit_transport

With http_retry enabled on the default transport, set_offline(0) calls sentry_transport_retry and performs a real request to sentry.invalid on the HTTP unit-test build; install a mock transport (as flush/queued do) and flush the startup retry poll before wiping the cache.

Evidence
  • cache_offline_mode sets http_retry true but never replaces sentry_transport_new_default() with sentry__http_transport_new.
  • tests/test_unit.py test_unit_transport builds without SENTRY_TRANSPORT=none, so the default is curl/winhttp.
  • sentry_set_offline(0) always calls sentry_transport_retry(), which runs retry_send_cb against the live client for the cached envelope.
  • Sibling tests cache_offline_mode_flush/queued mock the client and sentry_flush(5000) before remove_all to avoid startup-poll races; this test does neither.

Identified by Warden · native-test-review · 5W2-UBN

Comment thread tests/unit/test_cache.c Resolved
#2353)

* fix(native): retry Windows minidumps with the copied exception context

The minidump-only cases of `test_native_scope_updates_without_snapshot`
fail on some `windows-2022` runners with `AssertionError: Wait timeout
occurred`, because the daemon drops the crash:

    MiniDumpWriteDump failed: 2147942699
    Minidump mode requires minidump, but minidump failed

`0x8007012B` is `ERROR_PARTIAL_COPY`. With `ClientPointers=TRUE`,
dbghelp reads the remote context sized by the enabled XSTATE features.
With AMX enabled (XSTATE `0x608e7`), that is 11.3 KiB, which runs past
the 6.6-8.0 KiB of stack above the context of this shallow crash.

Retry with the copied exception record and context, as the WER path
already does, and as Crashpad reads only `sizeof(CONTEXT)` of the
exception context. Clear `CONTEXT_XSTATE` in the copy, which only holds
`sizeof(CONTEXT)`. On an AMX runner, all 10 minidump-only crashes then
produced a minidump.

Failures:
- https://github.com/getsentry/sentry-native/actions/runs/43460190688/job/132004723418
- https://github.com/getsentry/sentry-native/actions/runs/44277473923/job/134709168872
- https://github.com/getsentry/sentry-native/actions/runs/44277473923/job/134709168940
- https://github.com/getsentry/sentry-native/actions/runs/44509847830/job/135510909755
- https://github.com/getsentry/sentry-native/actions/runs/45645459970/job/139315482377
- https://github.com/getsentry/sentry-native/actions/runs/45789616342/job/139805024432
- https://github.com/getsentry/sentry-native/actions/runs/45972837352/job/140473685255

Verification:
https://github.com/getsentry/sentry-native/actions/runs/46023305396/job/140596731823

* Update CHANGELOG.md

* fix(native): cast the XSTATE mask to DWORD

CONTEXT_XSTATE and CONTEXT_CONTROL are signed long constants, which
fails the ClangCL build with -Wsign-conversion.
* feat(native): capture WinUI crashes via WER

WinUI fails fast from its dispatcher and XAML event handlers, which
bypasses the unhandled exception filter while keeping the original
exception code (e.g. 0xC0000005), or raises a stowed exception
(0xC000027B).

The WER module only claimed a fixed set of fast-fail codes, inherited
from crashpad, which has no other way to tell which crashes its
in-process handler already captured. The native backend shares crash
state with the WER module, so claim any fatal exception that the
in-process handler has not.

Add a C++/WinRT WinUI fixture and WER integration tests for crashes and
exceptions in dispatcher callbacks and XAML event handlers.

* Update CHANGELOG.md

* test(wer): fix WinUI fixture build with VS 2022

The VS 2022 NuGet task fails with "Sequence contains no elements" when
a C++ project defines no NuGet target moniker. VS 2026 tolerates it.

* test(wer): build WinUI fixture for ARM64

* test(wer): build WinUI fixture for x86
* fix(android): OS context in crash daemon events

Inproc crashes are sent from the outbox by the Android SDK, which
replaces the OS context. The crash daemon sends its events itself, so
they reported `uname`, e.g. `Linux 6.1.162`.

Report Android as the OS with the same values as the Android SDK:

| Field            | Before        | After             | Note                       |
|------------------|---------------|-------------------|----------------------------|
| `name`           | `Linux`       | `Android`         |                            |
| `version`        | `6.1.162`     | `17`              | `ro.build.version.release` |
| `build`          | `android14-…` | `CP3A.261005.005` | `ro.build.display.id`      |
| `kernel_version` |               | `6.1.162-…`       | `uname` release            |

* fix(android): Device context in crash daemon events

Inproc crashes are sent from the outbox by the Android SDK, which adds
the device context. The crash daemon sends its events itself, so they
had none.

Add the same static fields as the Android SDK:

| Field          | Example           | Source                    |
|----------------|-------------------|---------------------------|
| `manufacturer` | `Google`          | `ro.product.manufacturer` |
| `brand`        | `google`          | `ro.product.brand`        |
| `model`        | `Pixel 8 Pro`     | `ro.product.model`        |
| `model_id`     | `CP3A.261005.005` | `ro.build.id`             |
| `family`       | `Pixel`           | first word of `model`     |

* test(android): Verify OS and device contexts in E2E crashes

* Update CHANGELOG.md
bool create = sentry__string_empty(ref->location);
if (!create) {
// Step 1a: TUS upload offset (HEAD, no body)
char *upload_url = sentry__dsn_resolve_url(state->dsn, ref->location);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something that my agent flagged: The way connections are reused under windows apparently does not allow sending the PATCH request to a different host than the create request.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'll check and come up with fixes

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed fix proposals at #2362

*chunk_size = 0;
if (!resp->upload_chunk_granularity || !resp->upload_min_chunk_size
|| !resp->upload_max_chunk_size) {
return true;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, the client treats each of these three headers as optional. I.e. if there's no granularity header, allow any chunk size between min and max. If min or max is missing, treat it as [0, max] or [min, infinity].

The spec currently implies that these headers are always sent from the server, I will fix that.

i++;
continue;
}
int result = tus_upload_file(state, cache_path, item, &ref);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, relay rejects locations that are older than 1 hour. Is that acceptable or do you plan to retry stranded attachments at a much later time? In that case, we have to make our signature validation more lenient.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interrupted uploads resume from the stored location a) on retries with exponential backoff and/or b) on the next app launch, so the location could be hours or even days old. With #2362, if the resume HEAD returns 400, the SDK starts the upload over. Does it sound good?

Comment on lines +935 to 946
static bool
notify_fallback(sentry_crash_ipc_t *ipc)
{
if (!ipc) {
return;
return false;
}

// Write byte to pipe (signal-safe)
char byte = 1;
write(ipc->notify_pipe[1], &byte, 1);
return write(ipc->notify_pipe[1], &byte, 1) == 1;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

macOS notify_fallback can terminate the process with SIGPIPE when the daemon is gone

When the daemon exits, writing to the notification pipe with no reader raises SIGPIPE under the default disposition, terminating the process instead of returning false as the IPC contract promises.

Evidence
  • On macOS, the daemon inherits the notification pipe's read end, and sentry_backend_native.c closes the parent's read end after daemon_start; if spawning fails or the daemon exits, no reader remains.
  • notify_fallback() writes directly to the pipe without checking for readers or suppressing SIGPIPE. The nonblocking flag does not prevent SIGPIPE, and SO_NOSIGPIPE is set only on the separate message socket.
  • sentry__crash_ipc_notify() uses this fallback on the CRASHING path and after a failed crash-frame send. Its header documents returning false when no daemon can be notified; the Linux implementation checks for pipe errors before writing, and the no-daemon SIGPIPE test is Linux-only.

Identified by Warden · code-review · 3X9-RYC

Comment on lines +2366 to +2378
result = run(
tmp_path,
"sentry_test_integration",
["log", "no-setup"],
expect_failure=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
# Linux and Windows log the exit, and macOS never logs a ready timeout
assert (
b"crash daemon exited before signaling ready" in result.stderr
or b"did not signal ready" not in result.stderr
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_native_daemon_start_failure expects process failure when backend proceeds

On Linux (all daemon cases) and on every platform for "exits", fork/spawn succeeds, wait_for_ready only warns, and sentry_init returns 0, so expect_failure=True fails the test; drop expect_failure for those paths and assert the ready/exit logs (and tighten the OR so Linux/Windows must see the exit message).

Evidence
  • run(..., expect_failure=True) requires a non-zero exit from sentry_test_integration with only log/no-setup.
  • Linux daemon_start forks first and only fails exec in the child (_exit(1)), so missing/not-executable/exits still return a live parent PID.
  • After a failed ready wait, sentry_backend_native.c logs "Daemon did not signal ready, proceeding anyway" and continues startup successfully.
  • The final assert also passes when neither log line appears (... or b"did not signal ready" not in result.stderr), so it does not enforce the Linux/Windows exit message the comment claims.

Identified by Warden · native-test-review · LZM-PNX

Comment on lines 378 to +396
@@ -292,13 +385,15 @@ def delayed_create(_req):
"no-setup",
"large-attachment",
"capture-event",
# extra time for sending the first PATCH
"shutdown-timeout",
"10000",
"sleep-after-shutdown",
],
env=env,
timeout=30,
)
finally:
release_create.set()
release_upload.set()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_tus_resume_after_shutdown wait timeout shorter than shutdown+sleep

httpserver.wait(timeout=10) starts when the context opens, but the child intentionally blocks for shutdown-timeout 10000ms plus sleep-after-shutdown 5s before release_upload runs, so the wait often expires and the test fails on CI. Raise the wait timeout above that floor (e.g. 30s) or release the delayed PATCH once the request is observed instead of after the full run.

Evidence
  • with httpserver.wait(timeout=10) wraps the first run() and only release_upload.set() in finally unblocks delayed_upload.
  • That run() passes shutdown-timeout/10000 and sleep-after-shutdown; integration.c calls sentry_close() then sleep_s(5), so the child alone lasts ≥15s while the PATCH handler stays blocked.
  • pytest-httpserver 1.0.10 (tests/requirements.txt) starts the wait clock on context enter and uses remaining time on exit; after ≥15s remaining is 0 unless the server thread has already completed the oneshot.
  • The prior test_tus_shutdown used the default 2s shutdown and no shutdown-timeout 10000, so the same 10s wait had headroom that this change removes.

Identified by Warden · native-test-review · 9BS-K4Y

jpnurmi and others added 6 commits December 1, 2026 15:51
When WER hands a crash to the daemon, the app's crash handler never
runs. The daemon now writes the crash marker and ends the session as
crashed, so the next launch no longer reports an abnormal session and
`sentry_get_crashed_last_run()` returns 1.
Each thread waited a full 100 ms after `PTRACE_ATTACH`, because the
first `waitpid()` rarely finds the thread stopped yet. Walking the 71
threads of a React Native app kept the crashed app frozen for 8 s.
Poll every 1 ms with the same 2 s timeout.
On windows-2022 runners with AMX enabled (XSTATE 0x608e7), the
minidump-only cases of test_native_scope_updates_without_snapshot still
time out after #2353, because its retry with a stack copy of the
context fails too:

    MiniDumpWriteDump failed with client pointers: 2147942699
    MiniDumpWriteDump failed: 2147944184

dbghelp reads the context at the size of all enabled XSTATE features,
11567 bytes with AMX, past the end of the 1232-byte copy. 0x800706F8 is
ERROR_INVALID_USER_BUFFER. Point at the context in shared memory
instead, which has room after it.

Ref: https://github.com/getsentry/sentry-native/actions/runs/46644715709/job/142633033638
* test: Run the sandbox tests on Linux

Rename the macOS sandbox tests to test_integration_sandbox.py and add
Linux tests that simulate sandbox restrictions: a read-only /dev/shm in
a user and mount namespace, and a seccomp filter that blocks ptrace.

The read-only /dev/shm and semaphore leak tests are expected to fail
until the named init semaphore is gone.

* fix(native): Use a mutex for IPC init sync on Linux

sentry_init failed when /dev/shm was not writable, as in containers
and sandboxes that restrict /dev/shm:

  [sentry] WARN failed to create IPC semaphore: Read-only file system
  [sentry] WARN failed to initialize backend

Serialize backend startups with the process-local mutex that macOS and
Android already use instead of a named semaphore. This also stops every
process from leaving a /dev/shm/sem.sentry-init-<pid> file behind.

Ref: getsentry/sentry-dart#3585

* fix(native): Read minidump memory without ptrace on Linux

With ptrace blocked by seccomp, the minidump had no stack or memory
contents, because every read gave up when the attach failed:

  WARN ptrace(PTRACE_ATTACH) failed for TID <tid>: Operation not permitted
  WARN Failed to read stack memory from process <pid> at 0x...: Operation not permitted

Read with process_vm_readv first, which needs no ptrace attach, and
attach only for the PEEKDATA fallback.

Ref: getsentry/sentry-dart#3585

* Update CHANGELOG.md

* test: Skip the Linux sandbox tests under Wine

The Wine job runs on a Linux host but builds Windows binaries, so the
Linux sandbox tests ran there and could not find the executable:

  FileNotFoundError: [Errno 2] No such file or directory: '.../sentry_test_integration'

Ref: https://github.com/getsentry/sentry-native/actions/runs/45821617724/job/139946658959
On arm64 with pointer authentication, frame records hold signed
return addresses. The handler's capture recorded them as junk, and
the daemon's own walk would too, because `SENTRY__STRIP_PAC` only
stripped on macOS.

Replace it with a shared `sentry__strip_pac()`, which keeps the macOS
mask and uses `xpaclri` on Linux and Android, a NOP on CPUs without
PAC. A fixed mask does not fit there because the PAC bits start at
the virtual address size, such as bit 39 on Android.

Like `strip_pac()` in libunwindstack-ndk from
getsentry/libunwindstack-ndk#12 and `StripPACBits()` in crashpad from
getsentry/crashpad#118, it binds the address to x30 with a register
variable for `xpaclri`.

Ref: getsentry/sentry-react-native#7152

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1 Targets 1.0 (v1 branch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1.0

6 participants