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

[go_router] Fix some leaks discovered by leak_tracker_flutter_testing #6210

Merged
merged 18 commits into from
Mar 15, 2024

Conversation

ValentinVignal
Copy link
Contributor

@ValentinVignal ValentinVignal commented Feb 27, 2024

Fix some memory issues discovered by leak_tracker_flutter_testing.
Activation of leak_tracker_flutter_testing in the tests to detect memory leak issues is not feasible yet, because of leaks in Flutter stable.

cc @polina-c

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@ValentinVignal
Copy link
Contributor Author

@polina-c Is there an issue to link this PR to?

@ValentinVignal
Copy link
Contributor Author

Because go_router depends on flutter_test from sdk which depends on leak_tracker_flutter_testing 3.0.3, leak_tracker_flutter_testing 3.0.3 is required.
So, because go_router depends on leak_tracker_flutter_testing ^2.0.1, version solving failed.

But leak_tracker_flutter_testing ^2.0.1 is the version available on stabe. @polina-c how can I make it work?

@polina-c
Copy link

polina-c commented Feb 27, 2024

Because go_router depends on flutter_test from sdk which depends on leak_tracker_flutter_testing 3.0.3, leak_tracker_flutter_testing 3.0.3 is required.
So, because go_router depends on leak_tracker_flutter_testing ^2.0.1, version solving failed.

But leak_tracker_flutter_testing ^2.0.1 is the version available on stabe. @polina-c how can I make it work?

Will investigate. Thank you. Converted the PR to draft for now.

@polina-c polina-c marked this pull request as draft February 27, 2024 16:58
@polina-c
Copy link

polina-c commented Feb 27, 2024

Because go_router depends on flutter_test from sdk which depends on leak_tracker_flutter_testing 3.0.3, leak_tracker_flutter_testing 3.0.3 is required.
So, because go_router depends on leak_tracker_flutter_testing ^2.0.1, version solving failed.

But leak_tracker_flutter_testing ^2.0.1 is the version available on stabe. @polina-c how can I make it work?

Will investigate. Thank you. Converted the PR to draft for now.

Okay, it should be leak_tracker_flutter_testing: any in pubspec.yaml to pick up the version of leak tracker from sdk. Thanks for raising this. I will update documentation.

@ValentinVignal
Copy link
Contributor Author

Great thank you! I changed it in chore: Use any version for leak_tracker_flutter_testing

@ValentinVignal ValentinVignal marked this pull request as ready for review February 28, 2024 02:54
@polina-c
Copy link

I see tests are failing. And they are failing because of leaks. And many of them are originated by flutter itself.

For example, leaking "_NotAnnounced" was cleaned up this week in Flutter master.

It seems packages that use stable should not be early adopters of leak tracker. So, let's shelve this PR till leak_tracker is released and recommended for stable.

Thank you for the experiment. It helped:

  1. To understand go_router has leaks.
  2. To document that version should be any.

Converting this to draft.

@polina-c polina-c marked this pull request as draft February 28, 2024 22:26
@ValentinVignal
Copy link
Contributor Author

@chunhtai what do you want me to do? Maybe I can remove leak_tracker_flutter_testing from the pubspec.yaml and revert the flutter_test_config.dart but keep the changes to prepare for when leak_tracker_flutter_testing can be used ?

@polina-c
Copy link

@chunhtai what do you want me to do? Maybe I can remove leak_tracker_flutter_testing from the pubspec.yaml and revert the flutter_test_config.dart but keep the changes to prepare for when leak_tracker_flutter_testing can be used ?

Yes, I like it: to merge fixes, while postponing regression testing. @chunhtai, how does it sound for you?

@polina-c
Copy link

polina-c commented Mar 6, 2024

@chunhtai what do you want me to do? Maybe I can remove leak_tracker_flutter_testing from the pubspec.yaml and revert the flutter_test_config.dart but keep the changes to prepare for when leak_tracker_flutter_testing can be used ?

Yes, I like it: to merge fixes, while postponing regression testing. @chunhtai, how does it sound for you?

chunhtai is unavailable at the moment
I think we can proceed with merging the change.

@ValentinVignal ValentinVignal marked this pull request as ready for review March 7, 2024 01:36
@ValentinVignal
Copy link
Contributor Author

I removed the leak_tracker_flutter_testing from the pubspec.yaml and revert the flutter_test_config.dart in test: Disable leak tracking

@polina-c
Copy link

polina-c commented Mar 7, 2024

'Linux analyze_legacy N-2' is failing because HeroController did not have method dispose yet.

@johnpryan, is this legacy job fixed forever or we can upgrade it for newer versions of flutter?

Copy link
Contributor

@johnpryan johnpryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@polina-c
Copy link

polina-c commented Mar 7, 2024

'Linux analyze_legacy N-2' is failing because HeroController did not have method dispose yet.

@johnpryan, is this legacy job fixed forever or we can upgrade it for newer versions of flutter?

More information: https://github.com/flutter/packages/blob/main/.ci/legacy_project/README.md

@ValentinVignal, invoked dispose does not exist for this job, that is on Flutter 2.0.6. What is minimal version of Flutter that has this method?
We either need to increase oldest supported version of flutter, or not to add this missing dispose (that may cause memory leaks)

@stuartmorgan, are you right person to help here? Is it ok to stop supporting 2.0.6 and increase minimal supported version a little?

@stuartmorgan
Copy link
Contributor

@stuartmorgan, are you right person to help here? Is it ok to stop supporting 2.0.6 and increase minimal supported version a little?

The earliest version of Flutter that any package in this repo is allowed to support (enforced by CI) is 3.13, so I don't really understand the question.

If N-2 is failing, then the PR doesn't work in 3.13.9. It's fine to drop 3.13 per the wiki, but that's unrelated to 2.0.6.

@polina-c
Copy link

polina-c commented Mar 7, 2024

Thanks.

I took 2.0.6 from https://github.com/flutter/packages/blob/main/.ci/legacy_project/README.md, but now i see it is just very first supported version.

@ValentinVignal
Copy link
Contributor Author

I'm a bit unsure of what I should do, should I stop using HeroController.dispose or should I make a change to the pipeline?

@stuartmorgan
Copy link
Contributor

stuartmorgan commented Mar 8, 2024

I took 2.0.6 from https://github.com/flutter/packages/blob/main/.ci/legacy_project/README.md, but now i see it is just very first supported version.

That's actually unrelated to analyze_legacy; it's for the legacy native build step in android_build_all_packages.

@polina-c
Copy link

polina-c commented Mar 8, 2024

I'm a bit unsure of what I should do, should I stop using HeroController.dispose or should I make a change to the pipeline?

To choose between these two options we need to find out what pipeline change is needed. Then we will decide if this change makes sense or if it is better not to use dispose for now and instead create tech debt issue and leave TODO to dispose when all supported versions of flutter have the dispose. Does it help?

@ValentinVignal
Copy link
Contributor Author

@polina-c After looking at it, it is because HeroControlle.dispose was released in flutter 3.16.x

Is that okay? Or is it too soon?

@@ -5,7 +5,7 @@ publish_to: none

environment:
sdk: ^3.1.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to change this to match (3.2.0), which is why CI is failing.

@polina-c polina-c requested a review from stuartmorgan March 14, 2024 13:38

* Updates minimum supported SDK version to Flutter 3.13/Dart 3.1.
- Updates minimum supported SDK version to Flutter 3.13/Dart 3.1.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer accurate.

Copy link
Contributor Author

@ValentinVignal ValentinVignal Mar 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@polina-c polina-c merged commit 756dcc1 into flutter:main Mar 15, 2024
78 checks passed
@polina-c polina-c changed the title [go_router] Use leak_tracker_flutter_testing [go_router] Fix some leaks discovered by leak_tracker_flutter_testing Mar 15, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 15, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Mar 15, 2024
flutter/packages@b21c542...756dcc1

2024-03-15 [email protected] [go_router] Use `leak_tracker_flutter_testing`  (flutter/packages#6210)
2024-03-15 [email protected] [camera_web][google_maps_flutter] Fix tests throwing errors after test completion with manual roll (flutter/packages#6318)
2024-03-14 [email protected] [pigeon] Fixes double prefixes added to enum names for Objc HostApis and FlutterApis (flutter/packages#6263)
2024-03-14 [email protected] [webview_flutter_android][webview_flutter_wkwebview] Adds platform implementations for onHttpError (flutter/packages#6149)
2024-03-14 [email protected] [image_picker_android] Fix deprecation warnings by branching based on build version, and suppressing only when needed (flutter/packages#6233)
2024-03-14 [email protected] [google_maps_flutter] Started dispatching platform messages from platform thread (flutter/packages#6069)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
arc-yong pushed a commit to Arctuition/packages-arc that referenced this pull request Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants