Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Just a quick hint from my side: since both We have a couple of places that use |
|
At first, I was thinking of passing |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Likewise, |
…dlock 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>
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>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Nice catch |

sentry__batcher_flush()acquiresg_options_lockviaSENTRY_WITH_OPTIONSto gettransport/run:sentry-native/src/sentry_batcher.c
Lines 122 to 132 in 76fbfd6
The batcher thread can never acquire this lock when the main thread holds it across
sentry_close(), such as during re-init of the SDK:Close: #1515