TTS problem iOS 17 beta

I see a lot of crashes on iOS 17 beta regarding some problem of "Text To Speech". Does anybody has a clue why TTS crashes? Anybody else seeing the same problem?


Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x000000037f729380
Exception Codes: 0x0000000000000001, 0x000000037f729380
VM Region Info: 0x37f729380 is not in any region.  Bytes after previous region: 3748828033  Bytes before following region: 52622617728
      REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      MALLOC_NANO              280000000-2a0000000 [512.0M] rw-/rwx SM=PRV  
--->  GAP OF 0xd20000000 BYTES
      commpage (reserved)      fc0000000-1000000000 [  1.0G] ---/--- SM=NUL  ...(unallocated)
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [36389]

Triggered by Thread:  9

.....

Thread 9 name:
Thread 9 Crashed:
0   libobjc.A.dylib               	0x000000019eeff248 objc_retain_x8 + 16
1   AudioToolboxCore              	0x00000001b2da9d80 auoop::RenderPipeUser::~RenderPipeUser() + 112 (AUOOPRenderPipePool.mm:400)
2   AudioToolboxCore              	0x00000001b2e110b4 -[AUAudioUnit_XPC internalDeallocateRenderResources] + 92 (AUAudioUnit_XPC.mm:904)
3   AVFAudio                      	0x00000001bfa4cc04 AUInterfaceBaseV3::Uninitialize() + 60 (AUInterface.mm:524)
4   AVFAudio                      	0x00000001bfa894bc AVAudioEngineGraph::PerformCommand(AUGraphNodeBaseV3&, AVAudioEngineGraph::ENodeCommand, void*, unsigned int) const + 772 (AVAudioEngineGraph.mm:3317)
5   AVFAudio                      	0x00000001bfa93550 AVAudioEngineGraph::_Uninitialize(NSError**) + 132 (AVAudioEngineGraph.mm:1469)
6   AVFAudio                      	0x00000001bfa4b50c AVAudioEngineImpl::Stop(NSError**) + 396 (AVAudioEngine.mm:1081)
7   AVFAudio                      	0x00000001bfa4b094 -[AVAudioEngine stop] + 48 (AVAudioEngine.mm:193)
8   TextToSpeech                  	0x00000001c70b3c5c __55-[TTSSynthesisProviderAudioEngine renderSpeechRequest:]_block_invoke + 1756 (TTSSynthesisProviderAudioEngine.m:613)
9   libdispatch.dylib             	0x00000001ae4b0740 _dispatch_call_block_and_release + 32 (init.c:1519)
10  libdispatch.dylib             	0x00000001ae4b2378 _dispatch_client_callout + 20 (object.m:560)
11  libdispatch.dylib             	0x00000001ae4b990c _dispatch_lane_serial_drain + 748 (queue.c:3885)
12  libdispatch.dylib             	0x00000001ae4ba470 _dispatch_lane_invoke + 432 (queue.c:3976)
13  libdispatch.dylib             	0x00000001ae4c5074 _dispatch_root_queue_drain_deferred_wlh + 288 (queue.c:6913)
14  libdispatch.dylib             	0x00000001ae4c48e8 _dispatch_workloop_worker_thread + 404 (queue.c:6507)

...

Thread 9 crashed with ARM Thread State (64-bit):
    x0: 0x0000000283309360   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x00000002833093c0
    x4: 0x00000002833093c0   x5: 0x0000000101737740   x6: 0x0000000000000013   x7: 0x00000000ffffffff
    x8: 0x0000000283309360   x9: 0x3c788942d067009a  x10: 0x0000000101547000  x11: 0x0000000000000000
   x12: 0x00000000000007fb  x13: 0x00000000000007fd  x14: 0x000000001ee24020  x15: 0x0000000000000020
   x16: 0x0000b1037f729360  x17: 0x000000037f729360  x18: 0x0000000000000000  x19: 0x0000000000000000
   x20: 0x00000001016a8de8  x21: 0x0000000283e21d00  x22: 0x0000000283b3f1f8  x23: 0x0000000283098000
   x24: 0x00000001bfb4fc35  x25: 0x00000001bfb4fc43  x26: 0x000000028033a688  x27: 0x0000000280c93090
   x28: 0x0000000000000000   fp: 0x000000016fc86490   lr: 0x00000001b2da9d80
    sp: 0x000000016fc863e0   pc: 0x000000019eeff248     cpsr: 0x1000
   esr: 0x92000006 (Data Abort) byte read Translation fault







Hi there! When you get a moment, please file a bug report using Feedback Assistant here https://developer.apple.com/bug-reporting/

It will help the team triage and understand the issue if you're able to upload the crash report and a sysdiagnose using the tool. Thank you!

Hi, I have already filed one -> see https://feedbackassistant.apple.com/feedback/12417110.

I am now able to reproduce the problem, just use TTS with "Xcode address sanitizer" enabled on a real device shows the problem (in simulator it doesn't).

let synth         = AVSpeechSynthesizer()
let utterance  = AVSpeechUtterance(string: "Here we go")
       
synth.speak(utterance)                               // synthprovider.offlineRendering problem

Same here. Also able to reproduce with address sanitizer enabled. @And0Austria, I can't see your bug report in Feedback Assistant (can only see my own entries). I know it's a long shot, but did you get any response from Apple on your bug report? Or did you find a workaround to prevent the crash?

Same here, Has anyone found a working solution for this problem yet?

I also encountered the same problem, mostly triggered when switching to the foreground after being in the background for more than 10 minutes, and the available memory was very low. Only occurs in iOS17

This is still happening with the last RC, and Xcode 15 does not compile when the address sanitizer is enabled, so we can also not debug it.

I can confirm that we also have crashes in iOS17 related to TTS.

I am going to report them, but Apple has never fixed any of the issues I have reported in 14 years of iOS development, so I hope that at least they can use the crashlog to figure out something.

  • This is our biggest crash and is affecting more than 200 users.
  • It is happening either with compiling with Xcode 15, or also in previous versions.
  • It is happening to users who have iOS17 in their phones.

--- Crashed: com.apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000147482280 0 libobjc.A.dylib objc_retain_x8 + 16 1 AudioToolboxCore auoop::RenderPipeUser::~RenderPipeUser() + 112 2 AudioToolboxCore -[AUAudioUnit_XPC internalDeallocateRenderResources] + 92 3 AVFAudio AUInterfaceBaseV3::Uninitialize() + 60 4 AVFAudio AVAudioEngineGraph::PerformCommand(AUGraphNodeBaseV3&, AVAudioEngineGraph::ENodeCommand, void*, unsigned int) const + 772 5 AVFAudio AVAudioEngineGraph::_Uninitialize(NSError**) + 132 6 AVFAudio AVAudioEngineImpl::Stop(NSError**) + 396 7 AVFAudio -[AVAudioEngine dealloc] + 52 8 TextToSpeech TTSSpeechLanguageCanonicalFormToGeneralLanguage 9 libobjc.A.dylib object_cxxDestructFromClass(objc_object*, objc_class*) + 116 10 libobjc.A.dylib objc_destructInstance + 80 11 libobjc.A.dylib _objc_rootDealloc + 80 12 TextToSpeech TTSSpeechLanguageCanonicalFormToGeneralLanguage 13 TextToSpeech TTSVocalizerCopyURLForFallbackResource 14 TextToSpeech TTSSpeechUnitTestingMode 15 TextToSpeech AXAVSpeechSynthesisVoiceFromTTSSpeechVoice 16 libobjc.A.dylib object_cxxDestructFromClass(objc_object*, objc_class*) + 116 17 libobjc.A.dylib objc_destructInstance + 80 18 libobjc.A.dylib _objc_rootDealloc + 80 19 TextToSpeech TTSSpeechTransformTextWithLanguageAndVoiceIdentifier

have the same problem on watchOS 10.

I had the same problem,please replay me if there is a solution.

The same problem is even in iOS17.0.3. :(

I meet the same problem also even in iOS17.0.3.

Faced the same issue and I implemented a workaround that so far seems working (still testing the app but didn't crash after letting "talk" for 20 hours). Releasing a reallocating the AVSpeechSynthesizer every "x" time it speeches (after checking it is not speaking - that includes queued utterance, at least from my tests).

Hope this helps, waiting for a resolution of the bug.

Please comment here in case you still see crashes from the same bug.

- (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didFinishSpeechUtterance:(nonnull AVSpeechUtterance *)utterance
{
    countVoiceAnnouced++;
    
    // doing this to workaround apple bug - crashing after "x" speeches
    if (countVoiceAnnouced > SPEECHES_BEFORE_RESETTING_BUG_APPLE && !voiceSynthesizer.isSpeaking)
    {
        voiceSynthesizer = nil;
        voiceSynthesizer = [[AVSpeechSynthesizer alloc] init];
        voiceSynthesizer.usesApplicationAudioSession = YES;
        voiceSynthesizer.delegate = self;

        countVoiceAnnouced = 0;
    }
}

@apanda not really, unfortunately... didn't crash anymore while in foreground, but with app going in background (changing the AVAudioSession as inactive) when back in foreground (reactivating the AVAudioSession and speaking) the app crashes "more often". Think I might need to disable the "voice" functionalities in my app until this is fixed

Same problem here when seeing crashes from production on iOS 17.0 - 17.1. Added a feedback to Apple as well. I actually went through crash reports and the issue is happening on the current iOS 17.2 beta as well, no fix there.

TTS problem iOS 17 beta
 
 
Q