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
* test(logs): add reinit deadlock test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test(metrics): add reinit deadlock test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(batcher): eliminate g_options_lock from flush path to prevent deadlock
When sentry_init() is called while a batcher thread is mid-flush,
a deadlock occurs: the main thread holds g_options_lock and waits
for the batcher thread to join, while the batcher thread tries to
acquire g_options_lock via SENTRY_WITH_OPTIONS during flush.
Store the options pointer in the batcher at startup and use it
directly during flush instead of going through SENTRY_WITH_OPTIONS.
Add sentry__envelope_new_with_dsn() to create envelopes without
locking, and sentry__options_get_user_consent() for lock-free
consent checks.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ref(batcher): store individual fields instead of options pointer
Replace the raw options pointer with individual fields (dsn,
transport, run, user_consent) to avoid unsynchronized access to
options members from the batcher thread. The dsn is incref'd,
and user_consent is a pointer to the atomic field (NULL when
consent is not required).
Revert sentry__options_get_user_consent since it is no longer
needed.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add changelog entry for batcher deadlock fix
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(envelope): hold DSN ref across sentry__envelope_new_with_dsn call
The DSN pointer was extracted under g_options_lock but used after
the lock was released, racing with sentry_close freeing it.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(test): enable metrics instead of logs in metrics_reinit test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(batcher): release DSN ref when thread spawn fails
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,11 @@
1
1
# Changelog
2
2
3
+
## Unreleased
4
+
5
+
**Fixes**:
6
+
7
+
- Fix deadlock when re-initializing the SDK while logs or metrics threads are mid-flush. ([#1518](https://github.com/getsentry/sentry-native/pull/1518))
0 commit comments