Skip to content

Invalid vm isolate snapshot seen when running webdev e2e_test.dart on Windows #59784

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

Closed
bkonyi opened this issue Dec 20, 2024 · 11 comments · Fixed by dart-lang/webdev#2557
Closed
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. P2 A bug or feature request we're likely to work on triaged Issue has been triaged by sub team

Comments

@bkonyi
Copy link
Contributor

bkonyi commented Dec 20, 2024

After 08252fc we've started seeing the Invalid vm isolate snapshot seen for webdev's e2e_test.dart on Windows. Based on a quick look, the VM isolate apparently is missing its magic number.

@bkonyi bkonyi added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. P2 A bug or feature request we're likely to work on triaged Issue has been triaged by sub team labels Dec 20, 2024
copybara-service bot pushed a commit that referenced this issue Dec 20, 2024
This reverts commit c5c3544.

Reason for revert: #59784

Original change's description:
> Fix Fuchsia build error.
>
> TEST=ci
>
> Change-Id: I31c160770bea6ba03fe3ca76545c37ffec94e44e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401483
> Commit-Queue: Siva Annamalai <[email protected]>
> Reviewed-by: Brian Quinlan <[email protected]>

Change-Id: I302d407a5063a1989d05605e01da71913a8742e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401902
Reviewed-by: Sigmund Cherem <[email protected]>
Bot-Commit: Rubber Stamper <[email protected]>
Commit-Queue: Ben Konyi <[email protected]>
copybara-service bot pushed a commit that referenced this issue Dec 20, 2024
This reverts commit 08252fc.

Reason for revert: #59784

Original change's description:
> [dartdev] Use VmInteropHandler for invoking sub commands
>
> Use VmInteropHandler for invoking sub commands instead of running them
> in an isolate. Running sub commands in an isolate causes an increased footprint.
> Changing this to use VmInteropHandler avoids the additional memory footprint.
>
> Commands that need to use an AOT runtime for execution now exec the AOT
> runtime and run the command.
>
> TEST=ci
>
> Change-Id: If7aed1cab2fec9d9940bd562ad5aa9c4e9a6ac7f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398604
> Reviewed-by: Ben Konyi <[email protected]>
> Reviewed-by: Brian Quinlan <[email protected]>
> Commit-Queue: Siva Annamalai <[email protected]>

Change-Id: I82a997d49a7d52e1fdaa7d75f509603ebe5e51dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401901
Reviewed-by: Siva Annamalai <[email protected]>
Reviewed-by: Sigmund Cherem <[email protected]>
Bot-Commit: Rubber Stamper <[email protected]>
@a-siva
Copy link
Contributor

a-siva commented Jan 6, 2025

A change was added to provide a proper message here https://dart-review.googlesource.com/c/sdk/+/402202

It is highly likely we have a path in this test which is loading an AOT snapshot of dart2js into a VM that is running in JIT mode

bkonyi added a commit to dart-lang/webdev that referenced this issue Jan 7, 2025
webdev/test/e2e_test.dart was failing due to paths with spaces not being
handled correctly.

Related issue: #2556
Fixes dart-lang/sdk#59784
@DanTup
Copy link
Collaborator

DanTup commented Jan 8, 2025

I'm not sure if this is the same issue or I should raise in flutter/flutter, but I see this same error when trying to use flutter build web. Both my Flutter SDK and test project paths have spaces in the name (which a related issue above mentions)..:

PS D:\Dev\Test Projects\flutter_142040> flutter build web -o docs

Target dart2js failed: ProcessException: Process exited abnormally with exit code 255:
VM initialization failed: Invalid vm isolate snapshot seen
  Command: D:\Dev\Google\Flutter\Flutter main\bin\cache\dart-sdk\bin\dart.exe compile js --platform-binaries=D:\Dev\Google\Flutter\Flutter main\bin\cache\flutter_web_sdk\kernel --invoker=flutter_tool -Ddart.vm.product=true
  -DFLUTTER_WEB_USE_SKIA=true -DFLUTTER_WEB_USE_SKWASM=false -DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/b5df29072de2778dc843a3a8ad3ffa8b2bdc885c/ --native-null-assertions --no-source-maps -o D:\Dev\Test
  Projects\flutter_142040\.dart_tool\flutter_build\064065dfa804901241659731b08efe62\app.dill --packages=D:\Dev\Test Projects\flutter_142040\.dart_tool\package_config.json --cfe-only D:\Dev\Test
  Projects\flutter_142040\.dart_tool\flutter_build\064065dfa804901241659731b08efe62\main.dart
#0      RunResult.throwException (package:flutter_tools/src/base/process.dart:118:5)
#1      _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart:344:19)
<asynchronous suspension>
#2      Dart2JSTarget.build (package:flutter_tools/src/build_system/targets/web.dart:201:5)
<asynchronous suspension>
#3      _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:876:9)
<asynchronous suspension>
#4      Future.wait.<anonymous closure> (dart:async/future.dart:528:21)
<asynchronous suspension>
#5      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:814:32)
<asynchronous suspension>
#6      Future.wait.<anonymous closure> (dart:async/future.dart:528:21)
<asynchronous suspension>
#7      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:814:32)
<asynchronous suspension>
#8      FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:637:16)
<asynchronous suspension>
#9      WebBuilder.buildWeb (package:flutter_tools/src/web/compile.dart:93:34)
<asynchronous suspension>
#10     BuildWebCommand.runCommand (package:flutter_tools/src/commands/build_web.dart:253:5)

Removing the space from the Flutter SDK changes the error to this:

PS D:\Dev\Test Projects\flutter_142040> flutter build web -o docs

Target dart2js failed: ProcessException: Process exited abnormally with exit code 1:
Compile Dart to JavaScript.

Usage: dart compile js [arguments] <dart entry point>
  -h, --help      Print this usage information.
  -h -v           Show detailed information about all options.
  -o, --output    Write the output to <file name>.
  -O<0,1,2,3,4>   Set the compiler optimization level (defaults to -O1).
     -O0          No optimizations (only meant for debugging the compiler).
     -O1          Default (includes whole program analyses and inlining).
     -O2          Safe production-oriented optimizations (like minification).
     -O3          Potentially unsafe optimizations (see -h -v for details).
     -O4          More agressive unsafe optimizations (see -h -v for details).

Error: Extra arguments: Projects/flutter_142040/.dart_tool/package_config.json /D:/Dev/Test Projects/flutter_142040/.dart_tool/flutter_build/064065dfa804901241659731b08efe62/main.dart
  Command: D:\Dev\Google\Flutter\Flutter-main\bin\cache\dart-sdk\bin\dart.exe compile js --platform-binaries=D:\Dev\Google\Flutter\Flutter-main\bin\cache\flutter_web_sdk\kernel --invoker=flutter_tool -Ddart.vm.product=true
  -DFLUTTER_WEB_USE_SKIA=true -DFLUTTER_WEB_USE_SKWASM=false -DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/b5df29072de2778dc843a3a8ad3ffa8b2bdc885c/ --native-null-assertions --no-source-maps -o D:\Dev\Test
  Projects\flutter_142040\.dart_tool\flutter_build\064065dfa804901241659731b08efe62\app.dill --packages=D:\Dev\Test Projects\flutter_142040\.dart_tool\package_config.json --cfe-only D:\Dev\Test
  Projects\flutter_142040\.dart_tool\flutter_build\064065dfa804901241659731b08efe62\main.dart
#0      RunResult.throwException (package:flutter_tools/src/base/process.dart:118:5)
#1      _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart:344:19)
<asynchronous suspension>
#2      Dart2JSTarget.build (package:flutter_tools/src/build_system/targets/web.dart:201:5)

This one is because of the space in the test project. Removing that spaces resolves the issue I can build.

I deliberately have spaces in both paths because other users sometimes do - for example if their Windows username is "Firstname Lastname" and the put things in C:\Users\FirstName LastName\Documents. IMO paths should be escaped in all places to handle this.

@a-siva
Copy link
Contributor

a-siva commented Jan 8, 2025

Do you still see the above error even after 08252fc was reverted

@DanTup
Copy link
Collaborator

DanTup commented Jan 8, 2025

@a-siva if that question was for me I was using master from yesterday:

PS D:\Dev\Google\Flutter\Flutter main> git log -1
commit b5df29072de2778dc843a3a8ad3ffa8b2bdc885c (HEAD -> master, upstream/master, upstream/main, upstream/HEAD)
Author: Jonah Williams <[email protected]>
Date:   Tue Jan 7 21:50:21 2025 -0800

@DanTup
Copy link
Collaborator

DanTup commented Jan 8, 2025

Oh, but the commit you linked was the original and not the revert. When was the revert made? (I had a search but couldn't see it)

Edit: Revert is https://dart-review.googlesource.com/c/sdk/+/401901, which was also Dec 20th, so I believe should be in Flutter master.

@a-siva
Copy link
Contributor

a-siva commented Jan 8, 2025

7783e61 and 7a5174a are the reverts

@DanTup
Copy link
Collaborator

DanTup commented Jan 8, 2025

In that case, I believe I have both of them:

PS D:\Dev> flutter --version
Flutter 3.28.0-2.0.pre.38645 • channel master • [email protected]:DanTup/flutter.git
Framework • revision b5df29072d (12 hours ago) • 2025-01-07 21:50:21 -0800
Engine • revision b5df29072d
Tools • Dart 3.7.0 (build 3.7.0-267.0.dev) • DevTools 2.41.0

(although it's not clear to me what the interaction is between spaces in the paths and those changes)

@a-siva
Copy link
Contributor

a-siva commented Jan 8, 2025

The last roll of Dart into Flutter was Version 3.7.0-267.0.dev, so I believe the reverts are not in Flutter main yet.

@DanTup
Copy link
Collaborator

DanTup commented Jan 8, 2025

Oops, you're right - I only checked the dates and assumed. I will re-test that once it's rolled in then.

bkonyi added a commit to dart-lang/webdev that referenced this issue Jan 9, 2025
webdev/test/e2e_test.dart was failing due to paths with spaces not being
handled correctly.

Related issue: #2556
Fixes dart-lang/sdk#59784
@bkonyi bkonyi reopened this Jan 9, 2025
@bkonyi
Copy link
Contributor Author

bkonyi commented Jan 9, 2025

From dart-lang/webdev#2556:

After some digging, it turns out that the webdev tests can make a copy of the SDK under the temp directory for use in tests. This directory name was prefixed with sdk copy. Logging landed by @a-siva indicated that webdev/test/e2e_test.dart was failing with the following message:

C:\src\temp\sdk is not an AOT snapshot, it cannot be run with 'dartaotruntime'

Changing the copied SDK directory name prefix to sdk_copy resolved the issue, implying that paths with spaces aren't being escaped properly when we call exec into the dartaotruntime to execute dart2js.

@a-siva
Copy link
Contributor

a-siva commented Jan 17, 2025

https://dart-review.googlesource.com/c/sdk/+/402781 accounts for the possibility of spaces in path names.

@a-siva a-siva closed this as completed Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. P2 A bug or feature request we're likely to work on triaged Issue has been triaged by sub team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants