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

Compile deferred component error. Seem like a compile error in gen_snapshot. #49372

Closed
lawangle opened this issue Jun 30, 2022 · 7 comments
Closed
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@lawangle
Copy link
Contributor

lawangle commented Jun 30, 2022

Environment:

flutter tools: 2.10.4(flutter/flutter@c860cba)
dart version: 2.16.2 (6fbb923)

Replay steps:

  1. git clone flutter gallery: https://github.com/flutter/gallery/tree/fully-deferred-gallery . (I tried other branch, the bug is the same.)
  2. run: flutter build appbundle --verbose.
  3. gen_snapthot .... command start
  4. waiting and gen_snapthot fail

The problem log in my local environment is:
[+822599 ms] [+822565 ms] Unresolved call to Code([Optimized] ___TabsNonScrollableDemoState&State&SingleTickerProviderStateMixin&RestorationMixin._updateProperty) from Code([Optimized] __HomePageState&State&SingleTickerProviderStateMixin&RestorationMixin.registerForRestoration.listener) [ ] [ +2 ms] Unresolved call to Code([Optimized] __CupertinoAlertDemoState&State&RestorationMixin._updateProperty) from Code([Optimized] __LoginPageState&State&RestorationMixin.registerForRestoration.listener) [ ] [ ] Unresolved call to Code([Optimized] __CupertinoAlertDemoState&State&RestorationMixin._updateProperty) from Code([Optimized] __LoginPageState&State&RestorationMixin.registerForRestoration) [ ] [ ] Unresolved call to Code([Optimized] __CupertinoAlertDemoState&State&RestorationMixin._updateProperty) from Code([Optimized] [tear-off] __LoginPageState&State&RestorationMixin._updateProperty) [ ] [ ] Unresolved call to Code([Optimized] __ProgressIndicatorDemoState&State&SingleTickerProviderStateMixin._updateTicker) from Code([Optimized] __RallyPieChartState&State&SingleTickerProviderStateMixin.createTicker) [ ] [ ] Unresolved call to Code([Optimized] __ProgressIndicatorDemoState&State&SingleTickerProviderStateMixin._updateTicker) from Code([Optimized] [tear-off] __RallyPieChartState&State&SingleTickerProviderStateMixin._updateTicker) [ ] [ ] Unresolved call to Code([Optimized] __ProgressIndicatorDemoState&State&SingleTickerProviderStateMixin._updateTicker) from Code([Optimized] __HomePageState&State&SingleTickerProviderStateMixin.createTicker) [ ] [ ] Unresolved call to Code([Optimized] __ProgressIndicatorDemoState&State&SingleTickerProviderStateMixin._updateTicker) from Code([Optimized] [tear-off] __RallyTabState&State&SingleTickerProviderStateMixin._updateTicker) [ ] [ ] Unresolved call to Code([Optimized] ___TabsNonScrollableDemoState&State&SingleTickerProviderStateMixin&RestorationMixin._updateProperty) from Code([Optimized] [tear-off] __HomePageState&State&SingleTickerProviderStateMixin&RestorationMixin._updateProperty) [ ] [ ] Unresolved call to Code([Optimized] ___TabsNonScrollableDemoState&State&SingleTickerProviderStateMixin&RestorationMixin._updateProperty) from Code([Optimized] __HomePageState&State&SingleTickerProviderStateMixin&RestorationMixin.registerForRestoration) [ ] [ ] Unresolved call to Code([Optimized] ___TabsNonScrollableDemoState&State&SingleTickerProviderStateMixin&RestorationMixin.restorePending) from Code([Optimized] __HomePageState&State&SingleTickerProviderStateMixin&RestorationMixin.didUpdateRestorationId) [ ] [ ] Unresolved call to Code([Optimized] __ProgressIndicatorDemoState&State&SingleTickerProviderStateMixin._updateTicker) from Code([Optimized] [tear-off] __HomePageState&State&SingleTickerProviderStateMixin._updateTicker) [ ] [ ] Unresolved call to Code([Optimized] __ProgressIndicatorDemoState&State&SingleTickerProviderStateMixin._updateTicker) from Code([Optimized] __RallyTabState&State&SingleTickerProviderStateMixin.createTicker) [ ] [ ] Unresolved call to Code([Optimized] __ProgressIndicatorDemoState&State&SingleTickerProviderStateMixin._updateTicker) from Code([Optimized] __RallyPieChartState&State&SingleTickerProviderStateMixin.activate) [ ] [ ] Unresolved call to Code([Optimized] __ProgressIndicatorDemoState&State&SingleTickerProviderStateMixin._updateTicker) from Code([Optimized] __HomePageState&State&SingleTickerProviderStateMixin.activate) [ ] [ ] Unresolved call to Code([Optimized] __ProgressIndicatorDemoState&State&SingleTickerProviderStateMixin._updateTicker) from Code([Optimized] __RallyTabState&State&SingleTickerProviderStateMixin.activate) [ ] [ ] Unresolved call to Code([Optimized] ___TabsNonScrollableDemoState&State&SingleTickerProviderStateMixin&RestorationMixin.restorePending) from Code([Optimized] __HomePageState&State&SingleTickerProviderStateMixin&RestorationMixin.didChangeDependencies) [ ] [ ] Unresolved call to Code([Optimized] new __TabsNonScrollableDemoState) from Code([Optimized] HomePage.createState) [ ] [ ] ../../third_party/dart/runtime/vm/compiler/relocation.cc: 124: error: expected: all_unresolved_calls_.IsEmpty() [ ] [ +2 ms] Dart snapshot generator failed with exit code -6

Other messages:

  1. I tried flutter tools(v2.8.3, dart version: 2.15.1) and the result of 'build appbundle' is successful.
  2. I tried flutter tools in current stable branch, the dart-sdk is 2.17.5, this bug is gone.(I can't upgrade flutter directly, because it will cost us a lot of time to solve other problems.)
  3. It's seems that caller in unit(=4) will call callee in other unit, but rellocation should happen in the same unit and then fail.

I am a beginner in dart-sdk and i am very interesing in the bug's reason.

@mraleph mraleph added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Jun 30, 2022
@mraleph
Copy link
Member

mraleph commented Jun 30, 2022

/cc @rmacnak-google

@mraleph
Copy link
Member

mraleph commented Jun 30, 2022

In general we don't provide support for older versions, but @rmacnak-google might remember which bug could have been causing this and associated fix (if any).

@mraleph mraleph closed this as completed Jun 30, 2022
@lawangle
Copy link
Contributor Author

I understand. If there is any clue can be helpful.

@rmacnak-google
Copy link
Contributor

flutter build appbundle --no-deferred-components is a possible work-around for older versions.

@lawangle
Copy link
Contributor Author

lawangle commented Jul 1, 2022

flutter build appbundle --no-deferred-components is a possible work-around for older versions.

Tks, but deferred component is necessary for our app.
I will try to find the bug, thanks.

lawangle added a commit to lawangle/sdk that referenced this issue Jul 4, 2022
`Dedup optimization` will remove duplicated Code object and keep one instance.
When building deferred components, the only Code object (e.x. as callee B) maybe
exist in different loading unit from the caller A. This will cause a rellocation
bug if A->B was a relative call.

Add a flag to indicate building with deferred components.
When working with dedup and deferred components, assignUnit first and
Code object from different unit is unequal.

Issues: dart-lang#49372

Signed-off-by: fangzheyuan <fangzheyuan@bytedance.com>
lawangle added a commit to lawangle/sdk that referenced this issue Jul 4, 2022
`Dedup optimization` will remove duplicated Code object and keep one instance.
When building deferred components, the only Code object (e.x. as callee B) maybe
exist in different loading unit from the caller A. This will cause a rellocation
bug if A->B was a relative call.

Add a flag to indicate building with deferred components.
When working with dedup and deferred components, assignUnit first and
Code object from different unit is unequal.

Issues: dart-lang#49372

Signed-off-by: fangzheyuan <fangzheyuan@bytedance.com>
@mraleph mraleph reopened this Jul 4, 2022
@mraleph
Copy link
Member

mraleph commented Jul 4, 2022

reopening to reflect that @lawangle has found an actual bug.

lawangle added a commit to lawangle/sdk that referenced this issue Jul 5, 2022
`Dedup optimization` will remove duplicated Code object and keep one instance.
When building deferred components, the only Code object (e.x. as callee B) maybe
exist in different loading unit from the caller A. This will cause a rellocation
bug if A->B was a relative call.

Extract `LoadingUnitOf` function from flow graph compiler.
When working with dedup and deferred components, Code object from different unit is unequal.

TEST=vm/dart{_2}/regress_49372
Issues: dart-lang#49372

Signed-off-by: fangzheyuan <fangzheyuan@bytedance.com>
lawangle added a commit to lawangle/sdk that referenced this issue Jul 5, 2022
`Dedup optimization` will remove duplicated Code object and keep one instance.
When building deferred components, the only Code object (e.x. as callee B) maybe
exist in different loading unit from the caller A. This will cause a rellocation
bug if A->B was a relative call.

Extract `LoadingUnitOf` function from flow graph compiler.
When working with dedup and deferred components, Code object from different unit is unequal.

TEST=vm/dart{_2}/regress_49372
Issues: dart-lang#49372

Signed-off-by: fangzheyuan <fangzheyuan@bytedance.com>
lawangle added a commit to lawangle/sdk that referenced this issue Jul 5, 2022
`Dedup optimization` will remove duplicated Code object and keep one instance.
When building deferred components, the only Code object (e.x. as callee B) maybe
exist in different loading unit from the caller A. This will cause a rellocation
bug if A->B was a relative call.

Extract `LoadingUnitOf` function from flow graph compiler.
When working with dedup and deferred components, Code object from different unit is unequal.

TEST=vm/dart{_2}/regress_49372
Issues: dart-lang#49372

Signed-off-by: fangzheyuan <fangzheyuan@bytedance.com>
copybara-service bot pushed a commit that referenced this issue Jul 6, 2022
Closes #49393

TEST=vm/dart{,_2}/regress_49372

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try
GitOrigin-RevId: c6306f9
Bug: #49372
Change-Id: I7ec4b170819321cb74037e475006890259446744
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250720
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
@mraleph
Copy link
Member

mraleph commented Jul 6, 2022

This should be fixed now. Thanks for the contribution @lawangle!

@mraleph mraleph closed this as completed Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

3 participants