Repository navigation
Exception: RenderViewport exceeded its maximum number of layout cycles #23527
Description
I have an application that has horizontally scrollable tiles within a vertically scrollable list. These tiles are dynamically sized based on the screen size. It works well, but I noticed that on the iPhone 6s the tile sizes were calculated to be Size(104.1935483870967687, 156.2903225806451530). For some reason, this exact size caused the render exception below to be thrown. All other tile sizes I tried worked fine. Here is a pic of the sample app below which will reproduce the error on an iPhone 6s simulator.
Steps to Reproduce
Run this sample application on the iPhone 6s simulator to see the render exception. Note, the tiles are normally dynamically sized, but I noticed that the exact size of (104.1935483870967687, 156.2903225806451530) was causing the exception so I have the sizes hardcode for now. Scroll the screen up and down to see the exception.
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _tabIndex = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
body: (_tabIndex == 0) ? _createHomePage(context) : Container(),
);
}
Widget _createHomePage(BuildContext context) {
return ListView(
children: List.generate(100, (index) => _createRow(context, index))
);
}
Widget _createRow(BuildContext context, int rowIndex) {
if (rowIndex % 3 == 0 || rowIndex % 3 == 1)
return SizedBox(height: 24.0);
// NOTE: the real code would call calculateTileSize(screenWidth) which returned the values below
var screenWidth = MediaQuery.of(context).size.width;
var tileSize = Size(104.1935483870967687, 156.2903225806451530); // calculateTileSize(screenWidth);
return Column(
children: <Widget>[
SizedBox(height: 16.0),
Text("Row $rowIndex"),
SizedBox(height: 4.0),
SizedBox(
width: screenWidth,
height: tileSize.height,
child: ListView(
key: PageStorageKey<String>("RowKey$rowIndex"),
scrollDirection: Axis.horizontal,
children: List.generate(100, (tileIndex) => _createTile(context, rowIndex, tileIndex, tileSize)),
),
)
],
);
}
Widget _createTile(BuildContext context, int rowIndex, int tileIndex, Size tileSize) {
return Padding(
padding: const EdgeInsets.only(right: 8.0),
child: Container(
color: _getTileColor(rowIndex, tileIndex),
child: SizedBox(
width: tileSize.width,
height: tileSize.height,
),
),
);
}
Color _getTileColor(int rowIndex, int tileIndex) {
var index = (rowIndex * 5 + tileIndex) % Colors.accents.length;
return Colors.accents[index];
}
}Logs
[ +30 ms] executing: [/Users/scottdewald/Tools/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +32 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/beta
[ ] executing: [/Users/scottdewald/Tools/flutter/] git rev-parse --abbrev-ref HEAD
[ +9 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] beta
[ ] executing: [/Users/scottdewald/Tools/flutter/] git ls-remote --get-url origin
[ +10 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ ] executing: [/Users/scottdewald/Tools/flutter/] git log -n 1 --pretty=format:%H
[ +14 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[ ] f37c235c32fc15babe6dc7b7bc2ee4387e5ecf92
[ ] executing: [/Users/scottdewald/Tools/flutter/] git log -n 1 --pretty=format:%ar
[ +11 ms] Exit code 0 from: git log -n 1 --pretty=format:%ar
[ ] 4 weeks ago
[ ] executing: [/Users/scottdewald/Tools/flutter/] git describe --match v*.*.* --first-parent --long --tags
[ +14 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[ ] v0.9.4-0-gf37c235c3
[ +279 ms] executing: /Users/scottdewald/Library/Android/sdk/platform-tools/adb devices -l
[ +8 ms] Exit code 0 from: /Users/scottdewald/Library/Android/sdk/platform-tools/adb devices -l
[ ] List of devices attached
[ +4 ms] executing: idevice_id -h
[ +38 ms] /usr/bin/xcrun simctl list --json devices
[+1002 ms] Launching lib/main.dart on iPhone 6s in debug mode...
[ +10 ms] executing: /usr/bin/defaults read /Users/scottdewald/Programming/FlutterTest2/flutter_test_2/ios/Runner/Info CFBundleIdentifier
[ +141 ms] Exit code 0 from: /usr/bin/defaults read /Users/scottdewald/Programming/FlutterTest2/flutter_test_2/ios/Runner/Info CFBundleIdentifier
[ ] $(PRODUCT_BUNDLE_IDENTIFIER)
[ +11 ms] Building Runner.app for 6761ACC4-D0CD-474F-A6BA-C13BC11C8482.
[ +7 ms] executing: script /dev/null /usr/bin/log stream --style syslog --predicate processImagePath CONTAINS "6761ACC4-D0CD-474F-A6BA-C13BC11C8482"
[ +27 ms] [DEVICE LOG] Filtering the log data using "processImagePath CONTAINS "6761ACC4-D0CD-474F-A6BA-C13BC11C8482""
[ +4 ms] [DEVICE LOG] Timestamp (process)[PID]
[ +123 ms] /Users/scottdewald/Tools/flutter/bin/cache/dart-sdk/bin/dart /Users/scottdewald/Tools/flutter/bin/cache/artifacts/engine/darwin-x64/frontend_server.dart.snapshot --sdk-root /Users/scottdewald/Tools/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --strong --target=flutter --no-link-platform --incremental --packages /Users/scottdewald/Programming/FlutterTest2/flutter_test_2/.packages --output-dill build/app.dill --depfile build/snapshot_blob.bin.d /Users/scottdewald/Programming/FlutterTest2/flutter_test_2/lib/main.dart
[+1476 ms] Building bundle
[ ] Writing asset files to build/flutter_assets
[ +41 ms] Wrote build/flutter_assets
[ +1 ms] executing: /usr/bin/xcrun simctl get_app_container 6761ACC4-D0CD-474F-A6BA-C13BC11C8482 com.example.flutterTest2
[ ] executing: /usr/bin/killall Runner
[ +203 ms] executing: /usr/bin/xcrun simctl launch 6761ACC4-D0CD-474F-A6BA-C13BC11C8482 com.example.flutterTest2 --enable-dart-profiling --enable-checked-mode --observatory-port=0
[ +217 ms] com.example.flutterTest2: 13612
[ ] Waiting for observatory port to be available...
[ +264 ms] [DEVICE LOG] 2018-10-25 14:46:49.978355-0500 localhost Runner[13612]: (QuartzCore) [com.apple.coreanimation:WindowServer] Initialized 2 displays
[ +12 ms] [DEVICE LOG] 2018-10-25 14:46:49.991233-0500 localhost Runner[13612]: (libMobileGestalt.dylib) libMobileGestalt MobileGestalt.c:890: MGIsDeviceOneOfType is not supported on this platform.
[ ] [DEVICE LOG] 2018-10-25 14:46:49.991289-0500 localhost Runner[13612]: (libMobileGestalt.dylib) MGIsDeviceOneOfType is not supported on this platform.
[ ] [DEVICE LOG] 2018-10-25 14:46:49.992149-0500 localhost Runner[13612]: (libAccessibility.dylib) [com.apple.Accessibility:AccessibilitySupport] Retrieving resting unlock: 0
[ +56 ms] [DEVICE LOG] 2018-10-25 14:46:50.048823-0500 localhost Runner[13612]: (UIKitCore) You've implemented -[<UIApplicationDelegate> application:performFetchWithCompletionHandler:], but you still need to add "fetch" to the list of your supported UIBackgroundModes in your Info.plist.
[ ] [DEVICE LOG] 2018-10-25 14:46:50.048961-0500 localhost Runner[13612]: (UIKitCore) You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.
[ +62 ms] [DEVICE LOG] 2018-10-25 14:46:50.111898-0500 localhost Runner[13612]: (Flutter) flutter: Observatory listening on http://127.0.0.1:58557/
[ +3 ms] Observatory URL on device: http://127.0.0.1:58557/
[ +3 ms] Connecting to service protocol: http://127.0.0.1:58557/
[ +131 ms] Successfully connected to service protocol: http://127.0.0.1:58557/
[ +2 ms] getVM: {}
[ +9 ms] getIsolate: {isolateId: isolates/487795111}
[ +4 ms] _flutter.listViews: {isolateId: isolates/487795111}
[ +37 ms] DevFS: Creating new filesystem on the device (null)
[ ] _createDevFS: {fsName: flutter_test_2}
[ +21 ms] DevFS: Created new filesystem on the device (file:///Users/scottdewald/Library/Developer/CoreSimulator/Devices/6761ACC4-D0CD-474F-A6BA-C13BC11C8482/data/Containers/Data/Application/4A8502F4-32FC-4AAB-876B-08511B6E5886/tmp/flutter_test_2sqYo1u/flutter_test_2/)
[ +1 ms] Updating assets
[ +161 ms] Syncing files to device iPhone 6s...
[ +2 ms] DevFS: Starting sync from LocalDirectory: '/Users/scottdewald/Programming/FlutterTest2/flutter_test_2'
[ ] Scanning project files
[ +6 ms] Scanning package files
[ +91 ms] Scanning asset files
[ ] Scanning for deleted files
[ +8 ms] Compiling dart to kernel with 436 updated files
[ +4 ms] /Users/scottdewald/Tools/flutter/bin/cache/dart-sdk/bin/dart /Users/scottdewald/Tools/flutter/bin/cache/artifacts/engine/darwin-x64/frontend_server.dart.snapshot --sdk-root /Users/scottdewald/Tools/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --incremental --strong --target=flutter --output-dill build/app.dill --packages /Users/scottdewald/Programming/FlutterTest2/flutter_test_2/.packages --filesystem-scheme org-dartlang-root
[+1119 ms] Updating files
[ +56 ms] DevFS: Sync finished
[ ] Syncing files to device iPhone 6s... (completed)
[ ] Synced 0.8MB.
[ +1 ms] _flutter.listViews: {isolateId: isolates/487795111}
[ +6 ms] Connected to _flutterView/0x7ffd7bf07be8.
[ +1 ms] 🔥 To hot reload changes while running, press "r". To hot restart (and rebuild state), press "R".
[ ] An Observatory debugger and profiler on iPhone 6s is available at: http://127.0.0.1:58557/
[ ] For a more detailed help message, press "h". To detach, press "d"; to quit, press "q".
[+5492 ms] [DEVICE LOG] 2018-10-25 14:46:57.280789-0500 localhost Runner[13612]: (Flutter) flutter: ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
[ +7 ms] flutter: ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
[ ] [DEVICE LOG] 2018-10-25 14:46:57.287736-0500 localhost Runner[13612]: (Flutter) flutter: The following assertion was thrown during performLayout():
[ ] [DEVICE LOG] 2018-10-25 14:46:57.287823-0500 localhost Runner[13612]: (Flutter) flutter: A RenderViewport exceeded its maximum number of layout cycles.
[ ] [DEVICE LOG] 2018-10-25 14:46:57.287909-0500 localhost Runner[13612]: (Flutter) flutter: RenderViewport render objects, during layout, can retry if either their slivers or their
[ ] [DEVICE LOG] 2018-10-25 14:46:57.288009-0500 localhost Runner[13612]: (Flutter) flutter: ViewportOffset decide that the offset should be corrected to take into account information collected
[ ] [DEVICE LOG] 2018-10-25 14:46:57.288099-0500 localhost Runner[13612]: (Flutter) flutter: during that layout.
[ ] flutter: The following assertion was thrown during performLayout():
[ ] flutter: A RenderViewport exceeded its maximum number of layout cycles.
[ ] flutter: RenderViewport render objects, during layout, can retry if either their slivers or their
[ ] flutter: ViewportOffset decide that the offset should be corrected to take into account information collected
[ ] flutter: during that layout.
[ ] [DEVICE LOG] 2018-10-25 14:46:57.288169-0500 localhost Runner[13612]: (Flutter) flutter: In the case of this RenderViewport object, however, this happened 10 times and still there was no
[ ] [DEVICE LOG] 2018-10-25 14:46:57.288249-0500 localhost Runner[13612]: (Flutter) flutter: consensus on the scroll offset. This usually indicates a bug. Specifically, it means that one of the
[ ] [DEVICE LOG] 2018-10-25 14:46:57.288347-0500 localhost Runner[13612]: (Flutter) flutter: following three problems is being experienced by the RenderViewport object:
[ ] [DEVICE LOG] 2018-10-25 14:46:57.288427-0500 localhost Runner[13612]: (Flutter) flutter: * One of the RenderSliver children or the ViewportOffset have a bug such that they always think
[ ] flutter: In the case of this RenderViewport object, however, this happened 10 times and still there was no
[ ] flutter: consensus on the scroll offset. This usually indicates a bug. Specifically, it means that one of the
[ ] flutter: following three problems is being experienced by the RenderViewport object:
[ ] flutter: * One of the RenderSliver children or the ViewportOffset have a bug such that they always think
[ ] [DEVICE LOG] 2018-10-25 14:46:57.288512-0500 localhost Runner[13612]: (Flutter) flutter: that they need to correct the offset regardless.
[ ] [DEVICE LOG] 2018-10-25 14:46:57.288621-0500 localhost Runner[13612]: (Flutter) flutter: * Some combination of the RenderSliver children and the ViewportOffset have a bad interaction such
[ ] [DEVICE LOG] 2018-10-25 14:46:57.288713-0500 localhost Runner[13612]: (Flutter) flutter: that one applies a correction then another applies a reverse correction, leading to an infinite
[ ] [DEVICE LOG] 2018-10-25 14:46:57.288998-0500 localhost Runner[13612]: (Flutter) flutter: loop of corrections.
[ ] [DEVICE LOG] 2018-10-25 14:46:57.289109-0500 localhost Runner[13612]: (Flutter) flutter: * There is a pathological case that would eventually resolve, but it is so complicated that it
[ ] [DEVICE LOG] 2018-10-25 14:46:57.289379-0500 localhost Runner[13612]: (Flutter) flutter: cannot be resolved in any reasonable number of layout passes.
[ ] [DEVICE LOG] 2018-10-25 14:46:57.290086-0500 localhost Runner[13612]: (Flutter) flutter:
[ ] flutter: that they need to correct the offset regardless.
[ ] flutter: * Some combination of the RenderSliver children and the ViewportOffset have a bad interaction such
[ ] flutter: that one applies a correction then another applies a reverse correction, leading to an infinite
[ ] flutter: loop of corrections.
[ ] flutter: * There is a pathological case that would eventually resolve, but it is so complicated that it
[ ] flutter: cannot be resolved in any reasonable number of layout passes.
[ ] flutter:
[ ] [DEVICE LOG] 2018-10-25 14:46:57.290177-0500 localhost Runner[13612]: (Flutter) flutter: When the exception was thrown, this was the stack:
[ ] flutter: When the exception was thrown, this was the stack:
[ +1 ms] [DEVICE LOG] 2018-10-25 14:46:57.293689-0500 localhost Runner[13612]: (Flutter) flutter: #0 RenderViewport.performLayout.<anonymous closure> (package:flutter/src/rendering/viewport.dart:1253:9)
[ ] flutter: #0 RenderViewport.performLayout.<anonymous closure> (package:flutter/src/rendering/viewport.dart:1253:9)
[ ] [DEVICE LOG] 2018-10-25 14:46:57.293855-0500 localhost Runner[13612]: (Flutter) flutter: #1 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1273:6)
[ ] [DEVICE LOG] 2018-10-25 14:46:57.293968-0500 localhost Runner[13612]: (Flutter) flutter: #2 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1506:7)
[ ] flutter: #1 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1273:6)
[ ] flutter: #2 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1506:7)
[ ] [DEVICE LOG] 2018-10-25 14:46:57.294094-0500 localhost Runner[13612]: (Flutter) flutter: #3 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:765:18)
[ ] [DEVICE LOG] 2018-10-25 14:46:57.294224-0500 localhost Runner[13612]: (Flutter) flutter: #4 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:270:19)
[ ] flutter: #3 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:765:18)
[ ] flutter: #4 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:270:19)
[ ] [DEVICE LOG] 2018-10-25 14:46:57.294342-0500 localhost Runner[13612]: (Flutter) flutter: #5 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:674:13)
[ ] [DEVICE LOG] 2018-10-25 14:46:57.294466-0500 localhost Runner[13612]: (Flutter) flutter: #6 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:208:5)
[ ] flutter: #5 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:674:13)
[ ] flutter: #6 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:208:5)
[ ] [DEVICE LOG] 2018-10-25 14:46:57.294588-0500 localhost Runner[13612]: (Flutter) flutter: #7 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
[ ] [DEVICE LOG] 2018-10-25 14:46:57.294744-0500 localhost Runner[13612]: (Flutter) flutter: #8 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)
[ ] [DEVICE LOG] 2018-10-25 14:46:57.294859-0500 localhost Runner[13612]: (Flutter) flutter: #9 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:842:5)
[ ] flutter: #7 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
[ ] flutter: #8 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)
[ ] flutter: #9 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:842:5)
[ ] [DEVICE LOG] 2018-10-25 14:46:57.294981-0500 localhost Runner[13612]: (Flutter) flutter: #10 _invoke (dart:ui/hooks.dart:139:13)
[ ] [DEVICE LOG] 2018-10-25 14:46:57.295098-0500 localhost Runner[13612]: (Flutter) flutter: #11 _drawFrame (dart:ui/hooks.dart:128:3)
[ ] flutter: #10 _invoke (dart:ui/hooks.dart:139:13)
[ ] flutter: #11 _drawFrame (dart:ui/hooks.dart:128:3)
[ +6 ms] [DEVICE LOG] 2018-10-25 14:46:57.303394-0500 localhost Runner[13612]: (Flutter) flutter:
[ ] flutter:
[ ] [DEVICE LOG] 2018-10-25 14:46:57.303466-0500 localhost Runner[13612]: (Flutter) flutter: The following RenderObject was being processed when the exception was fired:
[ ] [DEVICE LOG] 2018-10-25 14:46:57.303520-0500 localhost Runner[13612]: (Flutter) flutter: RenderViewport#51a50 NEEDS-LAYOUT NEEDS-PAINT
[ ] flutter: The following RenderObject was being processed when the exception was fired:
[ ] flutter: RenderViewport#51a50 NEEDS-LAYOUT NEEDS-PAINT
[ ] [DEVICE LOG] 2018-10-25 14:46:57.303586-0500 localhost Runner[13612]: (Flutter) flutter: creator: Viewport ← _ScrollableScope ← IgnorePointer-[GlobalKey#1ac85] ← Semantics ← Listener ←
[ ] [DEVICE LOG] 2018-10-25 14:46:57.303670-0500 localhost Runner[13612]: (Flutter) flutter: _GestureSemantics ← RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#fd452] ←
[ ] flutter: creator: Viewport ← _ScrollableScope ← IgnorePointer-[GlobalKey#1ac85] ← Semantics ← Listener ←
[ ] flutter: _GestureSemantics ← RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#fd452] ←
[ ] [DEVICE LOG] 2018-10-25 14:46:57.303743-0500 localhost Runner[13612]: (Flutter) flutter: _ScrollSemantics-[GlobalKey#83949] ← Scrollable ← PrimaryScrollController ← ListView ← MediaQuery
[ ] [DEVICE LOG] 2018-10-25 14:46:57.303808-0500 localhost Runner[13612]: (Flutter) flutter: ← ⋯
[ ] [DEVICE LOG] 2018-10-25 14:46:57.303886-0500 localhost Runner[13612]: (Flutter) flutter: parentData: <none> (can use size)
[ ] [DEVICE LOG] 2018-10-25 14:46:57.303970-0500 localhost Runner[13612]: (Flutter) flutter: constraints: BoxConstraints(0.0<=w<=375.0, 0.0<=h<=667.0)
[ ] [DEVICE LOG] 2018-10-25 14:46:57.304055-0500 localhost Runner[13612]: (Flutter) flutter: layer: OffsetLayer#c85aa
[ ] flutter: _ScrollSemantics-[GlobalKey#83949] ← Scrollable ← PrimaryScrollController ← ListView ← MediaQuery
[ ] flutter: ← ⋯
[ ] flutter: parentData: <none> (can use size)
[ ] flutter: constraints: BoxConstraints(0.0<=w<=375.0, 0.0<=h<=667.0)
[ ] flutter: layer: OffsetLayer#c85aa
[ ] [DEVICE LOG] 2018-10-25 14:46:57.304131-0500 localhost Runner[13612]: (Flutter) flutter: size: Size(375.0, 667.0)
[ ] [DEVICE LOG] 2018-10-25 14:46:57.304216-0500 localhost Runner[13612]: (Flutter) flutter: axisDirection: down
[ ] [DEVICE LOG] 2018-10-25 14:46:57.304420-0500 localhost Runner[13612]: (Flutter) flutter: crossAxisDirection: right
[ ] [DEVICE LOG] 2018-10-25 14:46:57.304786-0500 localhost Runner[13612]: (Flutter) flutter: offset: ScrollPositionWithSingleContext#0e979(offset: 270.2, range: 0.0..7738.6, viewport: 667.0,
[ ] [DEVICE LOG] 2018-10-25 14:46:57.305005-0500 localhost Runner[13612]: (Flutter) flutter: ScrollableState, AlwaysScrollableScrollPhysics -> BouncingScrollPhysics,
[ ] [DEVICE LOG] 2018-10-25 14:46:57.305168-0500 localhost Runner[13612]: (Flutter) flutter: BallisticScrollActivity#3fb6e(AnimationController#4a359(▶ 270.207; for BallisticScrollActivity)),
[ ] [DEVICE LOG] 2018-10-25 14:46:57.305375-0500 localhost Runner[13612]: (Flutter) flutter: ScrollDirection.forward)
[ ] flutter: size: Size(375.0, 667.0)
[ ] flutter: axisDirection: down
[ ] flutter: crossAxisDirection: right
[ ] flutter: offset: ScrollPositionWithSingleContext#0e979(offset: 270.2, range: 0.0..7738.6, viewport: 667.0,
[ ] flutter: ScrollableState, AlwaysScrollableScrollPhysics -> BouncingScrollPhysics,
[ ] flutter: BallisticScrollActivity#3fb6e(AnimationController#4a359(▶ 270.207; for BallisticScrollActivity)),
[ ] flutter: ScrollDirection.forward)
[ ] [DEVICE LOG] 2018-10-25 14:46:57.305463-0500 localhost Runner[13612]: (Flutter) flutter: anchor: 0.0
[ ] [DEVICE LOG] 2018-10-25 14:46:57.305608-0500 localhost Runner[13612]: (Flutter) flutter: This RenderObject had the following descendants (showing up to depth 5):
[ ] [DEVICE LOG] 2018-10-25 14:46:57.305785-0500 localhost Runner[13612]: (Flutter) flutter: RenderSliverPadding#0b812 relayoutBoundary=up1 NEEDS-PAINT
[ ] [DEVICE LOG] 2018-10-25 14:46:57.305909-0500 localhost Runner[13612]: (Flutter) flutter: RenderSliverList#e6967 relayoutBoundary=up2 NEEDS-PAINT
[ ] [DEVICE LOG] 2018-10-25 14:46:57.306068-0500 localhost Runner[13612]: (Flutter) flutter: RenderRepaintBoundary#8a47c relayoutBoundary=up3 NEEDS-PAINT
[ ] [DEVICE LOG] 2018-10-25 14:46:57.306192-0500 localhost Runner[13612]: (Flutter) flutter: RenderConstrainedBox#467ee relayoutBoundary=up4 NEEDS-PAINT
[ ] [DEVICE LOG] 2018-10-25 14:46:57.306363-0500 localhost Runner[13612]: (Flutter) flutter: RenderRepaintBoundary#bca97 relayoutBoundary=up3 NEEDS-PAINT
[ ] flutter: anchor: 0.0
[ ] flutter: This RenderObject had the following descendants (showing up to depth 5):
[ ] flutter: RenderSliverPadding#0b812 relayoutBoundary=up1 NEEDS-PAINT
[ ] flutter: RenderSliverList#e6967 relayoutBoundary=up2 NEEDS-PAINT
[ ] flutter: RenderRepaintBoundary#8a47c relayoutBoundary=up3 NEEDS-PAINT
[ ] flutter: RenderConstrainedBox#467ee relayoutBoundary=up4 NEEDS-PAINT
[ ] flutter: RenderRepaintBoundary#bca97 relayoutBoundary=up3 NEEDS-PAINT
[ ] [DEVICE LOG] 2018-10-25 14:46:57.307227-0500 localhost Runner[13612]: (Flutter) flutter: RenderConstrainedBox#f871a relayoutBoundary=up4 NEEDS-PAINT
[ ] [DEVICE LOG] 2018-10-25 14:46:57.307326-0500 localhost Runner[13612]: (Flutter) flutter: RenderRepaintBoundary#2a880 relayoutBoundary=up3 NEEDS-PAINT
[ ] [DEVICE LOG] 2018-10-25 14:46:57.307410-0500 localhost Runner[13612]: (Flutter) flutter: RenderFlex#daa20 relayoutBoundary=up4 NEEDS-PAINT
[ ] [DEVICE LOG] 2018-10-25 14:46:57.307498-0500 localhost Runner[13612]: (Flutter) flutter: RenderConstrainedBox#4903a relayoutBoundary=up5 NEEDS-PAINT
[ ] [DEVICE LOG] 2018-10-25 14:46:57.307591-0500 localhost Runner[13612]: (Flutter) flutter: RenderParagraph#be4e9 relayoutBoundary=up5 NEEDS-PAINT
[ ] flutter: RenderConstrainedBox#f871a relayoutBoundary=up4 NEEDS-PAINT
[ ] flutter: RenderRepaintBoundary#2a880 relayoutBoundary=up3 NEEDS-PAINT
[ ] flutter: RenderFlex#daa20 relayoutBoundary=up4 NEEDS-PAINT
[ ] flutter: RenderConstrainedBox#4903a relayoutBoundary=up5 NEEDS-PAINT
[ ] flutter: RenderParagraph#be4e9 relayoutBoundary=up5 NEEDS-PAINT
[ ] [DEVICE LOG] 2018-10-25 14:46:57.307675-0500 localhost Runner[13612]: (Flutter) flutter: RenderConstrainedBox#168ed relayoutBoundary=up5 NEEDS-PAINT
[ ] [DEVICE LOG] 2018-10-25 14:46:57.307810-0500 localhost Runner[13612]: (Flutter) flutter: RenderConstrainedBox#960a8 relayoutBoundary=up5 NEEDS-PAINT
[ ] [DEVICE LOG] 2018-10-25 14:46:57.307995-0500 localhost Runner[13612]: (Flutter) flutter: RenderRepaintBoundary#f697f relayoutBoundary=up3
[ ] [DEVICE LOG] 2018-10-25 14:46:57.308139-0500 localhost Runner[13612]: (Flutter) flutter: RenderConstrainedBox#b508d relayoutBoundary=up4
[ ] flutter: RenderConstrainedBox#168ed relayoutBoundary=up5 NEEDS-PAINT
[ ] flutter: RenderConstrainedBox#960a8 relayoutBoundary=up5 NEEDS-PAINT
[ ] flutter: RenderRepaintBoundary#f697f relayoutBoundary=up3
[ ] flutter: RenderConstrainedBox#b508d relayoutBoundary=up4
[ ] [DEVICE LOG] 2018-10-25 14:46:57.308420-0500 localhost Runner[13612]: (Flutter) flutter: RenderRepaintBoundary#d737f relayoutBoundary=up3
[ ] [DEVICE LOG] 2018-10-25 14:46:57.308639-0500 localhost Runner[13612]: (Flutter) flutter: RenderConstrainedBox#369b6 relayoutBoundary=up4
[ ] [DEVICE LOG] 2018-10-25 14:46:57.309010-0500 localhost Runner[13612]: (Flutter) flutter: RenderRepaintBoundary#e167c relayoutBoundary=up3
[ ] flutter: RenderRepaintBoundary#d737f relayoutBoundary=up3
[ ] flutter: RenderConstrainedBox#369b6 relayoutBoundary=up4
[ ] flutter: RenderRepaintBoundary#e167c relayoutBoundary=up3
[ ] [DEVICE LOG] 2018-10-25 14:46:57.309243-0500 localhost Runner[13612]: (Flutter) flutter: RenderFlex#f46ea relayoutBoundary=up4
[ ] [DEVICE LOG] 2018-10-25 14:46:57.309463-0500 localhost Runner[13612]: (Flutter) flutter: RenderConstrainedBox#9bf29 relayoutBoundary=up5
[ ] [DEVICE LOG] 2018-10-25 14:46:57.309661-0500 localhost Runner[13612]: (Flutter) flutter: RenderParagraph#4559e relayoutBoundary=up5
[ ] flutter: RenderFlex#f46ea relayoutBoundary=up4
[ ] flutter: RenderConstrainedBox#9bf29 relayoutBoundary=up5
[ ] flutter: RenderParagraph#4559e relayoutBoundary=up5
[ ] [DEVICE LOG] 2018-10-25 14:46:57.309955-0500 localhost Runner[13612]: (Flutter) flutter: RenderConstrainedBox#74612 relayoutBoundary=up5
[ ] [DEVICE LOG] 2018-10-25 14:46:57.310244-0500 localhost Runner[13612]: (Flutter) flutter: RenderConstrainedBox#d8b8b relayoutBoundary=up5
[ ] [DEVICE LOG] 2018-10-25 14:46:57.310565-0500 localhost Runner[13612]: (Flutter) flutter: RenderRepaintBoundary#c21b0 relayoutBoundary=up3
[ ] [DEVICE LOG] 2018-10-25 14:46:57.310771-0500 localhost Runner[13612]: (Flutter) flutter: RenderConstrainedBox#3051d relayoutBoundary=up4
[ ] flutter: RenderConstrainedBox#74612 relayoutBoundary=up5
[ ] flutter: RenderConstrainedBox#d8b8b relayoutBoundary=up5
[ ] flutter: RenderRepaintBoundary#c21b0 relayoutBoundary=up3
[ ] flutter: RenderConstrainedBox#3051d relayoutBoundary=up4
[ ] [DEVICE LOG] 2018-10-25 14:46:57.310922-0500 localhost Runner[13612]: (Flutter) flutter: RenderRepaintBoundary#8b55f relayoutBoundary=up3
[ ] [DEVICE LOG] 2018-10-25 14:46:57.311068-0500 localhost Runner[13612]: (Flutter) flutter: RenderConstrainedBox#1ccc8 relayoutBoundary=up4
[ ] [DEVICE LOG] 2018-10-25 14:46:57.311225-0500 localhost Runner[13612]: (Flutter) flutter: RenderRepaintBoundary#a8c53 relayoutBoundary=up3
[ ] [DEVICE LOG] 2018-10-25 14:46:57.311393-0500 localhost Runner[13612]: (Flutter) flutter: RenderFlex#9bd17 relayoutBoundary=up4
[ ] [DEVICE LOG] 2018-10-25 14:46:57.311525-0500 localhost Runner[13612]: (Flutter) flutter: RenderConstrainedBox#482bf relayoutBoundary=up5
[ ] flutter: RenderRepaintBoundary#8b55f relayoutBoundary=up3
[ ] flutter: RenderConstrainedBox#1ccc8 relayoutBoundary=up4
[ ] flutter: RenderRepaintBoundary#a8c53 relayoutBoundary=up3
[ ] flutter: RenderFlex#9bd17 relayoutBoundary=up4
[ ] flutter: RenderConstrainedBox#482bf relayoutBoundary=up5
[ ] [DEVICE LOG] 2018-10-25 14:46:57.311685-0500 localhost Runner[13612]: (Flutter) flutter: ...(descendants list truncated after 25 lines)
[ ] [DEVICE LOG] 2018-10-25 14:46:57.311878-0500 localhost Runner[13612]: (Flutter) flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
[ ] flutter: ...(descendants list truncated after 25 lines)
[ ] flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
Analyzing flutter_test_2...
No issues found! (ran in 1.3s)
[✓] Flutter (Channel beta, v0.9.4, on Mac OS X 10.13.6 17G2307, locale en-US)
• Flutter version 0.9.4 at /Users/scottdewald/Tools/flutter
• Framework revision f37c235c32 (4 weeks ago), 2018-09-25 17:45:40 -0400
• Engine revision 74625aed32
• Dart version 2.1.0-dev.5.0.flutter-a2eb050044
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
• Android SDK at /Users/scottdewald/Library/Android/sdk
• Android NDK at /Users/scottdewald/Library/Android/sdk/ndk-bundle
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 10.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.0, Build version 10A255
• ios-deploy 2.0.0
• CocoaPods version 1.5.3
[✓] Android Studio (version 3.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 29.1.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
[✓] IntelliJ IDEA Community Edition (version 2018.2.5)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 29.1.3
• Dart plugin version 182.4999
[✓] VS Code (version 1.28.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 2.19.0
[✓] Connected devices (1 available)
• iPhone 6s • 6761ACC4-D0CD-474F-A6BA-C13BC11C8482 • ios • iOS 12.0 (simulator)
• No issues found!
Activity
idealopamp commentedon Nov 23, 2018
This looks like it could be the same root cause as an issue I filed in #19245 , although in 19245 I have seen this on Android emulators as well as my Pixel 3 XL. At least in 19245, there is an infinite loop in RenderShrinkWrappingViewport.performLayout stemming from floating point precision issues using a scrollOffsetCorrection computed in RenderSliverList.performLayout. One superficial difference compared to 19245 is that RenderShrinkWrappingViewport doesn't have a limit on the number of iterations, so it just goes in an infinite loop instead of throwing an exception.
If your issue is in fact the same root cause, it would make sense that you could see this issue for only one specific widget size because the bug is sensitive to the specific numerical values for the pixels and pixel offsets. RenderViewport mentions some other scenarios that could cause this exception to be raised, but it could also be the floating point precision issue, which I described with a bit more detail in #19245 (comment) .
lidemin commentedon Jan 15, 2019
I have met similar issue when I was using iPhone X, but it can not be reproduced on Android devices or other iPhone models.
vejmartin commentedon Feb 2, 2019
Stumbled across this issue while running a SliverList with a SliverAppBar on Android.
Adding an epsilon comparison in
sliver_list.dartwherefirstChildScrollOffset < 0.0resolved it for me.Replace:
with:
smiLLe commentedon Feb 26, 2019
Same for me, on android emu and iPhone emu
Error:
This happens in a CustomScrollView.
zoechi commentedon Feb 26, 2019
@smiLLe can you please provide a minimal reproduction of your case?
smiLLe commentedon Mar 6, 2019
@zoechi It happens randomly in a complex sliver list in my project. But it does only happen when i scroll to the top and reach the top of the list (The blue overscroll half circle appears).
My layout looks like this:
I will try to create a similar layout in a new project that i can share with you
shafqatu commentedon Mar 17, 2019
I have the same problem too, I am testing the same app on both android and iOS, on IOS I am getting this error "A RenderViewport exceeded its maximum number of layout cycles." on on simulator and real physical device.
bondanherumurti commentedon Mar 18, 2019
It also happened in my listview
and this is the error generated whenever i reach bottom and scrolled to the top
dark-chocolate commentedon Mar 29, 2019
@zoechi Here is the minimal code that will reproduce the issue, however it is happening not for any particular device, but for all devices.
When you scroll from top to bottom up to say index 25 and suddenly scroll back to the top (0th index) very fast, it shows the error.
Minimal Code
Trace
chunhtai commentedon Apr 9, 2019
It looks like this is caused by double precision error. If we have certain height of widget in sliver list, the way we calculate layout offset of children will introduce some double precision error. Later when we scroll all the way to top, we will try to correct the error by shifting the scroll offset even if it is so tiny and does not really need to be corrected (~2e-14).
Most of the time it is correctable, but some times it fail to do so due to precision error in double operation(again...)
for example iphone 6s
corrected_scrollofset = scrolloffset + correction
if scrolloffset = 258.8489087697789 and correction = 0.00000000000002842170943040401
Then the scrolloffset does not change after correction due to precision error.
258.8489087697789 + 0.00000000000002842170943040401 = 258.8489087697789
Thus, it stuck on an infinite update loop.
I think there is nothing we can do to the floating operation error. This is more like a hardware limitation. The thing we can do is try to find a way to work around this issue. I will put up a pr shortly with possible fix.
github-actions commentedon Aug 14, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.