Repository navigation
ValueNotifier not disposed when dragging cupertino text field #135803
Copy link
Copy link
Closed
Labels
a: leak trackingIssues and PRs related to memory leaks detected by leak_trackerIssues and PRs related to memory leaks detected by leak_trackerr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
- remove
notDisposedAllowListfrom the testCan double tap + drag to select word by wordintest/cupertino/text_field_test.dart`. - See test reporting one undisposed
ValueNotifier<_OverlayEntryWidgetState?>
PR that adds leak tracking for said test: #135804
Expected results
The Cupertino text field should not leak.
Actual results
The test fails
notDisposed:
total: 1
objects:
ValueNotifier<_OverlayEntryWidgetState?>:
test: Can double tap + drag to select word by word
identityHashCode: 823061609Code sample
Other tests that would fail when converted with testWidgetsWithLeakTracking:
Can move cursor when dragging, when tap is on collapsed selection (iOS) - multilineCan move cursor when dragging, when tap is on collapsed selection (iOS)Can move cursor when dragging (Android)
This leads me to believe the issue is related to dragging on the text field.
Flutter Doctor output
Doctor output
[!] Flutter (Channel [user-branch], 3.14.0-14.0.pre.461, on Garuda Linux 6.5.4-zen2-1-zen, locale en_US.UTF-8)
! Flutter version 3.14.0-14.0.pre.461 on channel [user-branch] at /home/derdilla/Coding/Flutter/flutter/flutter/flutter
Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
! Upstream repository https://github.com/NobodyForNothing/flutter is not a standard remote.
Set environment variable "FLUTTER_GIT_URL" to https://github.com/NobodyForNothing/flutter to dismiss this error.
• Framework revision 2cc47574a9 (6 days ago), 2023-09-24 19:28:57 +0200
• Engine revision e4bfdc1a67
• Dart version 3.2.0 (build 3.2.0-190.0.dev)
• DevTools version 2.28.0-dev.12
• 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-rc3)
• Android SDK at /home/derdilla/Android/Sdk
• Platform android-34, build-tools 34.0.0-rc3
• ANDROID_HOME = /home/derdilla/Android/Sdk
• Java binary at: /home/derdilla/bin/apps/android-studio/jbr/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• CHROME_EXECUTABLE = /usr/bin/chromium
[✓] Linux toolchain - develop for Linux desktop
• clang version 16.0.6
• cmake version 3.27.6
• ninja version 1.11.1
• pkg-config version 1.8.1
[✓] Android Studio (version 2023.1)
• Android Studio at /home/derdilla/bin/apps/android-studio
• 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
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
[✓] Android Studio (version 2022.3)
• Android Studio at /home/derdilla/.local/share/JetBrains/Toolbox/apps/android-studio
• 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
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.2)
• IntelliJ at /home/derdilla/.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate
• Flutter plugin version 75.1.4
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • Garuda Linux 6.5.4-zen2-1-zen
• Chrome (web) • chrome • web-javascript • Chromium 117.0.5938.132 Arch Linux
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
a: leak trackingIssues and PRs related to memory leaks detected by leak_trackerIssues and PRs related to memory leaks detected by leak_trackerr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Activity
huycozy commentedon Oct 2, 2023
Hi @NobodyForNothing
I can reproduce this on the latest stable but it seems to be fixed on master as the linked PR has been merged, right? If so, is this safe to close?
flutter doctor -v (stable and master)
[✓] Flutter (Channel stable, 3.13.6, on macOS 14.0 23A344 darwin-x64, locale en-VN) • Flutter version 3.13.6 on channel stable at /Users/huynq/Documents/GitHub/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision ead455963c (5 days ago), 2023-09-26 18:28:17 -0700 • Engine revision a794cf2681 • Dart version 3.1.3 • DevTools version 2.25.0 [✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0) • Android SDK at /Users/huynq/Library/Android/sdk • Platform android-34, build-tools 32.0.0 • ANDROID_HOME = /Users/huynq/Library/Android/sdk • Java binary at: /Applications/Android Studio Giraffe.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.0) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15A240d • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.3) • Android Studio at /Applications/Android Studio Giraffe.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 • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) [✓] Android Studio (version 2022.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 • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) [✓] VS Code (version 1.82.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.72.0 [✓] Connected device (2 available) • macOS (desktop) • macos • darwin-x64 • macOS 14.0 23A344 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 117.0.5938.132 [✓] Network resources • All expected network resources are available. • No issues found!derdilla commentedon Oct 2, 2023
The linked PR does not fix the issue. It only marks the leak, the issue still persists when you remove the notDisposedAllowlist.
My reason for adding the allow list was to ensure no further leaks occur.
huycozy commentedon Oct 2, 2023
Could you share the modified test to reveal the leak? I ran the below test but can't reproduce it:
Sample test
derdilla commentedon Oct 2, 2023
Test code
huycozy commentedon Oct 2, 2023
Thanks but your given test is successful on the latest master channel (
3.15.0-13.0.pre.40). Can you retry on master channel?ksokolovskyi commentedon Oct 2, 2023
Hi @huycozy.
Please try to run the test from the terminal:
flutter test 'test/cupertino/text_field_test.dart'.ksokolovskyi commentedon Oct 2, 2023
@polina-c, do you know why running a test from IDE doesn't reveal the leak, but running from the terminal does?
cupertino_text_field_test_leak.1.mp4
polina-c commentedon Oct 2, 2023
Good question. Do you have latest version of flutter and latest version of leak_tracker?
Try to run flutter -update-packages.
I recently issued fix to make leak detection less flaky.
Another thing: running from IDE may say the test passed, but then show failure for tearDownAll.
Leak collection happens for all tests together in tearDownAll for performance goals.
ksokolovskyi commentedon Oct 3, 2023
Yep, I have the latest version of the dependencies.
Running all tests together from the IDE reveals the leak. But it is strange that IDE highlights the wrong test.
leak_tracked_tests.mp4
droidbg commentedon Oct 14, 2023
@polina-c I am also not able to see the leaks while running from android studio ide.
Screen.Recording.2023-10-14.at.5.55.58.PM.mov
polina-c commentedon Oct 14, 2023
@ksokolovskyi , @droidbg
Flakiness is a bad thing, because it means bots may eventually start failing for master branch, when tests are randomized in a certain way.
To start working on the problem, we need repro steps that do not involve IDE, command line only.
If we could find them, it would be reason to create a separate issue.
For experiments you can use parameter
--plain-nameto run just one test.Or you can use parameter
--test-randomize-ordering-seed=20230817, passing different dates.github-actions commentedon Oct 28, 2023
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
flutter doctor -vand a minimal reproduction of the issue.