Skip to content

iOS 14 crash -- Fatal Exception: NSInternalInconsistencyException Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread. #66647

@acoutts

Description

@acoutts

I received this crash report in Crashlytics from a user in the wild. A user was using the app and upon returning to it, the app simply crashed without any error messages.

Unfortunately this means I don't have any way to reproduce the error, but I hope the stack traces caught can help identify the issue. I've included the flutter doctor output including the flutter framework version used to compile the app at the time the user had the issue.

Some information about their device:

Model: iPhone XS Max
Orientation: Portrait
RAM free: 170.94 MB
Disk free: 28.64 GB
Operating System
Version: 14.0.0 (18A373)
Orientation: Portrait
Jailbroken: No

Steps to Reproduce

n/a

Expected results:
App should not crash without warning.

Actual results:
The app suddenly exited (crashed) without any error to the user.

Fatal Exception: NSInternalInconsistencyException
Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.

Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x1aa30a5ac __exceptionPreprocess
1  libobjc.A.dylib                0x1be38442c objc_exception_throw
2  CoreAutoLayout                 0x1be60ad4c -[NSISEngine tryToOptimizeReturningMutuallyExclusiveConstraints]
3  CoreAutoLayout                 0x1be60aa20 -[NSISEngine _optimizeWithoutRebuilding]
4  CoreAutoLayout                 0x1be60a4f8 -[NSISEngine optimize]
5  CoreAutoLayout                 0x1be605b34 -[NSISEngine performPendingChangeNotifications]
6  UIKitCore                      0x1ad13eef4 -[UIView(Hierarchy) layoutSubviews]
7  UIKitCore                      0x1ad151dd4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
8  QuartzCore                     0x1ad65b280 -[CALayer layoutSublayers]
9  QuartzCore                     0x1ad65b73c CA::Layer::layout_if_needed(CA::Transaction*)
10 QuartzCore                     0x1ad66fb64 CA::Layer::layout_and_display_if_needed(CA::Transaction*)
11 QuartzCore                     0x1ad5b7114 CA::Context::commit_transaction(CA::Transaction*, double, double*)
12 QuartzCore                     0x1ad5e2418 CA::Transaction::commit()
13 Flutter                        0x1032e4778 (Missing)
14 Flutter                        0x1035b85ec (Missing)
15 Flutter                        0x1035b9094 (Missing)
16 Flutter                        0x1035b88b0 (Missing)
17 Flutter                        0x1035bedb0 (Missing)
18 Flutter                        0x1032ef46c (Missing)
19 Flutter                        0x1032f13e0 (Missing)
20 CoreFoundation                 0x1aa288050 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
21 CoreFoundation                 0x1aa287c50 __CFRunLoopDoTimer
22 CoreFoundation                 0x1aa2870c4 __CFRunLoopDoTimers
23 CoreFoundation                 0x1aa281178 __CFRunLoopRun
24 CoreFoundation                 0x1aa2804bc CFRunLoopRunSpecific
25 Flutter                        0x1032f12bc (Missing)
26 Flutter                        0x1032f0c44 (Missing)
27 libsystem_pthread.dylib        0x1f185aca8 _pthread_start
28 libsystem_pthread.dylib        0x1f1863788 thread_start
Crashed: io.flutter.1.raster
SIGABRT ABORT 0x00000001d623398c

Crashed: io.flutter.1.raster
0  Runner                         0x1023c0cb8 FIRCLSProcessRecordAllThreads + 392 (FIRCLSProcess.c:392)
1  Runner                         0x1023c109c FIRCLSProcessRecordAllThreads + 423 (FIRCLSProcess.c:423)
2  Runner                         0x1023b79f8 FIRCLSHandler + 34 (FIRCLSHandler.m:34)
3  Runner                         0x1023b36fc __FIRCLSExceptionRecord_block_invoke + 218 (FIRCLSException.mm:218)
4  libdispatch.dylib              0x1a9f08ac8 _dispatch_client_callout + 20
5  libdispatch.dylib              0x1a9f16c8c _dispatch_lane_barrier_sync_invoke_and_complete + 60
6  Runner                         0x1023b2e94 FIRCLSExceptionRecord + 225 (FIRCLSException.mm:225)
7  Runner                         0x1023b318c FIRCLSExceptionRecordNSException + 111 (FIRCLSException.mm:111)
8  Runner                         0x1023b2a74 FIRCLSTerminateHandler() + 279 (FIRCLSException.mm:279)
9  libc++abi.dylib                0x1be4832a8 std::__terminate(void (*)()) + 20
10 libc++abi.dylib                0x1be486174 __cxa_rethrow + 148
11 libobjc.A.dylib                0x1be3845ec objc_exception_rethrow + 44
12 CoreFoundation                 0x1aa2805a8 CFRunLoopRunSpecific + 836
13 Flutter                        0x1032f12bc (Missing)
14 Flutter                        0x1032f0c44 (Missing)
15 libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
16 libsystem_pthread.dylib        0x1f1863788 thread_start + 8

Additional thread dumps have been included in the summary section below.

Logs
com.apple.main-thread
com.apple.main-thread
0  libsystem_kernel.dylib         0x1d620fdd0 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1d620f184 mach_msg + 76
2  CoreFoundation                 0x1aa286cf8 __CFRunLoopServiceMachPort + 380
3  CoreFoundation                 0x1aa280ea8 __CFRunLoopRun + 1216
4  CoreFoundation                 0x1aa2804bc CFRunLoopRunSpecific + 600
5  GraphicsServices               0x1c0d05820 GSEventRunModal + 164
6  UIKitCore                      0x1acc24734 -[UIApplication _run] + 1072
7  UIKitCore                      0x1acc29e10 UIApplicationMain + 168
8  Runner                         0x102363198 main + 7 (AppDelegate.swift:7)
9  libdyld.dylib                  0x1a9f47e60 start + 4

com.apple.uikit.eventfetch-thread
com.apple.uikit.eventfetch-thread
0  libsystem_kernel.dylib         0x1d620fdd0 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1d620f184 mach_msg + 76
2  CoreFoundation                 0x1aa286cf8 __CFRunLoopServiceMachPort + 380
3  CoreFoundation                 0x1aa280ea8 __CFRunLoopRun + 1216
4  CoreFoundation                 0x1aa2804bc CFRunLoopRunSpecific + 600
5  Foundation                     0x1ab4fde30 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 232
6  Foundation                     0x1ab4fdd08 -[NSRunLoop(NSRunLoop) runUntilDate:] + 92
7  UIKitCore                      0x1accd4e94 -[UIEventFetcher threadMain] + 516
8  Foundation                     0x1ab6680f0 __NSThread__start__ + 864
9  libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
10 libsystem_pthread.dylib        0x1f1863788 thread_start + 8

com.apple.NSURLConnectionLoader
com.apple.NSURLConnectionLoader
0  libsystem_kernel.dylib         0x1d620fdd0 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1d620f184 mach_msg + 76
2  CoreFoundation                 0x1aa286cf8 __CFRunLoopServiceMachPort + 380
3  CoreFoundation                 0x1aa280ea8 __CFRunLoopRun + 1216
4  CoreFoundation                 0x1aa2804bc CFRunLoopRunSpecific + 600
5  CFNetwork                      0x1aab39050 _CFURLStorageSessionCopyCache + 63240
6  Foundation                     0x1ab6680f0 __NSThread__start__ + 864
7  libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
8  libsystem_pthread.dylib        0x1f1863788 thread_start + 8

io.flutter.1.ui
io.flutter.1.ui
0  libsystem_kernel.dylib         0x1d620fdd0 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1d620f184 mach_msg + 76
2  CoreFoundation                 0x1aa286cf8 __CFRunLoopServiceMachPort + 380
3  CoreFoundation                 0x1aa280ea8 __CFRunLoopRun + 1216
4  CoreFoundation                 0x1aa2804bc CFRunLoopRunSpecific + 600
5  Flutter                        0x1032f12bc (Missing)
6  Flutter                        0x1032f0c44 (Missing)
7  libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
8  libsystem_pthread.dylib        0x1f1863788 thread_start + 8

io.flutter.1.io
io.flutter.1.io
0  libsystem_kernel.dylib         0x1d620fdd0 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1d620f184 mach_msg + 76
2  CoreFoundation                 0x1aa286cf8 __CFRunLoopServiceMachPort + 380
3  CoreFoundation                 0x1aa280ea8 __CFRunLoopRun + 1216
4  CoreFoundation                 0x1aa2804bc CFRunLoopRunSpecific + 600
5  Flutter                        0x1032f12bc (Missing)
6  Flutter                        0x1032f0c44 (Missing)
7  libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
8  libsystem_pthread.dylib        0x1f1863788 thread_start + 8

io.flutter.worker.1
io.flutter.worker.1
0  libsystem_kernel.dylib         0x1d623375c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x1f185e550 _pthread_cond_wait + 1192
2  libc++.1.dylib                 0x1be422c8c std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28
3  Flutter                        0x1032eb918 (Missing)
4  libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
5  libsystem_pthread.dylib        0x1f1863788 thread_start + 8

io.flutter.worker.2
io.flutter.worker.2
0  libsystem_kernel.dylib         0x1d623375c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x1f185e550 _pthread_cond_wait + 1192
2  libc++.1.dylib                 0x1be422c8c std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28
3  Flutter                        0x1032eb918 (Missing)
4  libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
5  libsystem_pthread.dylib        0x1f1863788 thread_start + 8

io.flutter.worker.3
io.flutter.worker.3
0  libsystem_kernel.dylib         0x1d623375c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x1f185e550 _pthread_cond_wait + 1192
2  libc++.1.dylib                 0x1be422c8c std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28
3  Flutter                        0x1032eb918 (Missing)
4  libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
5  libsystem_pthread.dylib        0x1f1863788 thread_start + 8

io.flutter.worker.4
io.flutter.worker.4
0  libsystem_kernel.dylib         0x1d623375c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x1f185e550 _pthread_cond_wait + 1192
2  libc++.1.dylib                 0x1be422c8c std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28
3  Flutter                        0x1032eb918 (Missing)
4  libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
5  libsystem_pthread.dylib        0x1f1863788 thread_start + 8

io.flutter.worker.5
io.flutter.worker.5
0  libsystem_kernel.dylib         0x1d623375c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x1f185e550 _pthread_cond_wait + 1192
2  libc++.1.dylib                 0x1be422c8c std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28
3  Flutter                        0x1032eb918 (Missing)
4  libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
5  libsystem_pthread.dylib        0x1f1863788 thread_start + 8

io.flutter.worker.6
io.flutter.worker.6
0  libsystem_kernel.dylib         0x1d623375c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x1f185e550 _pthread_cond_wait + 1192
2  libc++.1.dylib                 0x1be422c8c std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28
3  Flutter                        0x1032eb918 (Missing)
4  libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
5  libsystem_pthread.dylib        0x1f1863788 thread_start + 8

dart:io EventHandler
dart:io EventHandler
0  libsystem_kernel.dylib         0x1d62354e4 kevent + 8
1  Flutter                        0x10366fbcc (Missing)
2  Flutter                        0x10369dbd8 (Missing)
3  libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
4  libsystem_pthread.dylib        0x1f1863788 thread_start + 8

com.google.firebase.crashlytics.MachExceptionServer
com.google.firebase.crashlytics.MachExceptionServer
0  libsystem_kernel.dylib         0x1d620fdd0 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1d620f184 mach_msg + 76
2  Runner                         0x1023b9ebc FIRCLSMachExceptionServer + 194 (FIRCLSMachException.c:194)
3  libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
4  libsystem_pthread.dylib        0x1f1863788 thread_start + 8

com.apple.CFSocket.private
com.apple.CFSocket.private
0  libsystem_kernel.dylib         0x1d6233c40 __select + 8
1  libsystem_kernel.dylib         0x1d6233c40 select$DARWIN_EXTSN + 8
2  CoreFoundation                 0x1aa293688 __CFSocketManager + 636
3  libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
4  libsystem_pthread.dylib        0x1f1863788 thread_start + 8

AVAudioSession Notify Thread
AVAudioSession Notify Thread
0  libsystem_kernel.dylib         0x1d620fdd0 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1d620f184 mach_msg + 76
2  CoreFoundation                 0x1aa286cf8 __CFRunLoopServiceMachPort + 380
3  CoreFoundation                 0x1aa280ea8 __CFRunLoopRun + 1216
4  CoreFoundation                 0x1aa2804bc CFRunLoopRunSpecific + 600
5  AudioSession                   0x1b1b222ac GenericRunLoopThread::Entry(void*) + 164
6  AudioSession                   0x1b1b24390 CAPThread::Entry(CAPThread*) + 92
7  libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
8  libsystem_pthread.dylib        0x1f1863788 thread_start + 8

com.squareup.SocketRocket.NetworkThread
com.squareup.SocketRocket.NetworkThread
0  libsystem_kernel.dylib         0x1d620fdd0 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1d620f184 mach_msg + 76
2  CoreFoundation                 0x1aa286cf8 __CFRunLoopServiceMachPort + 380
3  CoreFoundation                 0x1aa280ea8 __CFRunLoopRun + 1216
4  CoreFoundation                 0x1aa2804bc CFRunLoopRunSpecific + 600
5  Foundation                     0x1ab4fde30 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 232
6  Runner                         0x102c4ebb4 -[IntercomSDK__SRRunLoopThread main] + 4310952884
7  Foundation                     0x1ab6680f0 __NSThread__start__ + 864
8  libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
9  libsystem_pthread.dylib        0x1f1863788 thread_start + 8

Thread #1
Thread
0  libsystem_pthread.dylib        0x1f1863774 start_wqthread + 6

Thread #2
Thread
0  libsystem_pthread.dylib        0x1f1863774 start_wqthread + 6

DartWorker
DartWorker
0  libsystem_kernel.dylib         0x1d623375c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x1f185e57c _pthread_cond_wait + 1236
2  Flutter                        0x1037b9a7c (Missing)
3  Flutter                        0x103803440 (Missing)
4  Flutter                        0x1037b93a4 (Missing)
5  libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
6  libsystem_pthread.dylib        0x1f1863788 thread_start + 8

CHHapticEngineDispatchQueue
CHHapticEngineDispatchQueue
0  libsystem_kernel.dylib         0x1d620fdd0 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1d620f184 mach_msg + 76
2  libdispatch.dylib              0x1a9f20e10 _dispatch_mach_send_and_wait_for_reply + 528
3  libdispatch.dylib              0x1a9f211ac dispatch_mach_send_with_result_and_wait_for_reply + 56
4  libxpc.dylib                   0x1f18809f4 xpc_connection_send_message_with_reply_sync + 240
5  Foundation                     0x1ab71b740 __NSXPCCONNECTION_IS_WAITING_FOR_A_SYNCHRONOUS_REPLY__ + 16
6  Foundation                     0x1ab509b8c -[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:] + 2500
7  CoreFoundation                 0x1aa30ce18 ___forwarding___ + 652
8  CoreFoundation                 0x1aa30f420 _CF_forwarding_prep_0 + 96
9  AudioToolbox                   0x1b2f5ea34 -[AVHapticClient setPlayerBehavior:error:] + 500
10 AudioToolbox                   0x1b30c6bcc -[AVHapticPlayer setBehavior:] + 412
11 CoreHaptics                    0x1b31d449c -[CHHapticEngine updateEngineBehavior] + 288
12 CoreHaptics                    0x1b31d6750 -[CHHapticEngine doStartWithCompletionHandler:] + 260
13 CoreHaptics                    0x1b31ced9c __34-[CHHapticEngine dispatchOnLocal:]_block_invoke + 52
14 libdispatch.dylib              0x1a9f06fd0 _dispatch_call_block_and_release + 32
15 libdispatch.dylib              0x1a9f08ac8 _dispatch_client_callout + 20
16 libdispatch.dylib              0x1a9f0fc08 _dispatch_lane_serial_drain + 580
17 libdispatch.dylib              0x1a9f10734 _dispatch_lane_invoke + 408
18 libdispatch.dylib              0x1a9f1a528 _dispatch_workloop_worker_thread + 708
19 libsystem_pthread.dylib        0x1f185c908 _pthread_wqthread + 276
20 libsystem_pthread.dylib        0x1f186377c start_wqthread + 8

Thread #3
Thread
0  libsystem_pthread.dylib        0x1f1863774 start_wqthread + 6

DartWorker
DartWorker
0  libsystem_kernel.dylib         0x1d623375c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x1f185e57c _pthread_cond_wait + 1236
2  Flutter                        0x1037b9a7c (Missing)
3  Flutter                        0x103803440 (Missing)
4  Flutter                        0x1037b93a4 (Missing)
5  libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
6  libsystem_pthread.dylib        0x1f1863788 thread_start + 8

DartWorker
DartWorker
0  libsystem_kernel.dylib         0x1d623375c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x1f185e57c _pthread_cond_wait + 1236
2  Flutter                        0x1037b9a7c (Missing)
3  Flutter                        0x103803440 (Missing)
4  Flutter                        0x1037b93a4 (Missing)
5  libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
6  libsystem_pthread.dylib        0x1f1863788 thread_start + 8

DartWorker
DartWorker
0  libsystem_kernel.dylib         0x1d623375c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x1f185e57c _pthread_cond_wait + 1236
2  Flutter                        0x1037b9a7c (Missing)
3  Flutter                        0x103803440 (Missing)
4  Flutter                        0x1037b93a4 (Missing)
5  libsystem_pthread.dylib        0x1f185aca8 _pthread_start + 320
6  libsystem_pthread.dylib        0x1f1863788 thread_start + 8

Thread #4
Thread
0  libsystem_pthread.dylib        0x1f1863774 start_wqthread + 6

➜  app git:(signup-registration) flutter doctor -v
[✓] Flutter (Channel beta, 1.22.0-12.1.pre, on Mac OS X 10.15.6 19G2021, locale en-US)
    • Flutter version 1.22.0-12.1.pre at /Users/andrewcoutts/Projects/flutter
    • Framework revision 8b3760638a (10 days ago), 2020-09-15 17:47:13 -0700
    • Engine revision 4654fc6cf6
    • Dart version 2.10.0 (build 2.10.0-110.3.beta)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/andrewcoutts/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /Users/andrewcoutts/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0, Build version 12A7209
    • CocoaPods version 1.9.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 49.0.2
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.46.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.12.2

[✓] Connected device (6 available)
    • sdk gphone x86 arm (mobile)         • emulator-5554                        • android-x86    • Android 11 (API 30) (emulator)
    • xff0c-se (mobile)                   • 00008030-0016283036BB802E            • ios            • iOS 14.0
    • iPhone 11 Pro Max (mobile)          • F6557161-52D2-4BC8-A163-C53CF2A7E5D4 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)
    • iPhone SE (2nd generation) (mobile) • E5F90F63-F4F3-4674-96C8-0027CEA33C80 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)
    • Web Server (web)                    • web-server                           • web-javascript • Flutter Tools
    • Chrome (web)                        • chrome                               • web-javascript • Google Chrome 85.0.4183.121
    ! Error: xFF0C 8 is not connected. Xcode will continue when xFF0C 8 is connected. (code -13)

• No issues found!

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: productionIssues experienced in live production appsc: crashStack traces logged to the consolecustomer: crowdAffects or could affect many people, though not necessarily a specific customer.e: OS-version specificAffects only some versions of the relevant operating systemengineflutter/engine related. See also e: labels.platform-iosiOS applications specifically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions