Skip to content

ANRs because of ListBase.removeWhere or ListBase.firstWhere on Android after upgrading to 3.32.1 #170055

Open
@Tom3652

Description

@Tom3652

Steps to reproduce

After upgrading from 3.29.3 to 3.32.1 i have started to see multiple ANRs reports in crashlytics, especially from ListBase.removeWhere or ListBase.firstWhere and more precisely _StringBase._interpolate :

Here is a sample of the StackTrace :

#06 pc 0x3c4048 split_config.arm64_v8a.apk (stub CallBootstrapNative + 16384) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#07 pc 0xde8368 split_config.arm64_v8a.apk (Object.toString [object_patch.dart:29]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#08 pc 0x3cdbe0 split_config.arm64_v8a.apk (_StringBase._interpolate [string_patch.dart:915]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#09 pc 0x8c733c split_config.arm64_v8a.apk (Folder.uid [folder.dart:8]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#10 pc 0x8d1e18 split_config.arm64_v8a.apk (FolderViewModel._addFoldersForHour.<anonymous closure> [folder_view_model.dart:1093]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#11 pc 0x436280 split_config.arm64_v8a.apk (ListBase._filter [list.dart:293]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#12 pc 0x436174 split_config.arm64_v8a.apk (ListBase.removeWhere [list.dart:281]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)

I have another similar trace with DateTime objects :

#02 pc 0x3c4048 split_config.arm64_v8a.apk (stub CallBootstrapNative + 16384) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#03 pc 0xcefc30 split_config.arm64_v8a.apk (DateTime._timeZoneOffsetInSecondsForClampedSeconds [date_patch.dart:21]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#04 pc 0x408930 split_config.arm64_v8a.apk (DateTime._timeZoneOffsetInSeconds [date_patch.dart:510]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#05 pc 0x408e18 split_config.arm64_v8a.apk (DateTime._localDateInUtcMicros [date_patch.dart:324]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#06 pc 0x40898c split_config.arm64_v8a.apk (DateTime._parts [date_patch.dart:255]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#07 pc 0x8d21d0 split_config.arm64_v8a.apk (FolderViewModel._addFoldersForHour.<anonymous closure> [date_patch.dart:290]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#08 pc 0x6d55a4 split_config.arm64_v8a.apk (ListBase.firstWhere [list.dart:126]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)

But the common part is the ListBase.firstWhere and here this compares millisecondsSinceEpoch values.

In my app of course i am running some algorithms with several for loops within each of them there are ListBase.removeWhere or ListBase.firstWhere called to compare String (the folder.uid which is my object).

The algorithms are 2-3 for loops inside each other and running among maybe 1millions of items.
I am raising an issue because on 3.29.3 there were no issues and suddenly (maybe with a new Dart SDK update) it starts to be slower and generates ANRs events.

Expected results

The app should not be in "ANR" state -> should respond immediately like on 3.29.3.

Actual results

ANRs are occurring

Code sample

Code sample

I am current running a sample code to try to reproduce it locally to match my algorithms

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
main (native):tid=1 systid=24616 
#00 pc 0xc2114 libc.so (__vfprintf + 4324) (BuildId: 6e6d388a18e01218afe76eed8954f27f)
#01 pc 0x82d00 libc.so (vsnprintf + 192) (BuildId: 6e6d388a18e01218afe76eed8954f27f)
#02 pc 0x9112cc split_config.arm64_v8a.apk + 14860288 (BuildId: 2c0bd20296bfcbf70a9b1f8a745bd75c64897220)
#03 pc 0x911280 split_config.arm64_v8a.apk + 14860288 (BuildId: 2c0bd20296bfcbf70a9b1f8a745bd75c64897220)
#04 pc 0x87bf00 split_config.arm64_v8a.apk + 14860288 (BuildId: 2c0bd20296bfcbf70a9b1f8a745bd75c64897220)
#05 pc 0x8c5198 split_config.arm64_v8a.apk + 14860288 (BuildId: 2c0bd20296bfcbf70a9b1f8a745bd75c64897220)
#06 pc 0x3c4048 split_config.arm64_v8a.apk (stub CallBootstrapNative + 16384) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#07 pc 0xde8368 split_config.arm64_v8a.apk (Object.toString [object_patch.dart:29]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#08 pc 0x3cdbe0 split_config.arm64_v8a.apk (_StringBase._interpolate [string_patch.dart:915]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#09 pc 0x8c733c split_config.arm64_v8a.apk (Folder.uid [folder.dart:8]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#10 pc 0x8d1e18 split_config.arm64_v8a.apk (FolderViewModel._addFoldersForHour.<anonymous closure> [folder_view_model.dart:1093]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#11 pc 0x436280 split_config.arm64_v8a.apk (ListBase._filter [list.dart:293]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#12 pc 0x436174 split_config.arm64_v8a.apk (ListBase.removeWhere [list.dart:281]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#13 pc 0x8d1c58 split_config.arm64_v8a.apk (FolderViewModel._addFoldersForHour [folder_view_model.dart:1093]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#14 pc 0x8d0888 split_config.arm64_v8a.apk (FolderViewModel._computeFolderOrder [folder_view_model.dart:968]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#15 pc 0xd5ba84 split_config.arm64_v8a.apk (FolderViewModel.fetch14DaysFolders [folder_view_model.dart:345]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#16 pc 0xe0ca34 split_config.arm64_v8a.apk (_SuspendState._createAsyncStarCallback.<anonymous closure> [async_patch.dart:407]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#17 pc 0xce92e8 split_config.arm64_v8a.apk (_FutureListener.handleValue [zone.dart:1849]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#18 pc 0xce916c split_config.arm64_v8a.apk (Future._propagateToListeners.handleValueCallback [future_impl.dart:932]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#19 pc 0x3dd44c split_config.arm64_v8a.apk (Future._propagateToListeners [future_impl.dart:961]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#20 pc 0x3dd0d0 split_config.arm64_v8a.apk (Future._completeWithValue [future_impl.dart:712]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#21 pc 0xcded90 split_config.arm64_v8a.apk (_SuspendState._returnAsyncNotFuture [async_patch.dart:391]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#22 pc 0xceaa7c split_config.arm64_v8a.apk (stub _iso_stub_ReturnAsyncNotFutureStub + 16384) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#23 pc 0xe0ca34 split_config.arm64_v8a.apk (_SuspendState._createAsyncStarCallback.<anonymous closure> [async_patch.dart:407]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#24 pc 0xce92e8 split_config.arm64_v8a.apk (_FutureListener.handleValue [zone.dart:1849]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#25 pc 0xce916c split_config.arm64_v8a.apk (Future._propagateToListeners.handleValueCallback [future_impl.dart:932]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#26 pc 0x3dd44c split_config.arm64_v8a.apk (Future._propagateToListeners [future_impl.dart:961]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#27 pc 0x3dd0d0 split_config.arm64_v8a.apk (Future._completeWithValue [future_impl.dart:712]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#28 pc 0xcded90 split_config.arm64_v8a.apk (_SuspendState._returnAsyncNotFuture [async_patch.dart:391]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#29 pc 0xceaa7c split_config.arm64_v8a.apk (stub _iso_stub_ReturnAsyncNotFutureStub + 16384) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#30 pc 0xe0ca34 split_config.arm64_v8a.apk (_SuspendState._createAsyncStarCallback.<anonymous closure> [async_patch.dart:407]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#31 pc 0xce92e8 split_config.arm64_v8a.apk (_FutureListener.handleValue [zone.dart:1849]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#32 pc 0xce916c split_config.arm64_v8a.apk (Future._propagateToListeners.handleValueCallback [future_impl.dart:932]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#33 pc 0x3dd44c split_config.arm64_v8a.apk (Future._propagateToListeners [future_impl.dart:961]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#34 pc 0x3dd0d0 split_config.arm64_v8a.apk (Future._completeWithValue [future_impl.dart:712]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#35 pc 0xcded90 split_config.arm64_v8a.apk (_SuspendState._returnAsyncNotFuture [async_patch.dart:391]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#36 pc 0xceaa7c split_config.arm64_v8a.apk (stub _iso_stub_ReturnAsyncNotFutureStub + 16384) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#37 pc 0xe0ca34 split_config.arm64_v8a.apk (_SuspendState._createAsyncStarCallback.<anonymous closure> [async_patch.dart:407]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#38 pc 0xce92e8 split_config.arm64_v8a.apk (_FutureListener.handleValue [zone.dart:1849]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#39 pc 0xce916c split_config.arm64_v8a.apk (Future._propagateToListeners.handleValueCallback [future_impl.dart:932]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#40 pc 0x3dd44c split_config.arm64_v8a.apk (Future._propagateToListeners [future_impl.dart:961]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#41 pc 0x3dd0d0 split_config.arm64_v8a.apk (Future._completeWithValue [future_impl.dart:712]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#42 pc 0x3dd03c split_config.arm64_v8a.apk (Future._asyncCompleteWithValue.<anonymous closure> [future_impl.dart:792]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#43 pc 0x3dcd78 split_config.arm64_v8a.apk (_microtaskLoop [schedule_microtask.dart:40]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#44 pc 0xce8594 split_config.arm64_v8a.apk (_startMicrotaskLoop [schedule_microtask.dart:49]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#45 pc 0x3dcce8 split_config.arm64_v8a.apk (_startMicrotaskLoop [schedule_microtask.dart:44]) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#46 pc 0x3c3d3c split_config.arm64_v8a.apk (stub InvokeDartCode + 16384) (BuildId: cde83d0668dcde27ccbd75ad4db8f0b2)
#47 pc 0x8a76b4 split_config.arm64_v8a.apk + 14860288 (BuildId: 2c0bd20296bfcbf70a9b1f8a745bd75c64897220)
#48 pc 0x9ed558 split_config.arm64_v8a.apk + 14860288 (BuildId: 2c0bd20296bfcbf70a9b1f8a745bd75c64897220)
#49 pc 0x809f50 split_config.arm64_v8a.apk + 14860288 (BuildId: 2c0bd20296bfcbf70a9b1f8a745bd75c64897220)
#50 pc 0x4ae814 split_config.arm64_v8a.apk + 14860288 (BuildId: 2c0bd20296bfcbf70a9b1f8a745bd75c64897220)
#51 pc 0x4b23f8 split_config.arm64_v8a.apk + 14860288 (BuildId: 2c0bd20296bfcbf70a9b1f8a745bd75c64897220)
#52 pc 0x13e4c libutils.so (android::Looper::pollOnce + 668) (BuildId: 6b95583a1502170133944ea8fd3f0f65)
#53 pc 0x199a5c libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce + 44) (BuildId: eddc5c163c76f6b99fa408e7d8840a1f)
       at android.os.MessageQueue.nativePollOnce(Native method)
       at android.os.MessageQueue.next(MessageQueue.java:355)
       at android.os.Looper.loopOnce(Looper.java:203)
       at android.os.Looper.loop(Looper.java:337)
       at android.app.ActivityThread.main(ActivityThread.java:9504)
       at java.lang.reflect.Method.invoke(Native method)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:636)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1005)

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.32.1, on macOS 15.5 24F74 darwin-x64, locale fr-FR) [2,6s]
    • Flutter version 3.32.1 on channel stable at /Users/foxtom/Desktop/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b25305a883 (7 days ago), 2025-05-29 10:40:06 -0700
    • Engine revision 1425e5e9ec
    • Dart version 3.8.1
    • DevTools version 2.45.1

[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [6,1s]
    • Android SDK at /Users/foxtom/Library/Android/sdk
    • Platform android-36, build-tools 36.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13368085-b895.109)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.4) [6,4s]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16F6
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [39ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.3) [38ms]
    • 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 21.0.6+-13368085-b895.109)

[✓] VS Code (version 1.100.3) [33ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (4 available) [7,1s]
    • Now You See Me (wireless) (mobile) • 00008020-001204401E78002E • ios            • iOS 18.5 22F76
    • macOS (desktop)                    • macos                     • darwin-x64     • macOS 15.5 24F74
      darwin-x64
    • Chrome (web)                       • chrome                    • web-javascript • Google Chrome
      137.0.7151.69

[✓] Network resources [1 232ms]
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: productionIssues experienced in live production appsc: crashStack traces logged to the consoleneeds repro infoAutomated crash report whose cause isn't yet knownplatform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions