Skip to content

Indicated size is invalid. when running parallel instances of dart pub run #48171

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
gaaclarke opened this issue Jan 19, 2022 · 3 comments
Closed
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@gaaclarke
Copy link
Contributor

This tracker is for issues related to:

  • Dart VM

description

I have a CI task that is using Dart to do code generation. After I parallelized execution of the instances of "pub run" I noticed a flake where sometimes the execution would fail to load the kernel binary. In this instances pub run is not caching the build because I'm using it to execute local code, so there appears to be a race condition in reading artifacts from the disk.

error

Can't load Kernel binary: Invalid kernel binary: Indicated size is invalid.

example

https://cirrus-ci.com/task/6651964250390528?logs=local_tests#L408

steps to reproduce

Here is the roughly the code I introduced and it is executing 6 instances at once:

Future<int> _runPigeon(...) async {
  final Process generate =
    await Process.start('dart', <String>['pub', 'run', 'pigeon', '--input', input]);
  return await generate.exitCode;
}

Future<int> _generateDart(Map<String, String> jobs) async {
  final List<Future<int>> results = <Future<int>>[];
  for (final MapEntry<String, String> job in jobs.entries) {
    results.add(
        _runPigeon(input: job.key, dartOut: job.value, streamOutput: false));
  }
  final List<int> resultsList = await Future.wait(results);
  return resultsList.firstWhere((int x) => x != 0, orElse: () => 0);
}

version

Dart version 2.17.0 (build 2.17.0-27.0.dev)

@gaaclarke
Copy link
Contributor Author

This could also be a bug in that version of Dart and I just happened to see it after I parallelized the tasks. I can't prove it's related.

@lrhn lrhn added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Jan 19, 2022
@alexmarkov
Copy link
Contributor

Looks like a pub issue, probably a duplicate of dart-lang/pub#3165.
/cc @sigurdm

@sigurdm
Copy link
Contributor

sigurdm commented Jan 20, 2022

Yeah - hopefully this should be fixed by: dart-lang/pub#3285 that has just landed

(Please reopen if this is not true).

A workaround would be to do a single. non-parallel run first to ensure the compilation is stable, and then run the rest in parallel...

@sigurdm sigurdm closed this as completed Jan 20, 2022
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.
Projects
None yet
Development

No branches or pull requests

4 participants