-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
Failure to run simple app compiled to WASM with error about identityHashCode #148617
Comments
Hi @Rexios80
I tried the same on your project but it built with a long error. Since your project is using many dependencies, please narrow it down to see if one of them may cause this. Thanks! |
I've narrowed it down to That package has perfectly valid code that is failing to compile to WASM. There isn't anything to work off of from either the Flutter debugger or the web dev tools besides that cryptic error without any other information. |
Does that mean the issue disappeared after you removed it from project? You can also check Requires JS-interop to access browser and JS APIs to filter out which packages haven't been migrated to support wasm compilation yet. |
If it was a web package migration issue wouldn't the app not even compile? This is a runtime error. |
I will mark this as an issue with flutter doctor -v[!] Flutter (Channel master, 3.22.0-39.0.pre.1, on macOS 14.1 23B74 darwin-x64, locale en-VN)
• Flutter version 3.22.0-39.0.pre.1 on channel master at /Users/huynq/Documents/GitHub/flutter_master
! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 165e535474 (3 hours ago), 2024-05-20 16:52:15 -0700
• Engine revision c2ef01f6f1
• Dart version 3.5.0 (build 3.5.0-172.0.dev)
• DevTools version 2.36.0-dev.10
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/huynq/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = /Users/huynq/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
• Xcode at /Applications/Xcode15.3.app/Contents/Developer
• Build 15E204a
• CocoaPods version 1.15.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2023.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• android-studio-dir = /Applications/Android Studio.app/
• Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
[✓] VS Code (version 1.89.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.88.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • macOS 14.1 23B74 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 125.0.6422.61
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category. |
cc @mkustermann @osa1 do you recognize the issue with |
I think this is probably new, I can debug this.
This is a type error in the generated Wasm file, and type errors in the generated code are always a compiler bug, dart2wasm should never generate ill-typed Wasm. It happens in runtime because compilation of the generated Wasm happens in runtime. We could actually catch these kinds of errors in compile time by validating the generated code right after generating it, in compile time. @mkustermann any thoughts on this? |
Should I make a separate issue for this one? flyerhq/flutter_chat_ui#596 |
I'm also having a bunch of issues with type casting with JSON deserialization. This code works without running on WASM. Are those issues I should report as well or are they expected? |
The issue seems to occur on version I created a reproducible example using the |
@Rexios80 Yes, that's also a dart2wasm bug and a separate bug. I think these should be reported in the SDK repo as they're not Flutter bugs.
I can't tell without seeing the program and the output. When in doubt please just report.
@leoafarias I wonder if this was fixed with dart-lang/sdk@0299c05481c. Is this commit included in the fixed version? |
@osa1 Is there a commit with this change on flutter, and I can test it |
@leoafarias I don't know how the SDK dependency is updated in Flutter repo so I'm not sure. Basically dart2wasm between dart-lang/sdk@9f075b1 and dart-lang/sdk@0299c05481c is buggy, so we should check if the buggy version uses dart2wasm between those two commits. I can't see the tag 3.22.0-36.0.pre.49 in https://github.com/flutter/flutter/tags.. Where do I get that tag? |
That tag just comes from the latest on master. This is the version of the Dart SDK, let me know if that helps? |
Is this the version that works, or the version with the bug? If it's the version that works, then this was probably an issue caused by the bug between the linked comments in my previous comment and it's probably fixed now. If it's the version with the bug then this is probably a new issue and I will take a look. |
This version does not work: flutter/engine#52970 This version works: flutter/engine#52625 At least based on my tests. |
I do actually get the same error at compile time on Flutter master: |
I found the bug, but I don't understand why it happens. Basically in this program
And This can be easily fixed but I'd like to understand why |
This seems to be a TFA bug. In this method:
which I think is coming from: TFA infers the return type as
@alexmarkov do you already know what the issue may be here or do you need a smaller repro? We tried to minimize this for a while, I can try more if you need a smaller repro. |
…pe is non-nullable With sound null safety, implicit "return null" at the end of function should be taken into account only if return type is nullable. TEST=pkg/vm/testcases/transformations/type_flow/transformer/regress_flutter148617.dart Issue: flutter/flutter#148617 Change-Id: I209fc9a3b10639fd4024d4b1807591498349e1f0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367980 Reviewed-by: Martin Kustermann <[email protected]> Commit-Queue: Alexander Markov <[email protected]>
This should be fixed by dart-lang/sdk@345b437. |
Can confirm a successful build/run on version: Flutter 3.23.0-4.0.pre.6 • channel main • [email protected]:flutter/flutter.git
Framework • revision 8dd08314d2 (57 minutes ago) • 2024-05-24 07:26:25 -0400
Engine • revision 4ab4424752
Tools • Dart 3.5.0 (build 3.5.0-188.0.dev) • DevTools 2.36.0-dev.10 |
The fix rolled into Flutter in b3d8053. |
@alexmarkov Will this be included in the next hotfix? |
Cherry-pick request for beta branch: dart-lang/sdk#55837. Please follow that issue for updates. @Rexios80 Do you also need the fix in stable? |
@alexmarkov I would think any WASM compilation bug fixes should be in stable |
…atic type is non-nullable With sound null safety, implicit "return null" at the end of function should be taken into account only if return type is nullable. TEST=pkg/vm/testcases/transformations/type_flow/transformer/regress_flutter148617.dart Issue: flutter/flutter#148617 Change-Id: Iebf68d4b279055fc2f902c36b5fb916bafe7bb8e Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/367980 Cherry-pick-request: TBA Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368180 Commit-Queue: Martin Kustermann <[email protected]> Reviewed-by: Martin Kustermann <[email protected]>
As per dart-lang/sdk#55837 (comment), stable branch is likely unaffected. @Rexios80 @osa1 Can you reproduce the bug on stable and verify if the fix for stable branch is needed or not? |
/cc @mkustermann can we make a call if this needs to be cherry picked? |
See my comment on dart-lang/sdk#55837 (comment). The stable branch was cut already in march, way before we used this information in dart2wasm. So there's no need to cherry-pick it I believe. |
I can confirm I no longer see the |
This may be due to conditional imports being incorrectly evaluated, tracked here dart-lang/sdk#55948 |
I'm not sure there's a conditional import involved |
@Rexios80 The The fix for dart-lang/sdk#55948 landed and will make it upstream in coming days into flutter main channel. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Steps to reproduce
feature/wasm-support
flutter run --wasm
(must be on flutter master, or do it the hard way on stable)Expected results
No exception
Actual results
The following error:
Uncaught (in promise) CompileError: WebAssembly.compileStreaming(): Compiling function #1263:"identityHashCode" failed: type error in return[0] (expected i64, got (ref null 103)) @+1479968
Code sample
https://github.com/Rexios80/rexios.dev
There isn't much there
Screenshots or Video
No response
Logs
Web debugger:
Uncaught (in promise) CompileError: WebAssembly.compileStreaming(): Compiling function #1263:"identityHashCode" failed: type error in return[0] (expected i64, got (ref null 103)) @+1479968
Nothing in the Flutter logs
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: