dart-lang / build

A build system for Dart written in Dart
https://pub.dev/packages/build
BSD 3-Clause "New" or "Revised" License
784 stars 206 forks source link

VM error: "Not in inclusive range 6457..286720: 1578263" #3735

Open kevmoo opened 1 month ago

kevmoo commented 1 month ago

Happening all over

3.6.0-149.0.dev

RangeError (end): Invalid value: Not in inclusive range 6457..286720: 1578263
  dart:typed_data                                                          new Uint8List.sublistView
  package:analyzer/src/summary2/data_reader.dart 202:28                    SummaryDataReader.readUint8List
  package:analyzer/src/summary2/package_bundle_format.dart 85:31           new PackageBundleReader
  package:analyzer/src/clients/build_resolvers/build_resolvers.dart 45:[19](https://github.com/kevmoo/source_gen_test/actions/runs/10436304756/job/28901213357#step:5:20)  createAnalysisDriver
  package:build_resolvers/src/analysis_driver.dart 26:10                   analysisDriver
  package:build_resolvers/src/resolver.dart 460:26                         AnalyzerResolvers._ensureInitialized.<fn>
  ===== asynchronous gap ===========================
  package:async/src/result/value.dart 24:3                                 ValueResult.ValueResult
  ===== asynchronous gap ===========================
  package:async/src/result/result.dart 131:[22](https://github.com/kevmoo/source_gen_test/actions/runs/10436304756/job/28901213357#step:5:23)                              Result.release.<fn>
  ===== asynchronous gap ===========================
  package:build_resolvers/src/resolver.dart 470:5                          AnalyzerResolvers.get
  ===== asynchronous gap ===========================
  package:build/src/builder/build_step_impl.dart [23](https://github.com/kevmoo/source_gen_test/actions/runs/10436304756/job/28901213357#step:5:24)7:8                     _DelayedResolver.libraryFor
  ===== asynchronous gap ===========================
  package:build_test/src/resolve_source.dart 238:23                        _ResolveSourceBuilder.build
  ===== asynchronous gap ===========================
  package:build/src/generate/run_builder.dart 83:7                         runBuilder.buildForInput
  ===== asynchronous gap ===========================
  package:build/src/builder/logging.dart 32:40                             scopeLogAsync.<fn>
kevmoo commented 1 month ago

See https://github.com/kevmoo/source_gen_test/actions/runs/10436304756/job/28901213357

dart-github-bot commented 1 month ago

Summary: The user is encountering a RangeError in the Uint8List.sublistView method, indicating an attempt to access an element outside the valid range of the list. This error occurs in the package:analyzer library, specifically in the SummaryDataReader.readUint8List function.

mraleph commented 1 month ago

It is a bug in https://github.com/dart-lang/build/blob/ec64e8424004c402eb48e584c12bfef4f5cab4a6/build_resolvers/lib/src/sdk_summary.dart#L37.

Note that the way this function is written is not guarding against multiple instances of this function running in parallel and all creating the same summary output. So it might end up reading from file which is being overwritten and as a result it will get partial summary.

kevmoo commented 1 month ago

CC @jakemac53 @natebosch re ☝️