Skip to content
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

[frontend_server] frontend_server.dart.snapshot missing from 3.5.0-180.2 beta SDK #55911

Closed
cpswan opened this issue Jun 3, 2024 · 17 comments
Closed
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. cfe-frontend-server Frontend server issues for the CFE front-end-server Issues with the frontend server

Comments

@cpswan
Copy link
Contributor

cpswan commented Jun 3, 2024

  • Dart version and tooling diagnostic info (dart info)
#### General info

- Dart 3.5.0-180.2.beta (beta) (Wed May 29 13:59:09 2024 +0000) on "linux_x64"
- on linux / Linux 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024
- locale is C.UTF-8
  • Whether you are using Windows, macOS, or Linux: Linux
  • Whether you are using Chrome, Safari, Firefox, Edge: NA

First saw this in a CI test run on GitHub Actions, where we do a matrix test against stable and beta

dart test --concurrency=1 --coverage="coverage"
  shell: /usr/bin/bash -e {0}
  env:
    DART_HOME: /opt/hostedtoolcache/dart/[3](https://github.com/atsign-foundation/at_client_sdk/actions/runs/9342154575/job/25717170435?pr=1326#step:7:3).5.0-180.2.beta/x64
    PUB_CACHE: /home/runner/.pub-cache

Could not find a command named "/opt/hostedtoolcache/dart/3.5.0-180.2.beta/x6[4](https://github.com/atsign-foundation/at_client_sdk/actions/runs/9342154575/job/25717170435?pr=1326#step:7:4)/bin/snapshots/frontend_server.dart.snapshot".

All the tests then fail:

Failed to load "test/sync_service_test.dart": 
  package:test_core/src/runner/vm/platform.dart 255:7   VMPlatform._compileToKernel
  ===== asynchronous gap ===========================
  package:test_core/src/runner/vm/platform.dart 232:15  VMPlatform._spawnIsolate
  ===== asynchronous gap ===========================
  package:test_core/src/runner/vm/platform.dart 76:19   VMPlatform.load
  ===== asynchronous gap ===========================
  package:test_core/src/runner/loader.dart 232:27       Loader.loadFile.<fn>
  ===== asynchronous gap ===========================
  package:test_core/src/runner/load_suite.dart 98:19    new LoadSuite.<fn>.<fn>
  SocketException: Write failed (OS Error: Broken pipe, errno = 32), port = 0
  dart:io-patch/socket_patch.dart 1246:34                                _NativeSocket.write
  dart:io-patch/socket_patch.dart 2004:15                                _RawSocket.write
  dart:io-patch/socket_patch.dart 2481:18                                _Socket._write
  dart:io-patch/socket_patch.dart 2216:28                                _SocketStreamConsumer.write
  dart:io-patch/socket_patch.dart 2168:11                                _SocketStreamConsumer.addStream.<fn>
  dart:async/zone.dart 1[40](https://github.com/atsign-foundation/at_client_sdk/actions/runs/9342154575/job/25717170435?pr=1326#step:7:41)7:47                                           _rootRunUnary
  dart:async/zone.dart 1308:19                                           _CustomZone.runUnary
  dart:async/zone.dart 1217:7                                            _CustomZone.runUnaryGuarded
  dart:async/stream_impl.dart 365:11                                     _BufferingStreamSubscription._sendData
  dart:async/stream_impl.dart 297:7                                      _BufferingStreamSubscription._add
  dart:async/stream_controller.dart 784:19                               _SyncStreamControllerDispatch._sendData
  dart:async/stream_controller.dart 658:7                                _StreamController._add
  dart:async/stream_controller.dart 606:5                                _StreamController.add
  dart:io/io_sink.dart 154:17                                            _StreamSinkImpl.add
  dart:io/io_sink.dart 287:5                                             _IOSinkImpl.write
  dart:io-patch/socket_patch.dart 2314:36                                _Socket.write
  dart:io/stdio.dart 401:13                                              _StdSink._write
  dart:io/stdio.dart [41](https://github.com/atsign-foundation/at_client_sdk/actions/runs/9342154575/job/25717170435?pr=1326#step:7:42)9:5                                               _StdSink.writeln
  package:frontend_server_client/src/frontend_server_client.dart 328:21  FrontendServerClient._sendCommand
  package:frontend_server_client/src/frontend_server_client.dart 2[45](https://github.com/atsign-foundation/at_client_sdk/actions/runs/9342154575/job/25717170435?pr=1326#step:7:46):5   FrontendServerClient.accept
  package:test_core/src/runner/vm/test_compiler.dart 128:30              _TestCompilerForLanguageVersion._compile
  ===== asynchronous gap ===========================
  package:pool/pool.dart 127:14                                          Pool.withResource
  ===== asynchronous gap ===========================
  package:test_core/src/runner/vm/platform.dart 252:22                   VMPlatform._compileToKernel
  ===== asynchronous gap ===========================
  package:test_core/src/runner/vm/platform.dart 232:15                   VMPlatform._spawnIsolate
  ===== asynchronous gap ===========================
  package:test_core/src/runner/vm/platform.dart 76:19                    VMPlatform.load
  ===== asynchronous gap ===========================
  package:test_core/src/runner/loader.dart 232:27                        Loader.loadFile.<fn>
  ===== asynchronous gap ===========================
  package:test_core/src/runner/load_suite.dart 98:19                     new LoadSuite.<fn>.<fn>

Weirdly the functional tests in the same repo appear to run fine against beta.

I've been able to replicated locally against the same repo using the 3.5.0-180.2 beta SDK on x64 Linux.

Looking in $DART_HOME/bin/snapshots I see:

$ ls -la
total 371388
drwxr-xr-x 2 chris chris     4096 Jun  3 11:18 .
drwxr-xr-x 5 chris chris     4096 Jun  3 11:18 ..
-rw-r--r-- 1 chris chris 65047296 May 29 07:20 analysis_server.dart.snapshot
-rw-r--r-- 1 chris chris 81028768 May 29 07:20 dart2js.dart.snapshot
-rw-r--r-- 1 chris chris 14717648 May 29 07:19 dart2wasm_product.snapshot
-rw-r--r-- 1 chris chris  8001968 May 29 07:19 dart_tooling_daemon.dart.snapshot
-rw-r--r-- 1 chris chris 51104080 May 29 07:19 dartdev.dart.snapshot
-rw-r--r-- 1 chris chris 52431680 May 29 07:19 dartdevc.dart.snapshot
-rw-r--r-- 1 chris chris  9218560 May 29 07:19 dds.dart.snapshot
-rw-r--r-- 1 chris chris 15615248 May 29 07:19 frontend_server_aot.dart.snapshot
-rw-r--r-- 1 chris chris 13526664 May 29 07:19 gen_kernel_aot.dart.snapshot
-rw-r--r-- 1 chris chris 47246016 May 29 07:19 kernel-service.dart.snapshot
-rw-r--r-- 1 chris chris 22334928 May 29 07:19 kernel_worker.dart.snapshot

So frontend_server.dart.snapshot isn't there (when it was present in 3.4.2).

@parlough
Copy link
Member

parlough commented Jun 3, 2024

It looks to be because package: frontend_server_client is resolving to version 3.2.0 rather than 4.0.0 which added support for using the AOT snapshot, but I'm not sure what's holding it back. Or perhaps package: frontend_server_client needs a v3 patch release with the switching to prevent this popping up for packages that are constrained to v3.

\cc @a-siva @derekxu16

@derekxu16
Copy link
Member

It looks to be because package: frontend_server_client is resolving to version 3.2.0 rather than 4.0.0 which added support for using the AOT snapshot, but I'm not sure what's holding it back.

Yes, that assessment is correct. One thing I see is that package:test_core was resolved to version 0.5.3, but support for package:frontend_server_client 4.0.0 was only added in package:test_core 0.6.0. I don't know what's holding that back though.

I'm also not sure why package:frontend_server_client was resolved at all. pacakge:frontend_server_client 3.2.0 was published with an SDK constraint of >=2.12.0 <3.0.0.

Or perhaps package: frontend_server_client needs a v3 patch release with the switching to prevent this popping up for packages that are constrained to v3.

This is technically not possible if we follow SemVer, because there is no way to make the behaviour of the debug argument of FrontendServerClient.start be backwards-compatible with its behaviour in version 3.2.0 when the AOT snapshot is selected.

@lrhn lrhn added area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-server Issues with the frontend server labels Jun 4, 2024
@johnniwinther johnniwinther added the cfe-frontend-server Frontend server issues for the CFE label Jun 6, 2024
@cpswan
Copy link
Contributor Author

cpswan commented Jun 6, 2024

This seems to also impact 3.5.0-180.3

@a-siva
Copy link
Contributor

a-siva commented Jun 7, 2024

@cpswan can you clarify which versions of package:test_core and package:frontend_server_client your app ends up using, from #55911 (comment) above it seems like package:frontend_server_client 4.0.0 should be used but it is not using that version.

@cpswan
Copy link
Contributor Author

cpswan commented Jun 7, 2024

@a-siva looking at the pubspec.lock I see:

  test_core:
    dependency: transitive
    description:
      name: test_core
      sha256: "99806e9e6d95c7b059b7a0fc08f07fc53fabe54a829497f0d9676299f1e8637e"
      url: "https://pub.dev"
    source: hosted
    version: "0.5.3"

and

  frontend_server_client:
    dependency: transitive
    description:
      name: frontend_server_client
      sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612"
      url: "https://pub.dev"
    source: hosted
    version: "3.2.0"

Here's the pubspec.yaml

and here's the full pubspec.lock

@derekxu16
Copy link
Member

I just took a closer look at the at_client package. Your package:dart_code_metrics constraint is preventing you from being able to get package:frontend_server_client 4.0.0. It looks like changing it to at least dart_code_metrics: ^5.0.0 should fix your problem.

@cpswan
Copy link
Contributor Author

cpswan commented Jun 7, 2024

Thanks @derekxu16

Whilst putting together my response to @a-siva I figured we would need to update a bunch of packages to get things working, and you'll see the linked ticket above.

Before I close this I'm just wondering if there's a doc somewhere that explains what the various snapshots do, and how they fit into the build/test process? I'm pretty comfortable with JIT and AOT snapshots, but the snapshots that come bundled with the SDK are something of a mystery to me.

@derekxu16
Copy link
Member

The snapshots bundled with the SDK are each required to make some part of Dart tooling work. They are all built from sources in the dart-lang/sdk repo, so it's possible to find documentation on what each of them do by searching for the snapshot's name in the repo. For example, analysis_server.dart.snapshot is built from pkg/analysis_server, and there are docs in that directory that explain what it does. The documentation in pkg/frontend_server is less detailed because it's targeted at SDK maintainers, but the purpose of the frontend_server snapshot is that tools like package:test and the flutter tool use it to compile files.

@cpswan
Copy link
Contributor Author

cpswan commented Jun 7, 2024

Thanks @derekxu16

I would be great if one of the SDK maintainers could do a talk on this stuff sometime ;)

I can grok a handwavy explanation that frontend_server.dart.snapshot doesn't need to be there any more (so long as you're using recent enough packages that don't pull in an old package:frontend_server_client) but it would be better to properly understand how deprecations and breaking changes propagate through the toolchain. Then again... this is why we matrix test against beta, so we don't get punched in the face (again) when stuff finds its way to stable.

@SebastianEngel
Copy link

I just switched to Flutter 3.24.0 which comes with Dart 3.5.0. When running dart run build_runner build --delete-conflicting-outputs I still get the error:

Precompiling build script......Could not find a command named "/Users/sebastian/.fvm_home/versions/3.24.0/bin/cache/dart-sdk/bin/snapshots/frontend_server.dart.snapshot".

In the folder there is a frontend_server_aot.dart.snapshot. Seems like the new aot part included in the filename now leads to the problem.

Could this issue be reopened?

@mraleph
Copy link
Member

mraleph commented Aug 9, 2024

@SebastianEngel you need to upgrade dependencies, see google/json_serializable.dart#1427 (comment)

@SebastianEngel
Copy link

Initially I updated all potentially related dependencies, like build_runner, etc. but probably it was some transitive dependency then. Running upgrade worked. Thank you

@affansk
Copy link

affansk commented Aug 28, 2024

@SebastianEngel do you find any solution for this ?

@mraleph
Copy link
Member

mraleph commented Aug 28, 2024

@affansk you need to upgrade the dependencies via dart pub upgrade / flutter pub upgrade.

@affansk
Copy link

affansk commented Aug 28, 2024

@mraleph i tried everything still i get Run "dart help " for more information about a command.
See https://dart.dev/tools/dart-tool for detailed documentation.
Could not find a command named "/Users/affanshaikh/Desktop/project/flutterdev/sdk/flutter/bin/cache/dart-sdk/bin/snapshots/frontend_server.dart.snapshot".

do i need to install frontend_server package ?

@mraleph
Copy link
Member

mraleph commented Aug 28, 2024

It's a transitive dependency of the build_runner. That means you have some dependency that is somehow blocking upgrade to the correct version of the package or you are (somehow) using build_runner at an older version.

@jger
Copy link

jger commented Oct 20, 2024

In my case deleting the pubspec.lock helped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. cfe-frontend-server Frontend server issues for the CFE front-end-server Issues with the frontend server
Projects
None yet
Development

No branches or pull requests

10 participants