Open matthew-carroll opened 1 year ago
It's been reported several times that having the Size(0, 0)
behaviour only in release mode is a huge footgun:
https://github.com/flutter/flutter/issues/14113 https://github.com/flutter/flutter/issues/101478 https://github.com/flutter/flutter/issues/102963
@matthew-carroll
🤔 This sound like the same issue i've been having recently, but in my case it's on iOS simulator debug mode
.
Not sure it's quite the same but this is what happens on my side:
Incident Identifier: EC7BDDED-0D16-4C6A-8EC3-1E5ED4E0D5E8
CrashReporter Key: 76820792-D041-21D4-E3E6-843330DEC992
Hardware Model: MacBookPro18,3
Process: Runner [72044]
Path: /Users/USER/Library/Developer/CoreSimulator/Devices/23514999-5C83-4E98-BCA8-EC20F4FDDD8A/data/Containers/Bundle/Application/4212085C-66BC-4AE3-A3EF-FE05FDC2D8B9/Runner.app/Runner
Identifier: MY_BUNDLE_ID
Version: 0.16.5 (77)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd_sim [70569]
Coalition: com.apple.CoreSimulator.SimDevice.23514999-5C83-4E98-BCA8-EC20F4FDDD8A [16465]
Responsible Process: SimulatorTrampoline [1544]
Date/Time: 2023-04-07 20:36:21.1114 +0100
Launch Time: 2023-04-07 18:08:44.3045 +0100
OS Version: macOS 13.3 (22E252)
Release Type: User
Report Version: 104
Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: FRONTBOARD 2343432205
<RBSTerminateContext| domain:10 code:0x8BADF00D explanation:[application<MY_BUNDLE_ID>:72044] failed to terminate gracefully after 5.0s
ProcessVisibility: Unknown
ProcessState: Running
WatchdogEvent: process-exit
WatchdogVisibility: Background
WatchdogCPUStatistics: (
"Elapsed total CPU time (seconds): 577.920 (user 470.690, system 107.230), 93% CPU",
"Elapsed application CPU time (seconds): 1.753, 0% CPU"
) reportType:CrashLog maxTerminationResistance:Interactive>
```
Triggered by Thread: 0
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x1b17e10dc __psynch_rw_wrlock + 8
1 libsystem_pthread.dylib 0x1b1836bd4 _pthread_rwlock_lock_wait + 80
2 libsystem_pthread.dylib 0x1b1834e70 _pthread_rwlock_lock_slow + 704
3 Flutter 0x112de8cac fml::SyncSwitch::SetSwitch(bool) + 44
4 Flutter 0x112edcf8c flutter::Shell::SetGpuAvailability(flutter::GpuAvailability) + 336
5 Flutter 0x112ac040c -[FlutterEngine setIsGpuDisabled:] + 44
6 Flutter 0x112ac03bc -[FlutterEngine applicationDidEnterBackground:] + 32
7 CoreFoundation 0x10f316ff8 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 140
8 CoreFoundation 0x10f316f1c ___CFXRegistrationPost_block_invoke + 84
9 CoreFoundation 0x10f316424 _CFXRegistrationPost + 404
10 CoreFoundation 0x10f315e10 _CFXNotificationPost + 664
11 Foundation 0x10603109c -[NSNotificationCenter postNotificationName:object:userInfo:] + 88
12 UIKitCore 0x11ce00954 __47-[UIApplication _applicationDidEnterBackground]_block_invoke + 192
13 UIKitCore 0x11c76b36c +[UIViewController _performWithoutDeferringTransitionsAllowingAnimation:actions:] + 132
14 UIKitCore 0x11ce0082c -[UIApplication _applicationDidEnterBackground] + 92
15 UIKitCore 0x11c54edfc __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke_2 + 584
16 UIKitCore 0x11ca1b44c _UIScenePerformActionsWithLifecycleActionMask + 96
17 UIKitCore 0x11c54eb24 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 188
18 UIKitCore 0x11c54e68c -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 212
19 UIKitCore 0x11c54e97c -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 588
20 UIKitCore 0x11c54e374 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 248
21 UIKitCore 0x11c3c13f4 -[UIScene _invalidate] + 632
22 UIKitCore 0x11d025eac -[UIWindowScene _invalidate] + 144
23 UIKitCore 0x11cdf8b44 -[UIApplication workspace:willDestroyScene:withTransitionContext:completion:] + 176
24 UIKitCore 0x11c957424 -[UIApplicationSceneClientAgent scene:willInvalidateWithEvent:completion:] + 260
25 FrontBoardServices 0x112166e18 -[FBSScene _callOutQueue_agent_willDestroyWithTransitionContext:completion:] + 208
26 FrontBoardServices 0x11218f538 __84-[FBSWorkspaceScenesClient _queue_invalidateScene:withTransitionContext:completion:]_block_invoke_2 + 92
27 FrontBoardServices 0x112172704 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 160
28 FrontBoardServices 0x11218f3d0 __84-[FBSWorkspaceScenesClient _queue_invalidateScene:withTransitionContext:completion:]_block_invoke + 244
29 libdispatch.dylib 0x10acb3708 _dispatch_client_callout + 16
30 libdispatch.dylib 0x10acb7644 _dispatch_block_invoke_direct + 376
31 FrontBoardServices 0x1121acf14 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 44
32 FrontBoardServices 0x1121ace08 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 176
33 FrontBoardServices 0x1121acf48 -[FBSSerialQueue _performNextFromRunLoopSource] + 24
34 CoreFoundation 0x10f345c6c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
35 CoreFoundation 0x10f345bb4 __CFRunLoopDoSource0 + 172
36 CoreFoundation 0x10f345324 __CFRunLoopDoSources0 + 232
37 CoreFoundation 0x10f33f958 __CFRunLoopRun + 748
38 CoreFoundation 0x10f33f254 CFRunLoopRunSpecific + 584
39 GraphicsServices 0x1113bfc9c GSEventRunModal + 160
40 UIKitCore 0x11cdf6ff0 -[UIApplication _run] + 868
41 UIKitCore 0x11cdfaf3c UIApplicationMain + 124
42 Runner 0x104cc43d0 main + 64
43 dyld_sim 0x10504d514 start_sim + 20
44 dyld 0x105215f28 start + 2236
Thread 1:: com.apple.uikit.eventfetch-thread
0 libsystem_kernel.dylib 0x1b17dc190 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x1b17ed258 mach_msg2_internal + 76
2 libsystem_kernel.dylib 0x1b17e4398 mach_msg_overwrite + 540
3 libsystem_kernel.dylib 0x1b17dc500 mach_msg + 20
4 CoreFoundation 0x10f3454a8 __CFRunLoopServiceMachPort + 156
5 CoreFoundation 0x10f33fad4 __CFRunLoopRun + 1128
6 CoreFoundation 0x10f33f254 CFRunLoopRunSpecific + 584
7 Foundation 0x1060774bc -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 208
8 Foundation 0x1060776e0 -[NSRunLoop(NSRunLoop) runUntilDate:] + 60
9 UIKitCore 0x11ce96714 -[UIEventFetcher threadMain] + 404
10 Foundation 0x10609cde0 __NSThread__start__ + 704
11 libsystem_pthread.dylib 0x1b1838428 _pthread_start + 116
12 libsystem_pthread.dylib 0x1b1833648 thread_start + 8
Thread 2:: io.flutter.1.ui
0 libsystem_kernel.dylib 0x1b17dc190 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x1b17ed258 mach_msg2_internal + 76
2 libsystem_kernel.dylib 0x1b17e4398 mach_msg_overwrite + 540
3 libsystem_kernel.dylib 0x1b17dc500 mach_msg + 20
4 CoreFoundation 0x10f3454a8 __CFRunLoopServiceMachPort + 156
5 CoreFoundation 0x10f33fad4 __CFRunLoopRun + 1128
6 CoreFoundation 0x10f33f254 CFRunLoopRunSpecific + 584
7 Flutter 0x112dec260 fml::MessageLoopDarwin::Run() + 88
8 Flutter 0x112de5790 fml::MessageLoopImpl::DoRun() + 40
9 Flutter 0x112deaf3c void* std::__1::__thread_proxy
@Juliotati if you think it's the same issue that I described, you can confirm that by checking your layout size in your top level build()
method. If it's zero, return a const SizedBox()
for that frame. The frame after that will have non-zero size.
If that fixes your issue, then it's the same as mine. If it doesn't fix your issue, then you're probably dealing with something else.
This issue is marked P1 but has had no recent status updates.
The P1 label indicates high-priority issues that are at the top of the work list. This is the highest priority level a bug can have if it isn't affecting a top-tier customer or breaking the build. Bugs marked P1 are generally actively being worked on unless the assignee is dealing with a P0 bug (or another P1 bug). Issues at this level should be resolved in a matter of months and should have monthly updates on GitHub.
Please consider where this bug really falls in our current priorities, and label it or assign it accordingly. This allows people to have a clearer picture of what work is actually planned. Thanks!
The triaged-android
label is irrelevant if there is no team-android
label or fyi-android
label.
Triage: Tried to take a quick stab at rewording the issue title. Following up with the framework folks to get some meaningful logging/error handling.
See discussion at https://github.com/flutter/flutter/issues/70147
EDIT: I'm updating this ticket after further investigation. I believe I've root caused the issue. I'm leaving my original post down below for reference.
I believe the root cause of this issue is a crossover between two unexpected Flutter behaviors:
ListView
s will attempt to build children even when the list has no size.In the demo code that I linked, the UI happens to start with a
ListView
that can have infinite children. ThatListView
is supposed to stop building as soon as it fills the viewport.The
ListView
children happen to useAspectRatio
s, which set the height based on the width. The constraints passed to each list item are (0, 0 < h < infinity), i.e., forcing a width of zero. That zero width, combined with theAspectRatio
, forces an overall child size of zero. As a result, theListView
builds children infinitely, because the children have zero size, and they never fill the viewport.Technically, this could be described as user error. However, this situation is so unexpected, and difficult to track down, that I'm tempted to call this a bug. We spent days trying to figure out what was going on here. I'm not sure what the best alteration would be, but I think something should be done to remove the Flutter footgun in this scenario.
I'm seeing a couple variations of an issue where Flutter UIs never appear. In my team's primary app, we get a white screen that never goes away. In a minimal repro app, we get the Flutter splash screen that never goes away.
Repro steps:
flutter clean
flutter pub get
Flutter version:
For the white screen problem in our main app, we've gotten the problem to repro all the way back into the previous major stable release. But we can't share that code, so we're limited to what's in this ticket.
Test device: Samsung Tab S6
Here's a repository with a minimal Flutter project where this problem happens. There's some Dart code in there that I copied and tore apart from another project. My intuition is that the Dart code isn't relevant.
https://github.com/matthew-carroll/flutter_bug_repro
https://user-images.githubusercontent.com/7259036/229954117-b69d9b8d-4e8a-4fe0-a266-40338a6e4b32.MOV