build icon indicating copy to clipboard operation
build copied to clipboard

Flutter for Web - Error compiling dartdevc module:stock_notes|web/main.ddc.js

Open vsmenon opened this issue 5 years ago • 8 comments

@L-Sypniewski commented on Sat Jul 13 2019

Hi, I've encountered an error while trying to run the page via webdev serve --auto restart command, however, when I deploy the website to Firebase Hosting or simulate the hosting locally by executing Firebase serve --only hosting everything works fine.

The code that produces an error worked at first, then I made some changes that made the web app stop working. Thinking it was some error in my code I reverted the code to the last known working version, but it didn't work anymore.

I'm attaching an error message below:

We're sorry, you've found a bug in our compiler. You can report this bug at: https://github.com/dart-lang/sdk/issues/labels/area-dev-compiler Please include the information below in your report, along with any other information that may help us track it down. Thanks!

-------------------- %< --------------------
    dartdevc -k arguments: --dart-sdk-summary=/Users/[UserName]/flutterSDK/bin/cache/dart-sdk/lib/_internal/ddc_sdk.dill --modules=amd --no-summarize -o web/main.ddc.js --source-map --summary=packages/meta/meta.ddc.dill=packages/meta/meta --summary=packages/typed_data/typed_buffers.ddc.dill=packages/typed_data/typed_buffers --summary=packages/flutter_web_ui/ui.ddc.dill=packages/flutter_web_ui/ui --summary=packages/flutter_web/io.ddc.dill=packages/flutter_web/io --summary=packages/flutter_web/src/foundation/assertions.ddc.dill=packages/flutter_web/src/foundation/assertions --summary=packages/flutter_web/foundation.ddc.dill=packages/flutter_web/foundation --summary=packages/flutter_web/src/services/clipboard.ddc.dill=packages/flutter_web/src/services/clipboard --summary=packages/flutter_web/services.ddc.dill=packages/flutter_web/services --summary=packages/collection/src/utils.ddc.dill=packages/collection/src/utils --summary=packages/collection/src/algorithms.ddc.dill=packages/collection/src/algorithms --summary=packages/collection/src/iterable_zip.ddc.dill=packages/collection/src/iterable_zip --summary=packages/collection/src/comparators.ddc.dill=packages/collection/src/comparators --summary=packages/collection/src/priority_queue.ddc.dill=packages/collection/src/priority_queue --summary=packages/collection/src/canonicalized_map.ddc.dill=packages/collection/src/canonicalized_map --summary=packages/collection/collection.ddc.dill=packages/collection/collection --summary=packages/flutter_web/src/scheduler/binding.ddc.dill=packages/flutter_web/src/scheduler/binding --summary=packages/flutter_web/scheduler.ddc.dill=packages/flutter_web/scheduler --summary=packages/flutter_web/src/physics/clamped_simulation.ddc.dill=packages/flutter_web/src/physics/clamped_simulation --summary=packages/flutter_web/physics.ddc.dill=packages/flutter_web/physics --summary=packages/flutter_web/src/gestures/arena.ddc.dill=packages/flutter_web/src/gestures/arena --summary=packages/flutter_web/gestures.ddc.dill=packages/flutter_web/gestures --summary=packages/flutter_web/src/animation/animation.ddc.dill=packages/flutter_web/src/animation/animation --summary=packages/vector_math/hash.ddc.dill=packages/vector_math/hash --summary=packages/vector_math/vector_math_64.ddc.dill=packages/vector_math/vector_math_64 --summary=packages/flutter_web/animation.ddc.dill=packages/flutter_web/animation --summary=packages/flutter_web/src/cupertino/action_sheet.ddc.dill=packages/flutter_web/src/cupertino/action_sheet --summary=packages/flutter_web/cupertino.ddc.dill=packages/flutter_web/cupertino --summary=packages/flutter_web/material.ddc.dill=packages/flutter_web/material --summary=packages/stock_notes/widgets/RoundedButton.ddc.dill=packages/stock_notes/widgets/RoundedButton --summary=packages/stock_notes/widgets/FocusableTextFormField.ddc.dill=packages/stock_notes/widgets/FocusableTextFormField --summary=packages/stock_notes/screens/login_screen.ddc.dill=packages/stock_notes/screens/login_screen --summary=packages/stock_notes/main.ddc.dill=packages/stock_notes/main --packages=file:///var/folders/b5/yl2rz1xj04g823dtks7lrwbjcqtcb3/T/kernel_builder_yDFcvl/.packages --module-name=web/main --multi-root-scheme=org-dartlang-app --multi-root=. --track-widget-creation --inline-source-map web/main.dart
    dart --version: 2.4.0 (Wed Jun 19 11:53:45 2019 +0200) on "macos_x64"

RangeError (index): Index out of range: no indices are valid: 0
#0      Uint8List.[] (dart:typed_data-patch/typed_data_patch.dart:2188:7)
#1      BinaryBuilder.readByte (package:kernel/binary/ast_from_binary.dart:104:27)
#2      BinaryBuilder.readUint32 (package:kernel/binary/ast_from_binary.dart:124:13)
#3      BinaryBuilder.readComponent (package:kernel/binary/ast_from_binary.dart:444:17)
#4      ProcessedOptions.loadComponent (package:front_end/src/base/processed_options.dart:391:10)
#5      initializeIncrementalCompiler (package:front_end/src/api_unstable/ddc.dart:233:14)
<asynchronous suspension>
#6      _compile (package:dev_compiler/src/kernel/command.dart:246:27)
<asynchronous suspension>
#7      compile (package:dev_compiler/src/kernel/command.dart:42:18)
<asynchronous suspension>
#8      compile (package:dev_compiler/src/compiler/shared_command.dart:401:12)
#9      _CompilerWorker.performRequest.<anonymous closure> (file:///b/s/w/ir/k/src/third_party/dart/pkg/dev_compiler/bin/dartdevc.dart:55:39)
#10     _rootRun (dart:async/zone.dart:1124:13)
#11     _CustomZone.run (dart:async/zone.dart:1021:19)
#12     _runZoned (dart:async/zone.dart:1516:10)
#13     runZoned (dart:async/zone.dart:1463:12)
#14     _CompilerWorker.performRequest (file:///b/s/w/ir/k/src/third_party/dart/pkg/dev_compiler/bin/dartdevc.dart:55:24)
<asynchronous suspension>
#15     AsyncWorkerLoop.run.<anonymous closure> (package:bazel_worker/src/worker/async_worker_loop.dart:33:41)
#16     _rootRun (dart:async/zone.dart:1124:13)
#17     _CustomZone.run (dart:async/zone.dart:1021:19)
#18     _runZoned (dart:async/zone.dart:1516:10)
#19     runZoned (dart:async/zone.dart:1463:12)
#20     AsyncWorkerLoop.run (package:bazel_worker/src/worker/async_worker_loop.dart:33:26)
<asynchronous suspension>
#21     main (file:///b/s/w/ir/k/src/third_party/dart/pkg/dev_compiler/bin/dartdevc.dart:28:57)
<asynchronous suspension>
#22     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:32)
#23     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)

vsmenon avatar Jul 14 '19 22:07 vsmenon

cc @jensjoha any ideas on this one?

jakemac53 avatar Jul 15 '19 13:07 jakemac53

RangeError (index): Index out of range: no indices are valid: 0
#0 Uint8List.[] (dart:typed_data-patch/typed_data_patch.dart:2188:7)
#1 BinaryBuilder.readByte (package:kernel/binary/ast_from_binary.dart:104:27)
#2 BinaryBuilder.readUint32 (package:kernel/binary/ast_from_binary.dart:124:13)
#3 BinaryBuilder.readComponent (package:kernel/binary/ast_from_binary.dart:444:17)

It seems like we're trying to load an empty (i.e. 0-byte) file.

jensjoha avatar Jul 30 '19 06:07 jensjoha

Is there any better error message we can give here? On the build side, should we suggest folks clean and restart?

vsmenon avatar Jul 30 '19 14:07 vsmenon

I also wonder if we can detect this earlier - when we first see the empty output rather than when we try to give it as input.

Can we assume that a kernel output should never be empty?

natebosch avatar Jul 30 '19 20:07 natebosch

I also wonder if we can detect this earlier - when we first see the empty output rather than when we try to give it as input.

Can we assume that a kernel output should never be empty?

A kernel file should never be empty. The only things I can (currently) come up with, which would cause this sort of thing would be

  • Full disk (so a file could be created, but nothing could be written to it, and that whatever error was thrown somehow didn't properagte properly)
  • Race-condition (e.g. launching several instances, but I assume the build system has some locking?)
  • The file was truncated externally
  • Faulty device (ram, hd, whatever)

Maybe we should add some checks in the ddc and bazel pipelines to check up front both if the input is non-empty and the output is non-empty..?

jensjoha avatar Jul 31 '19 06:07 jensjoha

I published a new version of build_modules that will give an early error if we get empty output from the kernel worker. This won't help detect cases where the worker gives us content and we lose it due to some bug elsewhere in the system...

natebosch avatar Jul 31 '19 22:07 natebosch

We haven't hit this, I think, for quite a while now. Probably because flutter web is no longer using build_web_compilers?

@jakemac53 do you recall seeing any more recent reports of this issue from non-flutter users?

natebosch avatar Aug 03 '20 22:08 natebosch

I have not seen any recent reports

jakemac53 avatar Aug 04 '20 15:08 jakemac53