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

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

Closed
vsmenon opened this issue Jul 14, 2019 · 8 comments
Closed
Labels
closed-stale Closed as the issue or PR is assumed stale.

Comments

@vsmenon
Copy link
Member

vsmenon commented Jul 14, 2019

@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)
@jakemac53
Copy link
Contributor

cc @jensjoha any ideas on this one?

@jensjoha
Copy link

jensjoha commented Jul 30, 2019

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.

@vsmenon
Copy link
Member Author

vsmenon commented Jul 30, 2019

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

@natebosch
Copy link
Member

natebosch commented Jul 30, 2019

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 added a commit that referenced this issue Jul 30, 2019
Towards #2362

We don't know where the zero byte files are being introduced to the
system - if they are coming from the kernel worker try to catch them
earlier by checking for when we copy a file with no content. This won't
solve the issue but if errors surface through this they should be more
clear.

- Add a `requireContent` argument to `copyOutput`. In the future we
  might consider making the default either with or without an output -
  we don't know of any use cases where we want to allow copying a zero
  byte file.
- Use the new argument from the kernel builder to check earlier whether
  a kernel file is empty.
natebosch added a commit that referenced this issue Jul 30, 2019
Towards #2362

We don't know where the zero byte files are being introduced to the
system - if they are coming from the kernel worker try to catch them
earlier by checking for when we copy a file with no content. This won't
solve the issue but if errors surface through this they should be more
clear.

- Add a `requireContent` argument to `copyOutput`. In the future we
  might consider making the default either with or without an output -
  we don't know of any use cases where we want to allow copying a zero
  byte file.
- Use the new argument from the kernel builder to check earlier whether
  a kernel file is empty.
@jensjoha
Copy link

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..?

@natebosch
Copy link
Member

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
Copy link
Member

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?

@jakemac53
Copy link
Contributor

I have not seen any recent reports

@jakemac53 jakemac53 added the closed-stale Closed as the issue or PR is assumed stale. label Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-stale Closed as the issue or PR is assumed stale.
Projects
None yet
Development

No branches or pull requests

4 participants