Environment
Upgrading from Sentry Unity SDK 2.4.0 to 3.2.4 causes frequent SIGSEGV crashes in the native Azure Cognitive Services Speech SDK (synthesizer_speak_ssml) on Android 15 devices. The crashes occur when calling SentrySdk.AddBreadcrumb() from ThreadPool background threads during active native SDK operations (not sure if this is causing it, but it might?). Disabling Sentry completely eliminates the crashes.
Environment
- Unity Version: Unity 2022.3.x
- Platform: Android (arm64-v8a)
- Android Version: Android 15 (AP3A.240905.015.A2)
- Sentry Unity SDK:
3.2.4 (crashing) / 2.4.0 (working) / 3.0.0 (no crashes but invalid operation errors)
- Azure Speech SDK:
1.44.0 (Microsoft.CognitiveServices.Speech)
- Build Configuration: IL2CPP, Release build
Steps to Reproduce
- Upgrade Sentry Unity SDK from
2.4.0 to 3.2.4 (required for Android 15 16KB page size support)
- Run speech synthesis operations on Android 15 device
- Call
SentrySdk.AddBreadcrumb() from ThreadPool background threads during/after native SDK operations
Code Pattern:
The problematic code pattern involves calling SentrySdk.AddBreadcrumb() from ThreadPool background threads immediately after native SDK operations complete:
public void Synthesize(string text, Action<Result?,bool> callback, int pitch = 0, int rate = 0, int extraPausesMs = 0)
{
ThreadPool.QueueUserWorkItem(_ =>
{
// Synthesis happens on ThreadPool thread
var audioDataResult = GenerateAudioData(text, pitch, rate, extraPausesMs);
// ...
});
}
private AudioDataResult GenerateAudioData(string text, int pitch = 0, int rate = 0, int extraPausesMs = 0)
{
// ... setup code ...
Task<SpeechSynthesisResult>? synthesisTask = null;
lock (_synthesizerLock)
{
synthesisTask = _synthesizer.SpeakSsmlAsync(ssml); // Native SDK call
}
try
{
result = synthesisTask.ConfigureAwait(false).GetAwaiter().GetResult();
}
catch (ObjectDisposedException) { /* ... */ }
using (result)
{
if (result.Reason == ResultReason.SynthesizingAudioCompleted)
{
var sampleCount = result.AudioData.Length / 2;
float durationMs = (sampleCount * 1000f) / AzureVoiceSampleRate;
// This is called from ThreadPool thread, right after native SDK finishes
SentrySdk.AddBreadcrumb($"Azure Voice Synthesis sampleCount={sampleCount}, durationMs={durationMs:0.0}", category: "Speech");
// More breadcrumbs throughout the method...
SentrySdk.AddBreadcrumb("Azure Voice Synthesis succeeded.", category: "Speech");
return new AudioDataResult() { /* ... */ };
}
// ... error handling with more breadcrumbs ...
}
}
Additional Context:
- We're using Unity IL2CPP, which may affect how Sentry captures async context
- The Azure Speech SDK uses native code that manages its own threading
- We're calling
ConfigureAwait(false).GetAwaiter().GetResult() to block on background threads
- Multiple breadcrumbs are called per synthesis operation (10+ calls per successful synthesis)
Expected Result
Speech synthesis should complete successfully without crashes, as it does with Sentry SDK 2.4.0 or when Sentry is disabled.
Observations:
- Sentry SDK 2.4.0: Works perfectly, no crashes
- Sentry SDK 3.0.0: No crashes, but produces "invalid operation" errors (non-fatal)
- Disabling Sentry: Completely eliminates crashes
Actual Result
Crash Stack Trace:
OS Version: Android 15 (AP3A.240905.015.A2)
Exception Type: Unknown (SIGSEGV)
Application Specific Information: Segfault
Thread 0 Crashed:
0 <unknown> 0x0 <unknown>
1 split_config.arm64_v8a.apk 0x71c2f30340 <unknown> + 488602010432
2 split_config.arm64_v8a.apk 0x71c2c78718 <unknown> + 488599160600
3 split_config.arm64_v8a.apk 0x71c2d6eed4 <unknown> + 488600170196
4 split_config.arm64_v8a.apk 0x71c2c3ad5c synthesizer_speak_ssml
5 split_config.arm64_v8a.apk 0x7339c8cec0 Synthesizer_synthesizer_speak_ssml_m0F0978FD671C3D7841E23212317B38B956BB63C2
6 split_config.arm64_v8a.apk 0x7339c8cd30 U3CU3Ec__DisplayClass91_1_U3CSpeakSsmlAsyncU3Eb__1_m6AF0439228C68149CC80C539C29831968AF8BDF8
7 split_config.arm64_v8a.apk 0x7339c8c238 SpeechSynthesizer_DoAsyncSynthesisAction_mF03CC316FCEDC3444835D96BAC5A6B13B8CD4669
...
26 split_config.arm64_v8a.apk 0x7337dd6f84 AzureVoiceSpeechSynthesizer_GenerateAudioData_m6DCBA2034EE682CE2C60031A146DBE0AE91ADAAB (AzureVoiceSpeechSynthesizer.cs:222)
Crash Characteristics:
- Only occur with Sentry SDK 3.2.4 enabled - disabling Sentry completely eliminates crashes
- Crash in native Azure Speech SDK - specifically in
synthesizer_speak_ssml
- Are Android 15 specific - we need SDK 3.0.0+ for 16KB page size support
- Sentry SDK 3.2.4; 3.2.2, 4.0.0-beta.5: Frequent SIGSEGV crashes in native SDK
Workarounds Attempted:
- ✅ Disabling Sentry: Eliminates crashes but loses error tracking
- ✅ Using SDK 3.0.0: No crashes but invalid operation errors
- ⏳ Removing breadcrumbs: Not yet tested, but planned next step
Questions for Sentry Team
-
Is it safe to call SentrySdk.AddBreadcrumb() from ThreadPool background threads? Our code worked fine with SDK 2.4.0, but crashes with 3.2.4.
-
Are there known threading issues with Sentry SDK 3.2.4 and native libraries on Android 15? The changelog mentions a threading fix in 3.2.3 ("attempting to detach while still running code"), but 3.2.4 still crashes.
-
Should breadcrumbs be deferred to the main thread when called from background threads? Would this be a recommended pattern?
-
What changed between SDK 2.4.0 and 3.2.4 that could cause native SDK interference? Understanding the changes would help us work around the issue.
Request
We need guidance on:
- Best practices for using Sentry SDK 3.x with native libraries on background threads
- Whether this is a known issue and if there's a fix planned
- Recommended workarounds that allow us to keep Sentry enabled while avoiding crashes
We're blocked on upgrading to Android 15-compatible Sentry SDK versions due to these crashes. Any guidance would be greatly appreciated!
Any logs or screenshots
No response
Environment
Upgrading from Sentry Unity SDK
2.4.0to3.2.4causes frequentSIGSEGVcrashes in the native Azure Cognitive Services Speech SDK (synthesizer_speak_ssml) on Android 15 devices. The crashes occur when callingSentrySdk.AddBreadcrumb()from ThreadPool background threads during active native SDK operations (not sure if this is causing it, but it might?). Disabling Sentry completely eliminates the crashes.Environment
3.2.4(crashing) /2.4.0(working) /3.0.0(no crashes but invalid operation errors)1.44.0(Microsoft.CognitiveServices.Speech)Steps to Reproduce
2.4.0to3.2.4(required for Android 15 16KB page size support)SentrySdk.AddBreadcrumb()from ThreadPool background threads during/after native SDK operationsCode Pattern:
The problematic code pattern involves calling
SentrySdk.AddBreadcrumb()from ThreadPool background threads immediately after native SDK operations complete:Additional Context:
ConfigureAwait(false).GetAwaiter().GetResult()to block on background threadsExpected Result
Speech synthesis should complete successfully without crashes, as it does with Sentry SDK
2.4.0or when Sentry is disabled.Observations:
Actual Result
Crash Stack Trace:
Crash Characteristics:
synthesizer_speak_ssmlWorkarounds Attempted:
Questions for Sentry Team
Is it safe to call
SentrySdk.AddBreadcrumb()from ThreadPool background threads? Our code worked fine with SDK 2.4.0, but crashes with 3.2.4.Are there known threading issues with Sentry SDK 3.2.4 and native libraries on Android 15? The changelog mentions a threading fix in 3.2.3 ("attempting to detach while still running code"), but 3.2.4 still crashes.
Should breadcrumbs be deferred to the main thread when called from background threads? Would this be a recommended pattern?
What changed between SDK 2.4.0 and 3.2.4 that could cause native SDK interference? Understanding the changes would help us work around the issue.
Request
We need guidance on:
We're blocked on upgrading to Android 15-compatible Sentry SDK versions due to these crashes. Any guidance would be greatly appreciated!
Any logs or screenshots
No response