-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
Dart Compiler Exited Unexpectedly #124369
Comments
Hi @scottbisaillon Also, could you please retry on the latest master channel to see if the issue still persists or not? |
Hi @huycozy, Sorry for not including the target environment initially. Currently I am targeting a physical Samsung Galaxy S9+ running Android 10. I also just tried on an emulated pixel 3a running Android 13 with the same results. Incase its helpful, I am developing on a Windows 11 machine. The issue persists on the latest master channel as well. This is the stacktrace, which appears to be the same:
So far I have only gotten this issue when a |
Thanks for responding with more information! Also, you may wanna try a temporary workaround at #114672 (comment) that may work for your case (similar case with |
Thank you for the suggestion! Unfortunately that workaround did not work in my case. A new flutter project works without any issues. So far, this has only happened on the current project I am working on. I just discarded my changes and reverted to a different commit on my project and things seem to be working, or I can't find a file that produces the issue when saved at least. This isn't the first occurrence of the issue though. It has has happened previously, with what I believe was the same stacktrace, but I didn't record it at the time. Previously when it happened, running a subsequent This was not the case, however, with the occurrence I am reporting in this issue. I am able to deploy the app each time and it doesn't crash until I save certain files. I will try and incrementally add my changes back and see if I can reproduce the issue in a more controlled manner. |
/cc @johnniwinther |
I was able to reproduce this issue and consistently get it when saving a file with the following contents: @freezed
class RecipeIngredientsEvent with _$RecipeIngredientsEvent {
const factory RecipeIngredientsEvent.recipeIngredientAdded(
RealmRecipeIngredient recipeIngredient,
) = _RecipeIngredientAdded;
}
The following file contents does not trigger the error: abstract class RecipeIngredientsEvent {}
class RecipeIngredientAdded extends RecipeIngredientsEvent {
RecipeIngredientAdded(this.recipeIngredient);
final RealmRecipeIngredient recipeIngredient;
} Is there something possibly not interacting well with generated code using other generated code? This seems to be the only concrete cause I can find. This happens even when the code is generated prior to deploying the app to a device as well as using the |
Some more data points that might help figure out what is going on. The above part 'recipe_ingredients_bloc.freezed.dart';
part 'recipe_ingredients_event.dart';
part 'recipe_ingredients_state.dart';
class RecipeIngredientsBloc
extends Bloc<RecipeIngredientsEvent, RecipeIngredientsState> {
RecipeIngredientsBloc({
List<RealmRecipeIngredient>? recipeIngredients,
}) : super(
_RecipeIngredientsState(
recipeIngredients:
recipeIngredients?.map((e) => ListItem(value: e)).toIList() ??
IList(),
),
) {
on<_RecipeIngredientAdded>(_onRecipeIngredientAdded);
}
void _onRecipeIngredientAdded(
_RecipeIngredientAdded event,
Emitter<RecipeIngredientsState> emit,
) {
emit(
state.copyWith(
recipeIngredients: state.recipeIngredients
.add(ListItem(value: event.recipeIngredient)),
),
);
}
} which also triggers the failure. I think I have confirmed through trial and error that it is indeed the Wrapping it with something like class RealmRecipeIngredientWrapper {
RealmRecipeIngredientWrapper(this.value);
final RealmRecipeIngredient value;
} and then using that value in the I am not sure where this leaves this issue and whether or not its an actual bug, or just something to code around, perhaps until static metaprogramming is out. |
When the Dart compiler is crashing, that is definitely a bug and something the Dart team will be interested in fixing. I think the next thing you could do that would be most helpful for getting the issue fixed would be if you can make a small set of files you can share (ideally one small file) that reproduces the crash. One strategy to do this would be: take just that group of files (including the generated files) and put them in a new project, and delete everything in those files that refers to other parts of your app. Then keep deleting as much as you can while still reproducing the problem. It's also possible that someone will look at this on Monday and find that the stack trace you shared is enough to diagnose the problem. So you could wait to see if that's the case. |
Here is a small repo that demonstrates the bug: https://github.com/scottbisaillon/flutter_test_app_bug_-124369. Please let me know if there is anything else I can do. |
Thanks for providing a minimal sample code. I can reproduce the issue on the latest stable and master channels with a similar stack trace when performing Labeling the issue for further investigation. flutter doctor -v (stable and master)[✓] Flutter (Channel stable, 3.7.10, on macOS 13.0.1 22A400 darwin-x64, locale en-VN)
• Flutter version 3.7.10 on channel stable at /Users/huynq/Documents/GitHub/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4b12645012 (2 days ago), 2023-04-03 17:46:48 -0700
• Engine revision ec975089ac
• Dart version 2.19.6
• DevTools version 2.20.1
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at /Users/huynq/Library/Android/sdk
• Platform android-33, build-tools 32.0.0
• ANDROID_HOME = /Users/huynq/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E222b
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.1)
• Android Studio at /Applications/Android Studio.app/Contents
• 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.15+0-b2043.56-8887301)
[✓] IntelliJ IDEA Community Edition (version 2022.1.1)
• IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
• 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
[✓] VS Code (version 1.77.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.60.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • macOS 13.0.1 22A400 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 111.0.5563.146
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found! [!] Flutter (Channel master, 3.10.0-3.0.pre.30, on macOS 13.0.1 22A400 darwin-x64, locale en-VN)
• Flutter version 3.10.0-3.0.pre.30 on channel master at /Users/huynq/Documents/GitHub/flutter_master
! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2cf8502589 (7 minutes ago), 2023-04-10 20:21:24 -0700
• Engine revision 4a7f3f2a1f
• Dart version 3.0.0 (build 3.0.0-427.0.dev)
• DevTools version 2.23.1
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at /Users/huynq/Library/Android/sdk
• Platform android-33, build-tools 32.0.0
• ANDROID_HOME = /Users/huynq/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E222b
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.1)
• Android Studio at /Applications/Android Studio.app/Contents
• 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.15+0-b2043.56-8887301)
[✓] IntelliJ IDEA Community Edition (version 2022.1.1)
• IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
• 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
[✓] VS Code (version 1.77.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.62.0
[✓] Connected device (3 available)
• SM T225 (mobile) • R9JT3004VRJ • android-arm64 • Android 13 (API 33)
• macOS (desktop) • macos • darwin-x64 • macOS 13.0.1 22A400 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 112.0.5615.49
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category. |
@jensjoha can you take a look? |
Status: Reproduced without flutter and realm... |
Redirecting factories are encoded as "return redirect(bla);", but apparently the ffi transformation changes that and we crash. This reproduces the error. Bug: flutter/flutter#124369 Change-Id: Iecfc815071b69c7f84cc8cb03306732d72f42e3a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294540 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Jens Johansen <jensj@google.com>
@jensjoha can I assume this to you? |
…ories A redirecting factory is normally encoded as something like ``` static factory •({required self::HelperClass bar = #C1}) → self::Bar return new self::Foo::•(bar: bar); ``` which the CFE also expects to recreate its internal state when loading a dill file. The Finalizable transformation from FFI can change that to something like: ``` static factory •({required self::HelperClass bar = #C1}) → self::Bar { return block { final synthesized self::Foo :expressionValueWrappedFinalizable = new self::Foo::•(bar: bar); _in::reachabilityFence(bar); } =>:expressionValueWrappedFinalizable; } ``` though, which the CFE doesn't understand and subsequently crashes as in flutter/flutter#124369 This CL makes the CFE understand this transformed version, fixing the crash. TEST=Existing tests; added incremental compiler test. Change-Id: I5e7a5fc6201e4419e9ec1ca69d5522d5190f1f83 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294761 Reviewed-by: Daco Harkes <dacoharkes@google.com> Commit-Queue: Jens Johansen <jensj@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
This should now be fixed on the dart side. |
This engine roll has the dart sdk fix: flutter/engine#41161 This hasn't rolled to the framework yet. Once it has, I will close this bug. |
I greatly appreciate the quickness this was looked into, thank you! |
The fix should now be in the Flutter SDK master channel as of: 082227b. If you would like to know when this fix will reach an official Flutter release channel, please see: https://github.com/flutter/flutter/wiki/Where%27s-my-commit%3F. |
hey this same error is happening with me now , and i update flutter 6 days ago. Hot reload is not working anymore for me, complier just crashes. Here is the stack-trace. how do i fix this ? #0 RedirectingFactoryBody.restoreFromDill (package:front_end/src/fasta/kernel/redirecting_factory_body.dart:121:39) #1 DillLibraryBuilder._addClass (package:front_end/src/fasta/dill/dill_library_builder.dart:202:34) #6 new ScopeNameIterator (package:front_end/src/fasta/scope.dart:1017:28) #11 IncrementalCompiler.compileExpression. (package:front_end/src/fasta/incremental_compiler.dart:1986:22) |
@fluttermaster |
@mraleph |
@fluttermaster if that does not help update to |
Same happening for me, looking forward to see it be merged to stable =( |
…ting factories A redirecting factory is normally encoded as something like ``` static factory •({required self::HelperClass bar = #C1}) → self::Bar return new self::Foo::•(bar: bar); ``` which the CFE also expects to recreate its internal state when loading a dill file. The Finalizable transformation from FFI can change that to something like: ``` static factory •({required self::HelperClass bar = #C1}) → self::Bar { return block { final synthesized self::Foo :expressionValueWrappedFinalizable = new self::Foo::•(bar: bar); _in::reachabilityFence(bar); } =>:expressionValueWrappedFinalizable; } ``` though, which the CFE doesn't understand and subsequently crashes as in flutter/flutter#124369 This CL makes the CFE understand this transformed version, fixing the crash. Cherry-pick notes: Technically pkg/front_end/testcases/incremental/ffi_03.yaml and pkg/front_end/testcases/incremental/ffi_03.yaml.world.1.expect were added in https://dart-review.googlesource.com/c/sdk/+/294540 (as a crash reproduction) and only modified in https://dart-review.googlesource.com/c/sdk/+/294761 but naturally included here. TEST=Existing tests; added incremental compiler test. Fixes: #52332 Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/294761 Change-Id: Iae538fd36df9b014935003ac3410d1281c2e35f6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302202 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Kevin Chisholm <kevinjchisholm@google.com> Reviewed-by: Daco Harkes <dacoharkes@google.com>
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 |
I am intermittently getting a crash when saving certain files in my Flutter project. I can't seem to narrow down what in a file causes the issue, but not all files do. Below is the trace when running
flutter run --verbose
.Steps to Reproduce
Expected results:
Does not crash.
Actual results:
Crashes on some files, but not all.
Logs
The text was updated successfully, but these errors were encountered: