Hello,
We are using TextField with a TextEditingController for controlling newline cursor position and textfield selection updates.
While using this setup we are seeing our Flutter iOS app causes a user's entire iOS device (iPhone or iPad) to freeze and the keyboard becomes unusable in any application even outside of ours. The issue requires a hardware restart to clear it.
We have already verified with Flutter that this seems to be an iOS platform specific bug, as while debugging we havent seen any deadlocks on flutter core code.
Some basic actions which can repro this crash are follows:
If we type in lot of newlines and text in the app, and switch between text and emoji keyboard, after sometime the keyboard freezes.
If on an iPad sometime switching between a physical vs software keyboard while in the app, causes this freeze as well.
While typing in our app for some time and then switching over to some other app like spotlight, we see the keyboard freezing as well.
Attached are the crash logs for all the above scenarios, and they all seem to point to some area of keyboard process:
Auto-Correction - ON on Keyboard
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 TextInputCore 0x00000001cdee8680 KB::String::iterator::operator--+ 747136 () + 132
1 TextInputCore 0x00000001cdee8614 KB::String::iterator::operator--+ 747028 () + 24
2 TextInputCore 0x00000001cdee8c38 KB::String::find_last_of+ 748600 (KB::String const&, KB::String::iterator const&) const + 184
3 TextInputCore 0x00000001cdeaa914 KB::String::find_last_of+ 493844 (KB::String const&) const + 96
4 TextInputCore 0x00000001cdea8d30 TIInputManager::should_generate_candidates+ 486704 (KB::String const&, KB::String const&) const + 152
Predictive - ON on Keyboard
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 TextInputCore 0x1ad3104e4 KB::String::iterator::operator--+ 62692 () + 132
1 TextInputCore 0x1ad310478 KB::String::iterator::operator--+ 62584 () + 24
2 TextInputCore 0x1ad31160c KB::String::last+ 67084 () const + 84
3 TextInputCore 0x1ad3afcdc TIInputManager::filter_raw_candidates+ 715996 (KB::CandidateCollection const&, KB::String const&, KB::String const&, KB::LookupType, __CFString*) const + 204
4 TextInputCore 0x1ad3af1bc TIInputManager::lookup_static_dynamic_candidates(KB::CandidateCollection&, KB::LookupType, KB::String const&, void + 713148 (KB::CandidateCollection&, __CFString*) block_pointer, unsigned int) const + 304
5 TextInputCore 0x1ad3ae608 TIInputManager::perform_lookup(KB::LookupType, unsigned int, void + 710152 (KB::CandidateCollection&, __CFString*) block_pointer) + 1196
6 TextInputCore 0x1ad3adf7c TIInputManager::lookup+ 708476 (KB::LookupType, unsigned int, TIShiftContext) + 340
7 TextInputCore 0x1ad410a6c -[TIKeyboardInputManager predictionCandidates:predictionType:] + 300
8 TextInputCore 0x1ad40f0b8 -[TIKeyboardInputManager autocorrectionListForEmptyInputWithDesiredCandidateCount:] + 820
9 TextInputCore 0x1ad429528 -[TIKeyboardInputManager+ 1213736 (ResultSpecializations) autocorrectionListWithCandidateCount:] + 712
10 TextInputCore 0x1ad421068 -[TIKeyboardInputManager generateAutocorrectionsWithKeyboardState:candidateRange:candidateHandler:] + 564
11 TextInputCore 0x1ad364bf8 -[TIKeyboardInputManagerWrapper generateAutocorrectionsWithKeyboardState:candidateRange:requestToken:completionHandler:] + 656
12 CoreFoundation 0x180f2d304 __invoking___ + 148
Auto-Correct and Predictive OFF on Keyboard
This time it freezes the keyboard when switch to some other app.
Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: FRONTBOARD; [2343432205]
<RBSTerminateContext| domain:10 code:0x8BADF00D explanation:scene-update watchdog transgression: application<com.apple.Spotlight>:265 exhausted real (wall clock) time allowance of 5.00 seconds; Spotlight is unresponsive
ProcessVisibility: Foreground
ProcessState: Running
WatchdogEvent: scene-update
WatchdogVisibility: Foreground
WatchdogCPUStatistics: (
"Elapsed total CPU time (seconds): 11.090 (user 8.890, system 2.200), 33% CPU",
"Elapsed application CPU time (seconds): 0.002, 0% CPU"
) reportType:CrashLog maxTerminationResistance:Interactive>
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x1b80deff0 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x1f1ad42a0 _pthread_cond_wait + 1272
2 Foundation 0x182eb358c -[NSCondition waitUntilDate:] + 148
3 Foundation 0x182ea4fd0 -[NSConditionLock lockWhenCondition:beforeDate:] + 104
4 UIKitCore 0x184054684 -[UIKeyboardTaskQueue lockWhenReadyForMainThread] + 564
5 UIKitCore 0x183e19f4c -[UIKeyboardTaskQueue waitUntilAllTasksAreFinished] + 68
6 UIKitCore 0x184803254 -[UIKeyboardImpl prepareForSelectionChange] + 152
7 UIKitCore 0x184183e5c -[UIKeyboardImpl selectionWillChange:] + 88
8 UIKitCore 0x1841860a8 -[UITextInputController beginSelectionChange] + 48
9 UIKitCore 0x184187604 -[UIFieldEditor beginSelectionChange] + 72
10 UIKitCore 0x184c22498 -[UITextField beginSelectionChange] + 52
11 UIKitCore 0x184068580 -[UITextInteractionAssistant+ 6026624 (UITextInteractionAssistant_Internal) selectAll:] + 68
12 UIKitCore 0x183f96be0 -[UITextField selectAll:] + 84
13 SpotlightUIInternal 0x1ab3733d0 -[SPUITextField selectAll:] + 52
We suspect something with keyboard process which it doesnt like if we touch text selection and cursor position in our app.
Any advise on where we can look into fixing this ?
Also please find complete crash logs for the above snippets.
Predictive-On.crash.txt
AutoCorrect-On.crash.txt
Spotlight.crash.txt