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

Web compiler crash #53479

Closed
llfbandit opened this issue Sep 10, 2023 · 4 comments
Closed

Web compiler crash #53479

llfbandit opened this issue Sep 10, 2023 · 4 comments
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. front-end-kernel web-js-interop Issues that impact all js interop

Comments

@llfbandit
Copy link

  • Dart SDK 3.1.1 (shipped with flutter 3.13.3)
  • OS: Windows 11
Log

Compiling lib/main.dart for the Web...
Target dart2js failed: ProcessException: Process exited abnormally:
../../../../../../../AppData/Local/Pub/Cache/hosted/pub.dev/go_router-10.1.2/lib/src/information_provider.dart:125:34:
Warning: Operand of null-aware operation '!' has type 'String' which excludes null.
location: routeInformation.location!,
^
../../../../../../../AppData/Local/Pub/Cache/hosted/pub.dev/go_router-10.1.2/lib/src/parser.dart:87:50:
Warning: Operand of null-aware operation '!' has type 'String' which excludes null.
configuration.findMatch(routeInformation.location!, extra: state.extra);
^
file:///C:/Users/remy/Documents/dev/workspace/veolys/nouvelatrium/apps/nouvelatrium/.dart_tool/flutter_build/387c38ab88f96dc7786f99cb83c14955/main.dart:
Internal Error: The compiler crashed when compiling this element.

Stack trace

The compiler crashed: Invalid argument(s): Type parameter TypeParameter(T) is not indexed
#0 TypeParameterIndexer.[] (package:kernel/binary/ast_to_binary.dart:3371:8)
#1 BinaryPrinter.visitTypeParameterType (package:kernel/binary/ast_to_binary.dart:2528:38)
#2 TypeParameterType.accept (package:kernel/ast.dart:12528:42)
#3 BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:439:10)
#4 BinaryPrinter.writeNodeList (package:kernel/binary/ast_to_binary.dart:349:7)
#5 BinaryPrinter.visitInterfaceType (package:kernel/binary/ast_to_binary.dart:2435:7)
#6 InterfaceType.accept (package:kernel/ast.dart:11385:42)
#7 BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:439:10)
#8 BinaryPrinter.visitAsExpression (package:kernel/binary/ast_to_binary.dart:1960:5)
#9 AsExpression.accept (package:kernel/ast.dart:7636:44)
#10 BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:439:10)
#11 BinaryPrinter.writeOptionalNode (package:kernel/binary/ast_to_binary.dart:531:7)
#12 BinaryPrinter.visitReturnStatement (package:kernel/binary/ast_to_binary.dart:2315:5)
#13 ReturnStatement.accept (package:kernel/ast.dart:10127:43)
#14 BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:439:10)
#15 BinaryPrinter.writeOptionalNode (package:kernel/binary/ast_to_binary.dart:531:7)
#16 BinaryPrinter.visitFunctionNode (package:kernel/binary/ast_to_binary.dart:1529:5)
#17 FunctionNode.accept (package:kernel/ast.dart:3908:38)
#18 BinaryPrinter.writeFunctionNode (package:kernel/binary/ast_to_binary.dart:446:10)
#19 BinaryPrinter.visitProcedure (package:kernel/binary/ast_to_binary.dart:1357:5)
#20 Procedure.accept (package:kernel/ast.dart:3311:40)
#21 BinaryPrinter.writeProcedureNode (package:kernel/binary/ast_to_binary.dart:467:10)
#22 BinaryPrinter.writeProcedureNodeList (package:kernel/binary/ast_to_binary.dart:358:7)
#23 BinaryPrinter.visitClass (package:kernel/binary/ast_to_binary.dart:1260:5)
#24 Class.accept (package:kernel/ast.dart:1422:38)
#25 BinaryPrinter.writeClassNode (package:kernel/binary/ast_to_binary.dart:481:10)
#26 BinaryPrinter.writeClassNodeList (package:kernel/binary/ast_to_binary.dart:376:7)
#27 BinaryPrinter.visitLibrary (package:kernel/binary/ast_to_binary.dart:1096:5)
#28 Library.accept (package:kernel/ast.dart:577:38)
#29 BinaryPrinter.writeLibraryNode (package:kernel/binary/ast_to_binary.dart:460:10)
#30 BinaryPrinter.writeLibraries (package:kernel/binary/ast_to_binary.dart:766:9)
#31 BinaryPrinter.writeComponentFile. (package:kernel/binary/ast_to_binary.dart:605:7)
#32 Timeline.timeSync (dart:developer/timeline.dart:171:22)
#33 BinaryPrinter.writeComponentFile (package:kernel/binary/ast_to_binary.dart:586:14)
#34 SerializationTask.serializeComponent. (package:compiler/src/serialization/task.dart:77:15)
#35 CompilerTask.measureSubtask (package:compiler/src/common/tasks.dart:181:35)
#36 SerializationTask.serializeComponent (package:compiler/src/serialization/task.dart:67:5)
#37 Compiler.produceKernel (package:compiler/src/compiler.dart:422:29)

#38 Compiler.runSequentialPhases (package:compiler/src/compiler.dart:711:20)

#39 Compiler.runInternal. (package:compiler/src/compiler.dart:311:7)

#40 Compiler.runInternal (package:compiler/src/compiler.dart:310:5)

#41 Compiler.run. (package:compiler/src/compiler.dart:231:11)

#42 main (package:compiler/src/dart2js.dart:1241:3)

Command: C:\Users\remy\Documents\dev\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev C:\Users\remy\Documents\dev\flutter\bin\cache\dart-sdk\bin\snapshots\dart2js.dart.snapshot --platform-binaries=C:\Users\remy\Documents\dev\flutter\bin\cache\flutter_web_sdk\kernel --invoker=flutter_tool -Ddart.vm.product=true -Denv=sit -DFLUTTER_WEB_AUTO_DETECT=true -DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/b8d35810e91ab8fc39ba5e7a41bff6f697e8e3a8/ --native-null-assertions -o C:\Users\remy\Documents\dev\workspace\veolys\nouvelatrium\apps\nouvelatrium.dart_tool\flutter_build\387c38ab88f96dc7786f99cb83c14955\app.dill --packages=.dart_tool/package_config.json --cfe-only C:\Users\remy\Documents\dev\workspace\veolys\nouvelatrium\apps\nouvelatrium.dart_tool\flutter_build\387c38ab88f96dc7786f99cb83c14955\main.dart
#0 RunResult.throwException (package:flutter_tools/src/base/process.dart:125:5)
#1 _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart:278:19)

#2 Dart2JSTarget.build (package:flutter_tools/src/build_system/targets/web.dart:189:5)

#3 _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:853:9)

#4 Future.wait. (dart:async/future.dart:525:21)

#5 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:791:32)

#6 Future.wait. (dart:async/future.dart:525:21)

#7 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:791:32)

#8 FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:620:16)

#9 WebBuilder.buildWeb (package:flutter_tools/src/web/compile.dart:89:34)

#10 BuildWebCommand.runCommand (package:flutter_tools/src/commands/build_web.dart:198:5)

#11 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1297:27)

#12 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)

#13 CommandRunner.runCommand (package:args/command_runner.dart:212:13)

#14 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:339:9)

#15 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)

#16 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:285:5)

#17 run.. (package:flutter_tools/runner.dart:115:9)

#18 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)

#19 main (package:flutter_tools/executable.dart:90:3)

@lrhn lrhn added area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-kernel labels Sep 11, 2023
@johnniwinther
Copy link
Member

@srujzs This looks like #53291

@johnniwinther johnniwinther added the area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. label Sep 11, 2023
@srujzs
Copy link
Contributor

srujzs commented Sep 11, 2023

Indeed it does. @llfbandit, can you share a repro here?

@llfbandit
Copy link
Author

llfbandit commented Sep 11, 2023

@johnniwinther is right. We're in the exact same situation as the other issue. I use also the record package in my app.
Simply adding go_router seems to be not enough to reproduce the crash. Adding record package makes the issue reproducible.

Funny enough, I'm the author of the record package. Is there any action to take on my side to workaround or lower the risk for such issue for the future?

For what it's worth now, here's the flutter reproducer.
web_compiler_issue.zip

@srujzs
Copy link
Contributor

srujzs commented Sep 11, 2023

The issue arises from the intersection of @staticInterop, type parameters, and factories. I don't really think you can work around using a factory unless you start using a static method that forwards to a js_util call or something, and getting rid of type parameters is probably going to be painful for your users.

I think a cherry-pick for this change makes sense so it can be available before 3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. front-end-kernel web-js-interop Issues that impact all js interop
Projects
None yet
Development

No branches or pull requests

6 participants
@nshahan @llfbandit @lrhn @johnniwinther @srujzs and others