-
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
[flutter_tools] On Windows, running a dart process with an aot snapshot vendored as part of the Dart SDK will cause flutter upgrade to crash #146375
Comments
For context, I am fairly confident that this will not affect macOS and Linux users. With the following main.dart program: import 'dart:async';
void main(List<String> args) {
if (args.length == 1) { // training
return;
}
int x = 0;
Timer.periodic(const Duration(seconds: 1), (_) => print(x++));
} And this Makefile next to it:
The However, when I ran this same program on Windows, and then called
Running from appjit snapshot and then calling Remove-Item succeeded as expected. |
After meeting about this with the VM team, we came up with a proposed solution:
|
https://dart-review.googlesource.com/c/sdk/+/361985 should fix aot snapshot file locking behavior on Windows. |
Bug: flutter/flutter#146375 Bug: #55417 Change-Id: I7523579031091f9e75b2939c570d29338f33e176 TEST=ci, manually Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361985 Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Alexander Aprelev <aam@google.com>
@christopherfujino can the 'dependency:dart' label be removed on this issue. |
On Windows, running a dart process with an aot snapshot vendored as part of the Dart SDK will cause flutter upgrade to crash. Context for this issue was originally in #146164 (comment), my summary of which I have copy pasted here:
dart.exe foo.appjit.snapshot
anddartaotruntime.exe foo.aot.snapshot
are different in that the latter will keep the snapshot file open for the duration of VM execution while the former will (presumably) close it after having read the data. I verified this with running a minimal dart program that runs indefinitely from both appjit and aot snapshots, and from another powershell session tried callingRename-Item
on the snapshot file--the rename succeeded on the appjit snapshot but failed on aot snapshot withRename-Item : The process cannot access the file because it is being used by another process.
.frontend_server_client
is changing the package:test runner to use an aot snapshot of the frontend_server rather than an appjit snapshot: Make FrontendServerClient start the frontend server from AOT snapshot by default dart-lang/webdev#2263.Rename-Item
on the existing (or old) Dart SDK to move it to a path withdart-sdk.old
in the name. I believe we do this because just deleting the old one while the tool is running would fail.flutter upgrade
, if there is any running dart process that is using an aot snapshot from the Dart SDK within the Flutter SDK's cache,flutter upgrade
would likely fail at the step where it tries to download the new version of the Dart SDK. Re-running the flutter CLI tool would likely repeatedly fail as long as said Dart process is running.At HEAD, the contents of //flutter/bin/cache/dart-sdk/bin/snapshots is:
analysis_server.dart.snapshot
dart2js.dart.snapshot
dart2wasm_product.snapshot
dartdevc.dart.snapshot
dartdev.dart.snapshot
dart_tooling_daemon.dart.snapshot
dds.dart.snapshot
frontend_server_aot.dart.snapshot
frontend_server.dart.snapshot
gen_kernel_aot.dart.snapshot
kernel-service.dart.snapshot
kernel_worker.dart.snapshot
It is my understanding that all of the appjit snapshots above will imminently be migrated to aot snapshots, thus increasing the likelihood that one of them is actively running when a user executes
flutter upgrade
.FYI @a-siva @zanderso @derekxu16 @jacob314 @anderdobo
The text was updated successfully, but these errors were encountered: