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

Android/cronet + NativeAdapter = "Too many receivers, total of 1000, registered" #2300

Open
corepuncher opened this issue Sep 24, 2024 · 1 comment
Labels
h: need extra help Extra help is needed p: native_dio_adapter Targeting `native_dio_adapter` package platform: io s: bug Something isn't working

Comments

@corepuncher
Copy link

corepuncher commented Sep 24, 2024

Package

native_dio_adapter

Version

1.3.0

Operating-System

Android

Adapter

NativeAdapter

Output of flutter doctor -v

[√] Flutter (Channel stable, 3.24.2, on Microsoft Windows [Version 10.0.22621.4037], locale en-US)
    • Flutter version 3.24.2 on channel stable at C:\Flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4cf269e36d (3 weeks ago), 2024-09-03 14:30:00
    • Engine revision a6bd3f1de1
    • Dart version 3.5.2
    • DevTools version 2.37.2

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:...\AppData\Local\Android\sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.10.3)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.10.35013.160
    • Windows 10 SDK version 10.0.22000.0

[√] Android Studio (version 2023.2)
    • Android Studio at C:\Program Files\Android\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.9+0--11185874)

[√] VS Code (version 1.93.1)
    • VS Code at C:...\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.96.0

[√] Connected device (5 available)
    • SM X910 (mobile)   • 192.168.1.XXXX • android-arm64  • Android 14 (API 34)
    • SM S916U1 (mobile) • 192.168.1.XXXX • android-arm64  • Android 14 (API 34)
    • Windows (desktop)  • windows             • windows-x64    • Microsoft Windows [Version
      10.0.22621.4037]

[√] Network resources
    • All expected network resources are available.

• No issues found!

Dart Version

3.5.2

Steps to Reproduce

When using a map tiler (flutter map) with many tile layers, a limit is reached regarding "Broadcast Receivers" for Android when using NativeAdapter().

"Too many receivers, total of 1000, registered"

So I guess to reproduce, just request too many files over a network in a short period.

Expected Result

All network requests should be honored when using the NativeAdapter packge.

NOTE: if I do NOT use NativeAdapter, and just http, everything works fine for Android. However, the network requests are not as fast as with cronet, so I would rather have NativeAdapter adjusted to allow for > 1000. Or, if you could provide me with a method to "Unregister" or prevent these receivers, that would be great!

Actual Result

java.lang.IllegalStateException: Too many receivers, total of 1000, registered for pid: 27102, callerPackage: com.asdf.asdf
E/cr_JniAndroid(27102): at android.os.Parcel.createExceptionOrNull(Parcel.java:3077)
E/cr_JniAndroid(27102): at android.os.Parcel.createException(Parcel.java:3053)
E/cr_JniAndroid(27102): at android.os.Parcel.readException(Parcel.java:3036)
E/cr_JniAndroid(27102): at android.os.Parcel.readException(Parcel.java:2978)
E/cr_JniAndroid(27102): at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:6157)
E/cr_JniAndroid(27102): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1913)
E/cr_JniAndroid(27102): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1860)
E/cr_JniAndroid(27102): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:791)
E/cr_JniAndroid(27102): at m.ha.c(:com.google.android.gms.dynamite_cronetdynamite@[email protected] (190400-0):7)
E/cr_JniAndroid(27102): at m.ha.a(:com.google.android.gms.dynamite_cronetdynamite@[email protected] (190400-0):2)
E/cr_JniAndroid(27102): at org.chromium.net.ProxyChangeListener.start(:com.google.android.gms.dynamite_cronetdynamite@[email protected] (190400-0):56)
E/cr_JniAndroid(27102): at J.N.M6Dz0nZ5(Native Method)
E/cr_JniAndroid(27102): at m.lv.run(:com.google.android.gms.dynamite_cronetdynamite@[email protected] (190400-0):10)
E/cr_JniAndroid(27102): at android.os.Handler.handleCallback(Handler.java:958)
E/cr_JniAndroid(27102): at android.os.Handler.dispatchMessage(Handler.java:99)
E/cr_JniAndroid(27102): at android.os.Looper.loopOnce(Looper.java:230)
E/cr_JniAndroid(27102): at android.os.Looper.loop(Looper.java:319)
E/cr_JniAndroid(27102): at android.os.HandlerThread.run(HandlerThread.java:67)
E/cr_JniAndroid(27102): Caused by: android.os.RemoteException: Remote stack trace:
E/cr_JniAndroid(27102): at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:16762)
E/cr_JniAndroid(27102): at android.app.IActivityManager$Stub.onTransact$registerReceiverWithFeature$(IActivityManager.java:11613)
E/cr_JniAndroid(27102): at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2961)
E/cr_JniAndroid(27102): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3199)
E/cr_JniAndroid(27102): at android.os.Binder.execTransactInternal(Binder.java:1375)
E/cr_JniAndroid(27102):
E/AndroidRuntime(27102): FATAL EXCEPTION: CronetInit
E/AndroidRuntime(27102): Process: com.asdf.asdf, PID: 27102
E/AndroidRuntime(27102): m.hg: Native stack trace:
E/AndroidRuntime(27102):
E/AndroidRuntime(27102): at org.chromium.base.JniAndroid.handleException(:com.google.android.gms.dynamite_cronetdynamite@[email protected] (190400-0):10)
E/AndroidRuntime(27102): at J.N.M6Dz0nZ5(Native Method)
E/AndroidRuntime(27102): at m.lv.run(:com.google.android.gms.dynamite_cronetdynamite@[email protected] (190400-0):10)
E/AndroidRuntime(27102): at android.os.Handler.handleCallback(Handler.java:958)
E/AndroidRuntime(27102): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(27102): at android.os.Looper.loopOnce(Looper.java:230)
E/AndroidRuntime(27102): at android.os.Looper.loop(Looper.java:319)
E/AndroidRuntime(27102): at android.os.HandlerThread.run(HandlerThread.java:67)
E/AndroidRuntime(27102): Caused by: java.lang.IllegalStateException: Too many receivers, total of 1000, registered for pid: 27102, callerPackage: com.asdf.asdf
E/AndroidRuntime(27102): at android.os.Parcel.createExceptionOrNull(Parcel.java:3077)
E/AndroidRuntime(27102): at android.os.Parcel.createException(Parcel.java:3053)
E/AndroidRuntime(27102): at android.os.Parcel.readException(Parcel.java:3036)
E/AndroidRuntime(27102): at android.os.Parcel.readException(Parcel.java:2978)
E/AndroidRuntime(27102): at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:6157)
E/AndroidRuntime(27102): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1913)
E/AndroidRuntime(27102): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1860)
E/AndroidRuntime(27102): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:791)
E/AndroidRuntime(27102): at m.ha.c(:com.google.android.gms.dynamite_cronetdynamite@[email protected] (190400-0):7)
E/AndroidRuntime(27102): at m.ha.a(:com.google.android.gms.dynamite_cronetdynamite@[email protected] (190400-0):2)
E/AndroidRuntime(27102): at org.chromium.net.ProxyChangeListener.start(:com.google.android.gms.dynamite_cronetdynamite@[email protected] (190400-0):56)
E/AndroidRuntime(27102): ... 7 more
E/AndroidRuntime(27102): Caused by: android.os.RemoteException: Remote stack trace:
E/AndroidRuntime(27102): at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:16762)
E/AndroidRuntime(27102): at android.app.IActivityManager$Stub.onTransact$registerReceiverWithFeature$(IActivityManager.java:11613)
E/AndroidRuntime(27102): at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2961)
E/AndroidRuntime(27102): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3199)
E/AndroidRuntime(27102): at android.os.Binder.execTransactInternal(Binder.java:1375)

@corepuncher corepuncher added h: need triage This issue needs to be categorized s: bug Something isn't working labels Sep 24, 2024
@AlexV525
Copy link
Member

Hi @brianquinlan. Are you familiar with related restrictions?

@AlexV525 AlexV525 added h: need extra help Extra help is needed p: native_dio_adapter Targeting `native_dio_adapter` package platform: io and removed h: need triage This issue needs to be categorized labels Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
h: need extra help Extra help is needed p: native_dio_adapter Targeting `native_dio_adapter` package platform: io s: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants