From aa608f7035b7551ae6b5589319df1f8eb2274c4a Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 2 Sep 2026 13:08:50 +0200 Subject: [PATCH 1/4] fix(native): Initialize null transport in crash daemon The daemon constructs options without calling sentry_init(), so builds with SENTRY_TRANSPORT=none leave the transport pointer unset. Install the internal null transport so crash processing completes without leaving stale envelopes on disk. --- src/backends/native/sentry_crash_daemon.c | 7 ++++++- tests/test_integration_native.py | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/backends/native/sentry_crash_daemon.c b/src/backends/native/sentry_crash_daemon.c index 369e3cd1d..24f4319e5 100644 --- a/src/backends/native/sentry_crash_daemon.c +++ b/src/backends/native/sentry_crash_daemon.c @@ -4678,7 +4678,12 @@ sentry__crash_daemon_main(pid_t app_pid, uint64_t app_tid, HANDLE event_handle, SENTRY_DEBUG("Signaling ready to parent"); sentry__crash_ipc_signal_ready(ipc); - // Transport is already initialized by sentry_options_new(), just start it + // Transport is already initialized by sentry_options_new(), except when + // SENTRY_TRANSPORT=none. Mirror sentry_init() by installing the internal + // null transport in that case, then start it. + if (!options->transport) { + options->transport = sentry__transport_new_null(); + } if (options->transport) { SENTRY_DEBUG("Starting transport"); sentry__transport_startup(options->transport, options); diff --git a/tests/test_integration_native.py b/tests/test_integration_native.py index d7828645e..3d174c5d8 100644 --- a/tests/test_integration_native.py +++ b/tests/test_integration_native.py @@ -1105,6 +1105,25 @@ def test_native_no_dsn_no_crash(cmake): # but won't be uploaded +def test_native_null_transport(cmake): + tmp_path = cmake( + ["sentry_example"], + {"SENTRY_BACKEND": "native", "SENTRY_TRANSPORT": "none"}, + ) + + run_crash( + tmp_path, + "sentry_example", + ["capture-log", "crash"], + env=dict(os.environ, SENTRY_DSN=""), + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + + (run_dir,) = (tmp_path / ".sentry-native").glob("*.run") + assert not list(run_dir.glob("*.envelope")) + + def test_native_external_crash_reporter(cmake, httpserver): """Test external crash reporter invocation with native backend""" tmp_path = cmake( From 5a6c814aa1850281ea82913fac9e78bf332fb948 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 2 Sep 2026 14:05:23 +0200 Subject: [PATCH 2/4] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 796c54fd4..2ffa2d033 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ **Fixes**: - Prevent backend state races when `sentry_reinstall_backend` runs concurrently with scope observer callbacks. ([#2041](https://github.com/getsentry/sentry-native/pull/2041)) +- Native: clean up stale envelopes after crashes with `SENTRY_TRANSPORT=none`. ([#2048](https://github.com/getsentry/sentry-native/pull/2048)) ## 0.16.5 From b01d0721e3d1e49a3ec28fbfca9d15cbb0cf3968 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 2 Sep 2026 15:21:25 +0200 Subject: [PATCH 3/4] drop borderline useless test --- tests/test_integration_native.py | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/tests/test_integration_native.py b/tests/test_integration_native.py index 3d174c5d8..d7828645e 100644 --- a/tests/test_integration_native.py +++ b/tests/test_integration_native.py @@ -1105,25 +1105,6 @@ def test_native_no_dsn_no_crash(cmake): # but won't be uploaded -def test_native_null_transport(cmake): - tmp_path = cmake( - ["sentry_example"], - {"SENTRY_BACKEND": "native", "SENTRY_TRANSPORT": "none"}, - ) - - run_crash( - tmp_path, - "sentry_example", - ["capture-log", "crash"], - env=dict(os.environ, SENTRY_DSN=""), - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - ) - - (run_dir,) = (tmp_path / ".sentry-native").glob("*.run") - assert not list(run_dir.glob("*.envelope")) - - def test_native_external_crash_reporter(cmake, httpserver): """Test external crash reporter invocation with native backend""" tmp_path = cmake( From 39114457145bf5cda7d7c11b572f754da1435476 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 2 Sep 2026 15:27:45 +0200 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ffa2d033..2e52a37a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ **Fixes**: - Prevent backend state races when `sentry_reinstall_backend` runs concurrently with scope observer callbacks. ([#2041](https://github.com/getsentry/sentry-native/pull/2041)) -- Native: clean up stale envelopes after crashes with `SENTRY_TRANSPORT=none`. ([#2048](https://github.com/getsentry/sentry-native/pull/2048)) +- Native: clean up stale envelopes after crashes with `SENTRY_TRANSPORT=none`. ([#2049](https://github.com/getsentry/sentry-native/pull/2049)) ## 0.16.5