Skip to content

Conversation

@polina-c
Copy link
Contributor

@polina-c polina-c commented Jun 26, 2024

Introduced by:

#150721
#150661

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: cupertino flutter/packages/flutter/cupertino repository labels Jun 26, 2024
@polina-c polina-c added the a: leak tracking Issues and PRs related to memory leaks detected by leak_tracker label Jun 26, 2024
@polina-c polina-c marked this pull request as ready for review June 26, 2024 00:58
@matthew-carroll
Copy link
Contributor

I'm curious what the leak is here? Those FocusNodes are instantiated within each test. What's leaking outside of the tests?

Copy link
Contributor

@victorsanni victorsanni left a comment

Choose a reason for hiding this comment

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

LGTM

@matthew-carroll
Copy link
Contributor

I see this already got an approval, but without answering my question. Please don't merge this until someone explains what's being leaked in the tests.

@polina-c
Copy link
Contributor Author

polina-c commented Jun 26, 2024

I'm curious what the leak is here? Those FocusNodes are instantiated within each test. What's leaking outside of the tests?

Leak tracker watches that every disposable, created by the test's callback, is disposed. And there is no way for it to detect if the disposable is test-only. There are some huristics to detect a helper method in the testing library, but they are not applicable here.

The focusNode is created inside the test's callback and never disposed. So there is a question if it may be the tested feature created forgot to dispose a disposable.

Does this help?

@polina-c polina-c added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 26, 2024
@matthew-carroll
Copy link
Contributor

So you're saying there's some kind of tracker that's identifying non-leaks as possible leaks?

If so, isn't the better answer to improve that tracker?

Did you look at the specific changes that you made? Were there any actual leaks, or were you just making changes so that the inspector stopped complaining?

@victorsanni
Copy link
Contributor

Ah... Approved before seeing your comment @matthew-carroll. I approved because leak or not I personally think it's good practice to dispose of disposables.

@matthew-carroll
Copy link
Contributor

I approved because leak or not I personally think it's good practice to dispose of disposables.

I think the question is - is there actually an opportunity for leaks? I don't generally think it's a good practice to add code that isn't needed and doesn't solve anything. Otherwise, that code tends to become untouchable because nobody is quite sure why it exists.

So I'm still trying to get an answer to my originally question. Does anyone know if there's actually a single leak in this code?

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 26, 2024
@auto-submit
Copy link
Contributor

auto-submit bot commented Jun 26, 2024

auto label is removed for flutter/flutter/150817, due to - The status or check suite Linux customer_testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@polina-c
Copy link
Contributor Author

polina-c commented Jun 26, 2024

I approved because leak or not I personally think it's good practice to dispose of disposables.

I think the question is - is there actually an opportunity for leaks? I don't generally think it's a good practice to add code that isn't needed and doesn't solve anything. Otherwise, that code tends to become untouchable because nobody is quite sure why it exists.

So I'm still trying to get an answer to my originally question. Does anyone know if there's actually a single leak in this code?

The answer depends on definition of a leak.
For me it is clear why this code exist. There is de-facto rule: if a piece of code creates a disposable object, it should take care about disposing it.

And yes, there is a tool that auto-detects not-disposed objects.

@matthew-carroll
Copy link
Contributor

The answer depends on definition of a leak.
For me it is clear why this code exist. There is de-facto rule: if a piece of code creates disposable object, it should take care about disposing it.

If you're enforcing a standard policy, and you want to keep enforcing it, that's up to you. But no, the definition of a leak isn't amorphous. Either dangling references exist in memory after the test completes, or they don't. Either there is a leak, or there isn't. I haven't seen any comment so far that identifies an actual leak. All I've heard is that there's some tool which automatically flags any objects with a dispose() method for which the dispose() method is not explicitly called in a test. That does not imply a leak.

And yes, there is a tool that auto-detect not-disposed objects.

I would suggest considering an improvement to that tool so that it doesn't refer to a bunch of non-leaks as leaks. And/or I would include a written policy about how every test is expected to work with disposables. If that policy already exists, please feel free to link that here.

@polina-c
Copy link
Contributor Author

polina-c commented Jun 26, 2024

The answer depends on definition of a leak.
For me it is clear why this code exist. There is de-facto rule: if a piece of code creates disposable object, it should take care about disposing it.

If you're enforcing a standard policy, and you want to keep enforcing it, that's up to you. But no, the definition of a leak isn't amorphous. Either dangling references exist in memory after the test completes, or they don't. Either there is a leak, or there isn't. I haven't seen any comment so far that identifies an actual leak. All I've heard is that there's some tool which automatically flags any objects with a dispose() method for which the dispose() method is not explicitly called in a test. That does not imply a leak.

And yes, there is a tool that auto-detect not-disposed objects.

I would suggest considering an improvement to that tool so that it doesn't refer to a bunch of non-leaks as leaks. And/or I would include a written policy about how every test is expected to work with disposables. If that policy already exists, please feel free to link that here.

Yes, leak tracker catches not leaks, but risks of a leak, we are just shortening the phrasing. Even if a test is not leaking, but some objects are not disposed, there can be code paths that create actual leaks.

Leak tracking is configured in the testing root:

LeakTesting.settings = LeakTesting.settings.withIgnored(

For now leak tracking is not blocking. When it gets blocking, failures will give link to the tool with explanation: https://github.com/dart-lang/leak_tracker/blob/main/doc/leak_tracking/OVERVIEW.md

@polina-c polina-c merged commit b958b87 into flutter:master Jun 26, 2024
@polina-c polina-c deleted the clean-tests branch June 26, 2024 04:55
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 27, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 27, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 27, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 28, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jun 28, 2024
Manual roll Flutter from e726eb4 to 15f95ce (48 revisions)

Manual roll requested by [email protected]

flutter/flutter@e726eb4...15f95ce

2024-06-28 [email protected] Roll Flutter Engine from ddd4814b9d40 to 94591ffb20df (5 revisions) (flutter/flutter#150968)
2024-06-27 [email protected] Manual engine roll to ddd4814 (flutter/flutter#150952)
2024-06-27 [email protected] local lint copy gradle task config (flutter/flutter#150957)
2024-06-27 [email protected] Roll Flutter Engine from b42c80460538 to d1506c12808e (3 revisions) (flutter/flutter#150951)
2024-06-27 [email protected] [tool] make the `systemTempDirectory` getter on `ErrorHandlingFileSystem` wrap the underlying filesystem's temp directory in a`ErrorHandlingDirectory` (flutter/flutter#150876)
2024-06-27 [email protected] Have flutter.js load local canvaskit instead of the CDN when appropriate (flutter/flutter#150806)
2024-06-27 [email protected] Roll Flutter Engine from a9194f0f01f4 to b42c80460538 (10 revisions) (flutter/flutter#150940)
2024-06-27 [email protected] [a11y] Reland [#149375 ] Update semantics in dropdown.dart (flutter/flutter#150578)
2024-06-27 [email protected] Bump dartdoc to 8.0.9+1 (flutter/flutter#150935)
2024-06-27 [email protected] add onFocus to text fields (flutter/flutter#150648)
2024-06-27 [email protected] Fixes `flutter build ipa` failure: Command line name "app-store" is deprecated. Use "app-store-connect"  (flutter/flutter#150407)
2024-06-27 [email protected] Copy any previous `IconThemeData` instead of overwriting it in CupertinoButton (flutter/flutter#149777)
2024-06-27 [email protected] Improve the behavior of scrollbar drag-scrolls triggered by the trackpad (flutter/flutter#150275)
2024-06-27 [email protected]  feat: Add autofocus for `MenuItemButton` (flutter/flutter#139396)
2024-06-27 [email protected] Roll Flutter Engine from 1d5e3cc55a75 to a9194f0f01f4 (7 revisions) (flutter/flutter#150888)
2024-06-26 [email protected] Reland "Remove dual_screen from new_gallery integration test" (flutter/flutter#150873)
2024-06-26 [email protected] Switch to more reliable flutter.dev link destinations in the tool (flutter/flutter#150587)
2024-06-26 [email protected] Adding `@docImport`s to the `animation` library (flutter/flutter#150798)
2024-06-26 [email protected] Remove CODEOWNERS trailing whitespace (flutter/flutter#150882)
2024-06-26 [email protected] Roll Flutter Engine from e03cf86c4170 to 1d5e3cc55a75 (3 revisions) (flutter/flutter#150875)
2024-06-26 [email protected] Remind folks we are moving. (flutter/flutter#150872)
2024-06-26 [email protected] Remove `bringup: true` from web test shard. (flutter/flutter#150785)
2024-06-26 [email protected] Roll Flutter Engine from c0017bed42c2 to e03cf86c4170 (1 revision) (flutter/flutter#150867)
2024-06-26 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Remove `dual_screen` from `new_gallery` integration test (#150808)" (flutter/flutter#150871)
2024-06-26 [email protected] Remove `dual_screen` from `new_gallery` integration test (flutter/flutter#150808)
2024-06-26 [email protected] Roll Flutter Engine from d4624a36712b to c0017bed42c2 (4 revisions) (flutter/flutter#150865)
2024-06-26 [email protected] Fixes for Style Guide for Flutter Repo (flutter/flutter#150167)
2024-06-26 [email protected] Roll Flutter Engine from da62c629ed5c to d4624a36712b (3 revisions) (flutter/flutter#150852)
2024-06-26 [email protected] Use `Isolate.packageConfigSync! to locate the packageconfig of flutter tools (flutter/flutter#150340)
2024-06-26 [email protected] Roll Flutter Engine from 25af762ffbb3 to da62c629ed5c (2 revisions) (flutter/flutter#150829)
2024-06-26 [email protected] Fix leaky tests. (flutter/flutter#150817)
2024-06-26 [email protected] Roll Flutter Engine from 94023d711db3 to 25af762ffbb3 (4 revisions) (flutter/flutter#150818)
2024-06-26 [email protected] Roll pub packages (flutter/flutter#150810)
2024-06-25 [email protected] Remove reference to `MaterialApp` and `showCupertinoModalPopup` from `CupertinoAlertDialog` (flutter/flutter#150725)
2024-06-25 [email protected] Read `AndroidManifest.xml` and emit `manifest-impeller-(enabled|disabled)` analytics (flutter/flutter#150791)
2024-06-25 [email protected] [flutter_tools] Shut down Chromium cleanly using a command sent through the debug protocol (flutter/flutter#150645)
2024-06-25 [email protected] Reland fix inputDecorator hint color on M3 (flutter/flutter#150278)
2024-06-25 [email protected] Roll Flutter Engine from 62e0b5f9c340 to 94023d711db3 (7 revisions) (flutter/flutter#150797)
2024-06-25 [email protected] Fix collapsed InputDecorator minimum height (flutter/flutter#150770)
2024-06-25 [email protected] Add more warm up frame docs (flutter/flutter#150464)
2024-06-25 [email protected] Roll pub packages (flutter/flutter#150739)
2024-06-25 [email protected] Add `focusNode`, `focusColor`, `onFocusChange`, `autofocus` to `CupertinoButton` (flutter/flutter#150721)
2024-06-25 [email protected] Document RenderObject._relayoutBoundary and its invariant; small refactors (flutter/flutter#150527)
2024-06-25 [email protected] Roll Flutter Engine from 6313b1e5afd7 to 62e0b5f9c340 (1 revision) (flutter/flutter#150790)
...
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: leak tracking Issues and PRs related to memory leaks detected by leak_tracker f: cupertino flutter/packages/flutter/cupertino repository framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants