Skip to content

Error compiling dartdevc module: #47176

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

Open
bshlomo opened this issue Sep 9, 2021 · 8 comments
Open

Error compiling dartdevc module: #47176

bshlomo opened this issue Sep 9, 2021 · 8 comments
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.

Comments

@bshlomo
Copy link

bshlomo commented Sep 9, 2021

Error compiling dartdevc module:std_web_store|lib/view/dialogs/order_details_wnd.unsound.ddc.js

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/web-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=C:\Program Files\Dart\dart-sdk/lib/_internal/ddc_sdk.dill --modules=amd --no-summarize -o C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\std_web_store\view\dialogs\order_details_wnd.unsound.ddc.js --source-map --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\meta\meta_meta.unsound.ddc.dill=packages/meta/meta_meta --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\meta\meta.unsound.ddc.dill=packages/meta/meta --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\shopisss_server\src\elements\command.unsound.ddc.dill=packages/shopisss_server/src/elements/command --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\http\src\boundary_characters.unsound.ddc.dill=packages/http/src/boundary_characters --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\pedantic\pedantic.unsound.ddc.dill=packages/pedantic/pedantic --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\collection\src\utils.unsound.ddc.dill=packages/collection/src/utils --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\collection\src\algorithms.unsound.ddc.dill=packages/collection/src/algorithms --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\collection\src\iterable_zip.unsound.ddc.dill=packages/collection/src/iterable_zip --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\collection\src\comparators.unsound.ddc.dill=packages/collection/src/comparators --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\collection\src\priority_queue.unsound.ddc.dill=packages/collection/src/priority_queue --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\collection\src\canonicalized_map.unsound.ddc.dill=packages/collection/src/canonicalized_map --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\collection\collection.unsound.ddc.dill=packages/collection/collection --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\typed_data\src\typed_buffer.unsound.ddc.dill=packages/typed_data/src/typed_buffer --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\typed_data\typed_buffers.unsound.ddc.dill=packages/typed_data/typed_buffers --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\typed_data\src\typed_queue.unsound.ddc.dill=packages/typed_data/src/typed_queue --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\charcode\ascii.unsound.ddc.dill=packages/charcode/ascii --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\charcode\html_entity.unsound.ddc.dill=packages/charcode/html_entity --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\charcode\charcode.unsound.ddc.dill=packages/charcode/charcode --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\path\path.unsound.ddc.dill=packages/path/path --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\term_glyph\src\generated\ascii_glyph_set.unsound.ddc.dill=packages/term_glyph/src/generated/ascii_glyph_set --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\source_span\source_span.unsound.ddc.dill=packages/source_span/source_span --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\string_scanner\src\eager_span_scanner.unsound.ddc.dill=packages/string_scanner/src/eager_span_scanner --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\http_parser\http_parser.unsound.ddc.dill=packages/http_parser/http_parser --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\http\http.unsound.ddc.dill=packages/http/http --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\shopisss_server\element_lib.unsound.ddc.dill=packages/shopisss_server/element_lib --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\shopisss_server\controller_lib.unsound.ddc.dill=packages/shopisss_server/controller_lib --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\language\he_text.unsound.ddc.dill=packages/client_app/model/language/he_text --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\intl\date_symbols.unsound.ddc.dill=packages/intl/date_symbols --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\intl\src\date_format_internal.unsound.ddc.dill=packages/intl/src/date_format_internal --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\intl\number_symbols.unsound.ddc.dill=packages/intl/number_symbols --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\intl\number_symbols_data.unsound.ddc.dill=packages/intl/number_symbols_data --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\clock\clock.unsound.ddc.dill=packages/clock/clock --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\intl\src\intl\bidi.unsound.ddc.dill=packages/intl/src/intl/bidi --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\intl\intl.unsound.ddc.dill=packages/intl/intl --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\language\de_text.unsound.ddc.dill=packages/client_app/model/language/de_text --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\language\ar_text.unsound.ddc.dill=packages/client_app/model/language/ar_text --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\language\ru_text.unsound.ddc.dill=packages/client_app/model/language/ru_text --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\language\es_text.unsound.ddc.dill=packages/client_app/model/language/es_text --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\language\fr_text.unsound.ddc.dill=packages/client_app/model/language/fr_text --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\language\en_text.unsound.ddc.dill=packages/client_app/model/language/en_text --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\controller\ui_util.unsound.ddc.dill=packages/client_app/controller/ui_util --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\view\elements\colors_for_msg.unsound.ddc.dill=packages/client_app/view/elements/colors_for_msg --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\view\elements\callout_dlg.unsound.ddc.dill=packages/client_app/view/elements/callout_dlg --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\view\elements\modal_box.unsound.ddc.dill=packages/client_app/view/elements/modal_box --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\view\elements\note_dlg.unsound.ddc.dill=packages/client_app/view/elements/note_dlg --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\data\product_data.unsound.ddc.dill=packages/client_app/model/data/product_data --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\data\sale_data.unsound.ddc.dill=packages/client_app/model/data/sale_data --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\view\store_app\elements\bread_crumb.unsound.ddc.dill=packages/client_app/view/store_app/elements/bread_crumb --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\controller\cmd_event_controller.unsound.ddc.dill=packages/client_app/controller/cmd_event_controller --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\std_web_store\view\elements\bread_crumb.unsound.ddc.dill=packages/std_web_store/view/elements/bread_crumb --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\std_web_store\model\content\base_content.unsound.ddc.dill=packages/std_web_store/model/content/base_content --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\data\supplier_data.unsound.ddc.dill=packages/client_app/model/data/supplier_data --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\data\tag_data.unsound.ddc.dill=packages/client_app/model/data/tag_data --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\data\group_data.unsound.ddc.dill=packages/client_app/model/data/group_data --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\std_web_store\view\elements\ui_parts.unsound.ddc.dill=packages/std_web_store/view/elements/ui_parts --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\controller\home_page_controller.unsound.ddc.dill=packages/client_app/controller/home_page_controller --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\std_web_store\model\content\brand_content.unsound.ddc.dill=packages/std_web_store/model/content/brand_content --packages=.dart_tool/package_config.json --module-name=packages/std_web_store/view/dialogs/order_details_wnd --multi-root-scheme=org-dartlang-app --multi-root=. --track-widget-creation --inline-source-map --libraries-file=file:///C:/Program%20Files/Dart/dart-sdk/lib/libraries.json --experimental-emit-debug-metadata --used-inputs-file=C:\Users\SHLOMO~1.L00\AppData\Local\Temp\ddk_builder_79e0363\used_inputs.txt package:std_web_store/view/dialogs/order_details_wnd.dart --no-sound-null-safety
dart --version: 2.14.1 (stable) (Wed Sep 8 13:33:08 2021 +0200) on "windows_x64"

Crash when compiling null,
at character offset null:
Reference to package:std_web_store/view//elements/bread_crumb.dart is not bound to an AST node. A library was expected
#0 Reference.asLibrary (package:kernel/canonical_name.dart:457:7)
#1 LibraryDependency.targetLibrary (package:kernel/ast.dart:673:57)
#2 SourceLoader.computeFullComponent (package:front_end/src/fasta/source/source_loader.dart:1051:38)
#3 SourceLoader.computeHierarchy (package:front_end/src/fasta/source/source_loader.dart:1068:38)
#4 KernelTarget.buildOutlines. (package:front_end/src/fasta/kernel/kernel_target.dart:333:14)

#5 withCrashReporting (package:front_end/src/fasta/crash.dart:121:12)

#6 IncrementalCompiler.computeDelta. (package:front_end/src/fasta/incremental_compiler.dart:304:38)

#7 _compile (package:dev_compiler/src/kernel/command.dart:341:32)

#8 compile (package:dev_compiler/src/kernel/command.dart:51:12)

#9 _CompilerWorker.performRequest (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/dev_compiler/bin/dartdevc.dart:68:18)

#10 AsyncWorkerLoop.run (package:bazel_worker/src/worker/async_worker_loop.dart:35:20)

#11 main (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/dev_compiler/bin/dartdevc.dart:31:5)

#0 Reference.asLibrary (package:kernel/canonical_name.dart:457:7)
#1 LibraryDependency.targetLibrary (package:kernel/ast.dart:673:57)
#2 SourceLoader.computeFullComponent (package:front_end/src/fasta/source/source_loader.dart:1051:38)
#3 SourceLoader.computeHierarchy (package:front_end/src/fasta/source/source_loader.dart:1068:38)
#4 KernelTarget.buildOutlines. (package:front_end/src/fasta/kernel/kernel_target.dart:333:14)

#5 withCrashReporting (package:front_end/src/fasta/crash.dart:121:12)

#6 IncrementalCompiler.computeDelta. (package:front_end/src/fasta/incremental_compiler.dart:304:38)

#7 _compile (package:dev_compiler/src/kernel/command.dart:341:32)

#8 compile (package:dev_compiler/src/kernel/command.dart:51:12)

#9 _CompilerWorker.performRequest (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/dev_compiler/bin/dartdevc.dart:68:18)

#10 AsyncWorkerLoop.run (package:bazel_worker/src/worker/async_worker_loop.dart:35:20)

#11 main (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/dev_compiler/bin/dartdevc.dart:31:5)

@lrhn lrhn added area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. web-dev-compiler labels Sep 10, 2021
@nshahan
Copy link
Contributor

nshahan commented Sep 10, 2021

@johnniwinther This looks like it's coming from a call to IncrementalCompiler.computeDelta() on package:dev_compiler/src/kernel/command.dart:341:32. Are you aware of any recent changes that could be related?

Not sure if this is a red herring but I noticed the error message includes a path with an extra / in the middle. 'package:std_web_store/view//elements/bread_crumb.dart'.

@johnniwinther
Copy link
Member

johnniwinther commented Sep 10, 2021

Maybe it's related to #46706

@jensjoha Can you take a look at this?

@bshlomo
Copy link
Author

bshlomo commented Sep 11, 2021

You are right
The reason for the error is the extra /
But I think this kind of error should have been discovered before the compiler stage

dart-bot pushed a commit that referenced this issue Sep 13, 2021
This CL reproduces - but does not fix - issue #47176
(#47176)

Change-Id: I03384a6933a6f8181e909d8b6bc812e5550f903f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213261
Commit-Queue: Jens Johansen <[email protected]>
Reviewed-by: Johnni Winther <[email protected]>
@jensjoha
Copy link
Contributor

I've reproduced this (e47850a).

Caveat: The below has ended up in a semi-unstructured brain-dump, and I apologize, but will post it anyway.

This is what happens:

  • For URIs "a/b/c.dart" and "a/b//c.dart" are different. For (some? most? all?) file systems they're the same file though.
  • In this case one "module" has serialized the "a/b/c.dart" version and another module has used (and found on disk because the file system doesn't care) the "a/b//c.dart" version (while not serializing it itself), but saving a reference to it.
  • When reading the modules we have no "a/b//c.dart" version because it was never serialized (but is still referenced) --- so when we try to follow that reference we get the crash.

We've also seen this issue before with weird error messages like "Foo is not Foo" because a class "Foo" from lib "a/b/c.dart" is not a class "Foo" from lib "a/b//c.dart".

Furthermore this problem generalizes - at least on Windows - where "a/b/c.dart" and e.g. "a/b/C.dart" also yields the same file, but are two different URIs and thus becomes two different libraries.

In many ways this is equivalent to the build system not giving us all needed files, something we expect not to happen, which is why we (evidently) don't check for it. Maybe we should? (/cc @johnniwinther ) (I don't know how expensive that is). But also, at that point what are we actually supposed to do? I doubt we can actually give a good error message. (Maybe the part of the system that picks out the stuff that we want to serialize could give an error if given something we're not expecting? (say we're asked to compile "lib.dart" and given from dill a library "a/b/c.dart" and returned back "lib.dart", "a/b/c.dart" and "a/b//c.dart") --- but still this feels to late and can we get a good error message?).

Ideally we would give an error when importing the "wrong" version (say "a/b//c.dart" or "a/b/C.dart"), but how can we know if it's the wrong version? Can we define in the language that importing or exporting a uri with a double-slash is an error or a warning or something, and/or that if a program is importing and exporting something where two or more uris are duplicates in their lower-case-representation it's a warning or an error or something? (/cc @lrhn ) (on (most?) linux machines that could otherwise be a perfectly valid program).

Can we somehow from the filesystem extract what a "canonical" representation of the file identifier is? (so that we silently just rewrite the import).

What does the analyzer do in situations like this? (/cc @bwilkerson )

@bshlomo
Copy link
Author

bshlomo commented Sep 13, 2021

The analyzer ignored the problem and did not present the situation as a problem.

@nshahan
Copy link
Contributor

nshahan commented Oct 1, 2021

@jensjoha If there is a solution here it sounds like it will be handled by the CFE. I'm going to move this to a different area label. If you think it should come back to the web please feel free to update it.

@nshahan nshahan added legacy-area-front-end Legacy: Use area-dart-model instead. and removed web-dev-compiler area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. labels Oct 1, 2021
@jensjoha
Copy link
Contributor

jensjoha commented Oct 4, 2021

No one from the analyzer team has explained what the analyzer does in situations like this. That it doesn't crash for instance doesn't mean it's doing the right thing (whatever that might be).
No one from the language team has explained what they'd expect happen in a situation like this, if there is a way to get the "canonical path" from the filesystem etc.
In many ways this is (also) a failing of the build system --- it provides the CFE with what is basically invalid/incomplete data.

Having one "area" label here does not seem to do justice to the issue.

I'll try to /cc people again: @johnniwinther @bwilkerson @lrhn

@lrhn
Copy link
Member

lrhn commented Oct 4, 2021

The current language specification is clear: If the URIs are different, they're defining different libraries. From the language's perspective, that's all there is to it. (It doesn't know about build systems or serialized code. It doesn't even know what a file system is, that's considered an implementation detail.)

I have a request for allowing the front-ends to be smarter about URIs in source code, but nothing has happened yet, so the specification stands.

That doesn't mean that tools can't be smarter about everything other than import URIs in source code.
Command line paths is one case where we read something as either a URI or a file path, and it's perfectly reasonable to be clever about making that distinction (as long as all our tools agree on how to be clever). The language doesn't care how you get to the URI used for the entry point script, as long as it gets one. It cannot see whether the URI it gets matches the original text on the command line, and it won't care. We already do rewriting here, to make scripts in lib/ be inserted as package: URIs.

We can also choose to warn about any source URI containing double-slashes, or even any upper-case letters, because you really just shouldn't use those by accident.

So, from my perspective: Do whatever makes things work, as long as it's consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.
Projects
None yet
Development

No branches or pull requests

5 participants