-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Type canonicalization not consistently preserved / reset with ddc hot restart #37259
Comments
This seems to be the same as flutter/flutter#34289 – no sync to specific PRs required. |
Potential workaround: always reload the root module on start. |
@jakemac53 @vsmenon has there been any more investigation on fixes vs workarounds here? |
I have not been able to isolate the root cause yet. Are you all still seeing the behavior? |
It looks like @grouma is getting close to landing the webdev changes the tool needs. I'll wait until that lands and then start from there |
Okay, I've isolated the root cause. Will work on a fix. DDC hoists complex type expressions as an optimization - e.g., After a restart, |
Here's a unit test repro: |
No update on this since last week. @jonahwilliams - how blocking is this right now? |
I can't land the dwds integration until this is fixed. In the meantime, I'm using a full browser restart which is good enough. I don't believe anyone is on the flutter based workflow yet though. |
Fix / workaround here: https://dart-review.googlesource.com/c/sdk/+/109100 The relevant bit is a one-liner if you are able to try it out. Fixes @kevmoo 's repro and the unit test. |
I will take a look tomorrow and report back, thank you! |
The combination of type expression hoisting, hot restart, and generic cache reset triggers occasional breakage (see #37259). Not clearing the generic cache should be safe, but will some leak memory: unloaded types will pollute the cache. References to those unloaded types in user code, however, should be cleared. Bug: #37259 Change-Id: Ia15115a41556db7a19109f0178baa63ec0cfcb9c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109100 Reviewed-by: Leaf Petersen <leafp@google.com> Commit-Queue: Vijay Menon <vsm@google.com>
I'm still getting some odd type errors when hot restarting with this change applied. Interestingly this is coming from the precompiled dart sdk and not from any user code (though that may be stopping me from getting to the user code)
|
Thanks for checking - can you give me repro steps? |
(From here on assuming that flutter/engine is located at engine/src/flutter)
(From here on assuming we're in flutter/flutter)
|
This is a somewhat roundabout way to prevent a hot restart from redefining these types. This fixes the issues arising: #37259. Should more cleanly separate fields reset on a hot restart from ones preserved. Change-Id: Id0c45cbeed67b574c3259e1f87a405137ae93575 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111315 Reviewed-by: Mark Zhou <markzipan@google.com> Commit-Queue: Vijay Menon <vsm@google.com>
The above CL should unblock Flutter Web when it rolls in. I'll keep this issue open to implement a cleaner solution to delineate state that should and should not (internal type tables) be reset. @jonahwilliams - I'm tentatively lowering the priority here as I think you're unblocked. Please let me know if you still see the issue. |
@nshahan this also looks similar to the bug we were debugging. |
Note: reproduction of this issue requires a checkout of flutter/flutter#34252 and dart-lang/webdev#440
Dart VM version: 2.3.3-dev.0.0.flutter-3166bbf24b (Tue Jun 11 16:24:18 2019 +0200) on "macos_x64"
Compiling the flutter gallery via the dev compiler/kernel initially succeeds. Applying a hot restart fails in different ways, depending on which library changed.
Case 1: Trigger Hot restart without changing anything
The hot reload fails due to a type error after re-invoking main:
This corresponds to https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/animation/listener_helpers.dart#L170
Case 2: Change something upstream of listener_helpers.dart, like animation.dart.
The hot reload fails due to a slightly different type error
This corresponds to raw_keyboard.dart https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/services/raw_keyboard.dart#L477
Case 3: Change something in foundation.dart
Mostly success!
The text was updated successfully, but these errors were encountered: