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
Windows app crashes when using .ceil() after update #138693
Comments
I also tested this on the master channel and it is ### not fixed there |
I also tested the launch of Flutter Counter example app and it crashes too, i can see it for a few seconds in task manager and then it crashes (on the same PC as the .ceil() crash problem), maybe this problem is somewhere deeper since even when you stop using .ceil() method, app crashes after the initialization enGqiaO8QP.mp4
|
I also tried building the simple Flutter app (counter app) on the latest Flutter stable release but can't see the issue. flutter doctor -v (stable & master)[√] Flutter (Channel stable, 3.16.0, on Microsoft Windows [Version 10.0.19045.3570], locale en-US)
• Flutter version 3.16.0 on channel stable at C:\WIP\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision db7ef5bf9f (5 hours ago), 2023-11-15 11:25:44 -0800
• Engine revision 74d16627b9
• Dart version 3.2.0
• DevTools version 2.28.2
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\AndroidSDK
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = C:\AndroidSDK
• Java binary at: C:\Program Files\Android\Android Studio Electric Eel 2022.1.1\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.4.4)
• Visual Studio at D:\DOWNLOADWORK\VS2022
• Visual Studio Community 2022 version 17.4.33213.308
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2021.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
[√] Android Studio (version 2022.1)
• Android Studio at C:\Program Files\Android\Android Studio Electric Eel 2022.1.1
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[√] VS Code (version 1.84.2)
• VS Code at C:\Users\ADMIN\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.76.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.3570]
• Chrome (web) • chrome • web-javascript • Google Chrome 119.0.6045.124
• Edge (web) • edge • web-javascript • Microsoft Edge 119.0.2151.58
[√] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category. [!] Flutter (Channel master, 3.17.0-10.0.pre.20, on Microsoft Windows [Version 10.0.19045.3570], locale en-US)
• Flutter version 3.17.0-10.0.pre.20 on channel master at C:\WIP\flutter_master
! Warning: `flutter` on your path resolves to C:\WIP\flutter\bin\flutter, which is not inside your current
Flutter SDK checkout at C:\WIP\flutter_master. Consider adding C:\WIP\flutter_master\bin to the front of your
path.
! Warning: `dart` on your path resolves to C:\WIP\flutter\bin\dart, which is not inside your current Flutter SDK
checkout at C:\WIP\flutter_master. Consider adding C:\WIP\flutter_master\bin to the front of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 9baa539251 (44 minutes ago), 2023-11-16 02:12:27 -0500
• Engine revision 3cfcdebe86
• Dart version 3.3.0 (build 3.3.0-135.0.dev)
• DevTools version 2.30.0-dev.4
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git"
directly to perform update checks and upgrades.
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\AndroidSDK
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = C:\AndroidSDK
• Java binary at: C:\Program Files\Android\Android Studio Electric Eel 2022.1.1\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.4.4)
• Visual Studio at D:\DOWNLOADWORK\VS2022
• Visual Studio Community 2022 version 17.4.33213.308
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2021.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
[√] Android Studio (version 2022.1)
• Android Studio at C:\Program Files\Android\Android Studio Electric Eel 2022.1.1
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[√] VS Code (version 1.84.2)
• VS Code at C:\Users\ADMIN\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.76.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.3570]
• Chrome (web) • chrome • web-javascript • Google Chrome 119.0.6045.124
• Edge (web) • edge • web-javascript • Microsoft Edge 119.0.2151.58
[√] Network resources
• All expected network resources are available.
! Doctor found issues in 2 categories. I don't see you use |
I also do not see the issue on my pc, but some users have this problem, how can i debug this? |
The .ceil() problem is in the first(initial) comment in the issue, the flutter sample app crash is the second problem |
Could you share a complete & minimal sample code to replicate the issue?
Please separate the issue into another one for better tracking. When you file a new issue, please provide all information indicated in the issue template. |
Just final int b = (1016.0 * 1.0).ceil(); is enough for crash |
Below is minimal sample code that I call ceil() method as you mentioned above: Sample codeimport 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
final int b = (1016.0 * 1.0).ceil();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
}
}
But the issue is not reproduced in both debug and release modes. Could you ask your user to try running the app using a debugger to get the crash's call stack? For example, here's how to do that using Visual Studio: https://learn.microsoft.com/visualstudio/debugger/how-to-debug-an-executable-not-part-of-a-visual-studio-solution |
import 'package:flutter/material.dart';
void main() {
print('HJERE!');
final int b = (1016.0 * 1.0).ceil();
print('ceil result: ${b}!');
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// TRY THIS: Try running your application with "flutter run". You'll see
// the application has a purple toolbar. Then, without quitting the app,
// try changing the seedColor in the colorScheme below to Colors.green
// and then invoke "hot reload" (save your changes or press the "hot
// reload" button in a Flutter-supported IDE, or press "r" if you used
// the command line to start the app).
//
// Notice that the counter didn't reset back to zero; the application
// state is not lost during the reload. To reset the state, use hot
// restart instead.
//
// This works for code too, not just values: Most code changes can be
// tested with just a hot reload.
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
}
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// TRY THIS: Try changing the color here to a specific color (to
// Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
// change color while the other colors stay the same.
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also a layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
//
// TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
// action in the IDE, or press "p" in the console), to see the
// wireframe for each widget.
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
} Dart_entry.cc version is taken from here: https://dart.googlesource.com/sdk/+/refs/tags/3.2.0/runtime/vm/dart_entry.cc |
Thanks for the update. The issue still is not reproducible with the above sample code on my end. Looking at the screenshot, it seems like you were able to debug the stack trace. Please provide the crash log in text format instead of a screenshot for better readability and investigation. Meanwhile, I will label this for other's input. |
I don't have access to that log, that was tested on user's PC and he will be unavailable for some time, so i'm not able to copy that in text format |
Would it be possible to try this out with a simple Dart script that doesn't use Flutter, in order to reduce the number of moving parts in diagnosing the problem? |
@kirill-21 after the hot fix release with the cherry pick do you still see the crash, if not can you please close this issue. |
Which hot-fix? Issue was never gone on stable channel. There are dozens of related issues on GitHub , after 3.16 flutter is not usable for windows at all :c |
Flutter 3.16.5 has the cherry pick dart-lang/sdk#54215 which was supposed to address this issue. Can you try that version and report back if you still see crashes |
I tested that when it released and it had the same problem |
Thanks for the reply. Did you also test it with the 'dart compile exe' command you mention in #138693 (comment) ? |
dart compile also did not work |
@rmacnak-google were you able to reproduce this on QEMU ? |
No, it seems to be working on QEMU with -cpu core2duo. |
Could it be because unary ceil https://github.com/dart-lang/sdk/blob/main/runtime/vm/compiler/backend/il_x64.cc#L4714 is not guarded by double_truncate_round_supported check? |
Given #138693 (comment) @kirill-21 could you run the same small sample test.dart
via first |
I tried --extra-gen-snapshot-options=--target-unknown-cpu during initial tests, did not help . Is this command working for dart or I should use strictly "--target-unknown-cpu"? |
Yes, just do
|
But if I used --extra-gen-snapshot-options=--target-unknown-cpu for flutter build then what's the reason to test it directly with dart? |
Taking flutter and other pieces of the AOT pipeline(gen_kernel, gen_snapshot) out of the equation simplifies root cause determination. |
Sorry to see this. If you can run dart.exe from flutter\bin\cache\dart-sdk\bin folder from Visual Studio(similarly to how you did it previously #138693 (comment)), or confirm application error in Event Viewer(eventvwr.msc) Windows Logs/Application, that should shed some light as to what is going on. |
If dart wouldn't be accessible via %path% then cmd wouldn't crash and it would print that such command does not exist |
Sorry but as I've said I have to ask users who have this problem to help with tests and it's really time-consuming so if you need to test something, give me whole list of possible outcomes like "do a, if if goes wrong do b, then do c, etc." I'm not able to test every little detail separately, as I've mentioned above, if there's some problem with %path%, then cmd wouldn't crash, I can not test redundant things that are already known |
BUG=flutter/flutter#140138 BUG=flutter/flutter#138784 BUG=flutter/flutter#138693 TEST=manually on win x64 with `__ int3();` added in front of `roundsd` and forced `CpuId::sse41=false;` Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/357218 Cherry-pick-request: #55211 Change-Id: I90a60d4972c5183d43516c628b68a71b7cc76912 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357983 Reviewed-by: Siva Annamalai <asiva@google.com> Commit-Queue: Alexander Aprelev <aam@google.com>
BUG=flutter/flutter#140138 BUG=flutter/flutter#138784 BUG=flutter/flutter#138693 TEST=manually on win x64 with `__ int3();` added in front of `roundsd` and forced `CpuId::sse41=false;` Change-Id: I9e2dbf2615549dcc7c979036b5442276c2e0fb29 Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/357218 Cherry-pick-request: #55211 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358040 Reviewed-by: Siva Annamalai <asiva@google.com> Commit-Queue: Alexander Aprelev <aam@google.com>
Hi @kirill-21 All works fine in flutter 3.19.5 void main() {
print('HJERE!');
final int b = (1016.0 * 1.0).ceil();
print('ceil result: ${b}!');
runApp(const MyApp());
} Debug mode: Launching lib\main.dart on Windows in debug mode...
Building Windows application...
√ Built build\windows\x64\runner\Debug\aaa_bbb.exe.
Debug service listening on ws://127.0.0.1:60264/03U0KslejRs=/ws
Syncing files to device Windows...
flutter: HJERE!
flutter: ceil result: 1016! Release mode: PS C:\src\aaa_bbb> flutter run --release -d windows
Launching lib\main.dart on Windows in release mode...
Building Windows application... 83,8s
√ Built build\windows\x64\runner\Release\aaa_bbb.exe (0.1MB).
Flutter run key commands.
h List all available interactive commands.
c Clear the screen
q Quit (terminate the application on the device).
flutter: HJERE!
flutter: ceil result: 1016!
Application finished.
PS C:\src\aaa_bbb>
|
Thank god issue seems to be finally fixed |
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 |
AnyDesk_as9FKEfHIi.mp4
This started to happen since the latest Flutter 3.16.0 update.
If i remove .ceil(), there will be no crash, for some reason this happens not on all computers, but many users report to me that app is simply not launched because of this error. As soon as i change .ceil() to .toInt() problem disappears
PlatformDispatcher.instance.onError, try catch, FlutterError.onError, runZonedGuarded do not catch any errors
The text was updated successfully, but these errors were encountered: