dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.23k stars 1.58k forks source link

Fails to map snapshot on Ampere Altra with 64k page size #56823

Closed RossComputerGuy closed 1 month ago

RossComputerGuy commented 1 month ago

When building Flutter on my Ampere Altra running NixOS and using a 64k page size, I get this scary abort:

../../runtime/bin/snapshot_utils.cc: 154: error: Failed to memory map snapshot: /nix/store/gjvyzckkyq2s57ajcnxy3682bj06r9gx-flutter-3.22.0-unwrapped/bin/cache/flutter_tools.snapshot

===== CRASH =====
si_signo=Segmentation fault(11), si_code=SEGV_MAPERR(1), si_addr=0x10
Aborting reentrant request for stack trace.
/nix/store/yja2i691gbdxl6v1hd7ccnym3zqgl11i-stdenv-linux/setup: line 1582:   282 Aborted                 (core dumped) $out/bin/flutter config --android-studio-dir $HOME

When I build Flutter applications, I get no errors and no messages to the terminal at all. This seems like Dart isn't set up to handle a 64k page size which my system uses for better compiling performance. Meanwhile, Flutter and Dart compile easily on my MBP running NixOS which is using a 16k page size. In this case, I was building/using Flutter 3.22.0 but it seems every version of Flutter in Nixpkgs has this problem. It's best we get this issue fixed as more hardware which utilizes ARM may be running large page sizes (beyond 4k or even 16k).

To reproduce, use CONFIG_ARM64_64K_PAGES in the kernel config and try building Flutter or try building any Flutter applications.

dart-github-bot commented 1 month ago

Summary: The user is experiencing a crash when building Flutter on an Ampere Altra system with a 64k page size. The issue appears to be related to Dart's inability to handle large page sizes, resulting in a failure to map the snapshot file.

a-siva commented 1 month ago

//cc @rmacnak-google

rmacnak-google commented 1 month ago

This was fixed in https://dart-review.googlesource.com/c/sdk/+/368525.

Please try Flutter 3.24 or later.