Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix main thread checker warnings from AVSpeechSynthesizer #768

Closed
Clstroud opened this issue May 21, 2024 · 0 comments · Fixed by #772
Closed

Fix main thread checker warnings from AVSpeechSynthesizer #768

Clstroud opened this issue May 21, 2024 · 0 comments · Fixed by #772
Assignees

Comments

@Clstroud
Copy link
Collaborator

When playing speech utterances in the various places in Vocable, we now get many console messages from the main thread checker:

Thread Performance Checker: Thread running at User-interactive quality-of-service class waiting on a lower QoS thread running at Default quality-of-service class. Investigate ways to avoid priority inversions
PID: 52026, TID: 9834265
Backtrace
=================================================================
3   Foundation                          0x0000000180e0f1cc -[_NSThreadPerformInfo wait] + 40
4   Foundation                          0x0000000180e1127c -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 596
5   Foundation                          0x0000000180e114e4 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:] + 104
6   TextToSpeech                        0x00000001b050406c TTSSpeechTransformTextWithLanguageAndVoiceIdentifier + 4928
7   TextToSpeech                        0x00000001b0508eec AXAVSpeechSynthesisVoiceFromTTSSpeechVoice + 12152
8   TextToSpeech                        0x00000001b04ffe84 _TTSIdentifierForVoiceInformation + 8076
9   TextToSpeech                        0x00000001b0500210 _TTSIdentifierForVoiceInformation + 8984
10  TextToSpeech                        0x00000001b04fff64 _TTSIdentifierForVoiceInformation + 8300
11  TextToSpeech                        0x00000001b050253c _TTSIdentifierForVoiceInformation + 17988
12  Vocable                             0x00000001029c3170 $s7Vocable30VoiceProfilePreviewSynthesizerC04playD0yySo017AVSpeechSynthesisB0CF + 652
13  Vocable                             0x00000001029724b4 $s7Vocable29VoiceProfilePreviewControllerC04playD0yyAA0bC4ItemVF + 124
14  Vocable                             0x0000000102898a94 $s7Vocable0A24ListContentConfigurationV16voiceProfileItem_10controller0E14SelectedActionAcA05VoicefG0V_AA0kF17PreviewControllerCyycSgtFZyycfU0_ + 116
15  Vocable                             0x00000001029863c4 $s7Vocable0A19ListCellContentViewC37handleLeadingAccessoryActionSelection33_FFC001FFF6F30FECDE42E4E22536E5DELLyyAA14GazeableButtonCF + 1948
16  Vocable                             0x00000001029864a4 $s7Vocable0A19ListCellContentViewC37handleLeadingAccessoryActionSelection33_FFC001FFF6F30FECDE42E4E22536E5DELLyyAA14GazeableButtonCFTo + 52
17  UIKitCore                           0x00000001853ecf04 -[UIApplication sendAction:to:from:forEvent:] + 96
18  UIKitCore                           0x0000000184cfab38 -[UIControl sendAction:to:forEvent:] + 108
19  UIKitCore                           0x0000000184cfae7c -[UIControl _sendActionsForEvents:withEvent:] + 268
20  UIKitCore                           0x0000000184cf78f0 -[UIButton _sendActionsForEvents:withEvent:] + 120
21  UIKitCore                           0x0000000184cfaeb8 -[UIControl _sendActionsForEvents:withEvent:] + 328
22  UIKitCore                           0x0000000184cf78f0 -[UIButton _sendActionsForEvents:withEvent:] + 120
23  UIKitCore                           0x0000000184cf9b14 -[UIControl touchesEnded:withEvent:] + 392
24  Vocable                             0x000000010291e01c $s7Vocable14GazeableButtonC12touchesEnded_4withyShySo7UITouchCG_So7UIEventCSgtF + 168
25  Vocable                             0x000000010291e1b0 $s7Vocable14GazeableButtonC12touchesEnded_4withyShySo7UITouchCG_So7UIEventCSgtFTo + 100
26  UIKitCore                           0x00000001854208e4 -[UIWindow _sendTouchesForEvent:] + 900
27  UIKitCore                           0x0000000185421e08 -[UIWindow sendEvent:] + 3104
28  Vocable                             0x0000000102901bd0 $s7Vocable14HeadGazeWindowC9sendEventyySo7UIEventCF + 2856
29  Vocable                             0x0000000102901df4 $s7Vocable14HeadGazeWindowC9sendEventyySo7UIEventCFTo + 52
30  UIKitCore                           0x00000001854017c8 -[UIApplication sendEvent:] + 576
31  UIKitCore                           0x00000001854849d8 __dispatchPreprocessedEventFromEventQueue + 1684
32  UIKitCore                           0x0000000185487824 __processEventQueue + 5524
33  UIKitCore                           0x0000000185480218 __eventFetcherSourceCallback + 156
34  CoreFoundation                      0x000000018040ee88 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
35  CoreFoundation                      0x000000018040edd0 __CFRunLoopDoSource0 + 172
36  CoreFoundation                      0x000000018040e540 __CFRunLoopDoSources0 + 232
37  CoreFoundation                      0x0000000180408c28 __CFRunLoopRun + 768
38  CoreFoundation                      0x0000000180408514 CFRunLoopRunSpecific + 572
39  GraphicsServices                    0x000000018ef06ae4 GSEventRunModal + 160
40  UIKitCore                           0x00000001853e8040 -[UIApplication _run] + 868
41  UIKitCore                           0x00000001853ebcc8 UIApplicationMain + 124
42  Vocable                             0x00000001029ca724 main + 64

We should consider wrapping this functionality into an actor so that we don't risk hanging the main thread. UI hangs while performing speech synthesis haven't been a huge issue to date, but perhaps we will see some minor performance gains by making this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant