You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: AOT interop with managed .NET runtimes (#6193)
* feat: preload signal handlers and ignore signal API for managed runtimes
Add SENTRY_CRASH_MANAGED_RUNTIME compile-time flag that:
- Preloads signal handlers via __attribute__((constructor)) before
the managed runtime starts, ensuring correct handler chain order
- Excludes EXC_MASK_BAD_ACCESS and EXC_MASK_ARITHMETIC from Mach
exception monitoring (handled by the managed runtime via signals)
Add ignoreNextSignal: API on PrivateSentrySDKOnly to let hybrid SDKs
tell SentryCrash to skip the next occurrence of a signal on the
calling thread (thread-local, one-shot).
NULL-guard g_onExceptionEvent callback in handleException to prevent
crash if a signal fires between preload and full sentrycrash_install.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* ref: remove unused g_preloaded flag
The flag was originally needed to prevent sentrycrash_setMonitoring()
from re-enabling Mach exceptions after preload. Now that the Mach
exception mask is controlled at compile time via
SENTRY_CRASH_MANAGED_RUNTIME in SentryCrashMonitor_MachException.c,
there is no runtime state to guard.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: managed runtime signal handler lifecycle
Preserve the managed runtime's signal handler chain across
SDK lifecycle transitions (close/start) by skipping uninstall
when not handling a crash. On the crash path, uninstall proceeds
normally since the process is terminating.
* style: rename tl_ignore_signum to tl_ignoreSignum
* fix: restore previous signal handler before re-raising
When the signal monitor is disabled under managed runtime, restore
the previous handler for the signal before re-raising to prevent
an infinite loop. Without SA_NODEFER, the raised signal would be
re-delivered to the same handler after it returns.
* ref: remove g_isHandlingCrash flag
The flag is redundant now that handleSignal() restores individual
handlers before re-raising. uninstallSignalHandler() can be a
blanket no-op under SENTRY_CRASH_MANAGED_RUNTIME.
* fix lint
* Document managed runtime interop in develop-docs/SENTRYCRASH.md
* Consume ignore-next-signal flag on next delivery
Reset the flag on any signal delivery, not just the matching
one. Prevents a stale flag from silently suppressing a later
unrelated signal.
* Re-raise ignored signals instead of returning from handler
Instead of returning early from the signal handler when a signal
is ignored, skip crash processing and fall through to the existing
restore + raise path. This avoids undefined behavior when the
ignored signal originates from abort().
* Make restorePreviousSignalHandler unconditional
Remove the SENTRY_CRASH_MANAGED_RUNTIME guard so ignored signals
are properly re-raised regardless of the compile flag. Harmless
for the non-managed case where uninstall already restored them.
* chore: run make generate-public-api
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Itay Brenner <itay.brenner@sentry.io>
0 commit comments