GithubHelp home page GithubHelp logo

Comments (20)

atrope avatar atrope commented on August 28, 2024

@brianquinlan do you have any ideia what it could be?

from http.

brianquinlan avatar brianquinlan commented on August 28, 2024

I've done some investigation but didn't find anything obvious.

Could you tell me more about how your code is structured? Do you create many CronetClients? Do you close them? Do they share one CronetEngine? Do you make large numbers of concurrent requests (e.g. to download images)? etc?

from http.

brianquinlan avatar brianquinlan commented on August 28, 2024

Here is the failing code: https://chromium.googlesource.com/chromium/src/+/0f71a543910198ee5b4104ea0066494a3fcba309/net/android/java/src/org/chromium/net/ProxyChangeListener.java#231

from http.

atrope avatar atrope commented on August 28, 2024

Hey @brianquinlan,
We've been utilizing a single CronetEngine for each download, operating within separate isolates for every download, without closing any of them previously. I'll address this oversight. Although our system supports a high volume of downloads, we maintain a concurrency limit of three, ensuring that a new CronetEngine is initiated only at the start of a download. Consequently, at any given moment, there should be no more than three CronetEngines active within the app.

Do you believe that simply terminating the older engines could resolve the issue? I'm struggling to understand how this adjustment could impact the specific concern you raised.

from http.

brianquinlan avatar brianquinlan commented on August 28, 2024

Hey @atrope

Do you believe that simply terminating the older engines could resolve the issue? I'm struggling to understand how this adjustment could impact the specific concern you raised.

I'm not sure. The stack trace that you sent showed that the exception occurred while Cronet was registering a BroadCastReceiver for the Proxy.PROXY_CHANGE_ACTION.

My hypothesis is that the unregister code isn't being triggered, which eventually causes over a 1000 BroadcastReceivers to be registered. This may be happening because the CronetEngine is not being closed.

I'm going to look at the cronet_http code and see if I can find any places were it is not free resources when it could.

from http.

brianquinlan avatar brianquinlan commented on August 28, 2024

FYI, I have a feature in the works that will make it easier to close CronetEngine if it is associated with one CronetClient:
#1137

from http.

atrope avatar atrope commented on August 28, 2024

Nice, we are now closing so when this is released we will test

from http.

atrope avatar atrope commented on August 28, 2024

@brianquinlan
Here a minimal to reproduce.
https://github.com/SuaMusica/cronet_http_test

Just open the app and click the "Download all" button on the bottom.

it will eventually crash with said errors. if it does not crash, just change the for from 1000 to 1200.
Here it is crashing when it gets to 200~500 downloads.

PS: Just tried your branch and it also crashed

  cronet_http:
    git:
      url: https://github.com/dart-lang/http
      ref: brianquinlan-release_engine
      path: pkgs/cronet_http


E/AndroidRuntime(12507): FATAL EXCEPTION: CronetInit
E/AndroidRuntime(12507): Process: com.example.cronet_test, PID: 12507
E/AndroidRuntime(12507): m.ea: Native stack trace:
E/AndroidRuntime(12507):
E/AndroidRuntime(12507): 	at org.chromium.base.JniAndroid.handleException(:com.google.android.gms.dynamite_cronetdynamite@[email protected] (190400-0):10)
E/AndroidRuntime(12507): 	at J.N.M6Dz0nZ5(Native Method)
E/AndroidRuntime(12507): 	at m.io.run(:com.google.android.gms.dynamite_cronetdynamite@[email protected] (190400-0):13)
E/AndroidRuntime(12507): 	at android.os.Handler.handleCallback(Handler.java:958)
E/AndroidRuntime(12507): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(12507): 	at android.os.Looper.loopOnce(Looper.java:230)
E/AndroidRuntime(12507): 	at android.os.Looper.loop(Looper.java:319)
E/AndroidRuntime(12507): 	at android.os.HandlerThread.run(HandlerThread.java:67)
E/AndroidRuntime(12507): Caused by: java.lang.IllegalStateException: Too many receivers, total of 1000, registered for pid: 12507, callerPackage: com.example.cronet_test
E/AndroidRuntime(12507): 	at android.os.Parcel.createExceptionOrNull(Parcel.java:3077)
E/AndroidRuntime(12507): 	at android.os.Parcel.createException(Parcel.java:3053)
E/AndroidRuntime(12507): 	at android.os.Parcel.readException(Parcel.java:3036)
E/AndroidRuntime(12507): 	at android.os.Parcel.readException(Parcel.java:2978)
E/AndroidRuntime(12507): 	at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:6137)
E/AndroidRuntime(12507): 	at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1913)
E/AndroidRuntime(12507): 	at android.app.ContextImpl.registerReceiver(ContextImpl.java:1860)
E/AndroidRuntime(12507): 	at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:791)
E/AndroidRuntime(12507): 	at m.dw.c(:com.google.android.gms.dynamite_cronetdynamite@[email protected] (190400-0):7)
E/AndroidRuntime(12507): 	at m.dw.a(:com.google.android.gms.dynamite_cronetdynamite@[email protected] (190400-0):2)
E/AndroidRuntime(12507): 	at org.chromium.net.ProxyChangeListener.start(:com.google.android.gms.dynamite_cronetdynamite@[email protected] (190400-0):56)
E/AndroidRuntime(12507): 	... 7 more
E/AndroidRuntime(12507): Caused by: android.os.RemoteException: Remote stack trace:
E/AndroidRuntime(12507): 	at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:16672)
E/AndroidRuntime(12507): 	at android.app.IActivityManager$Stub.onTransact$registerReceiverWithFeature$(IActivityManager.java:11530)
E/AndroidRuntime(12507): 	at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2928)
E/AndroidRuntime(12507): 	at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3195)
E/AndroidRuntime(12507): 	at android.os.Binder.execTransactInternal(Binder.java:1375)
E/AndroidRuntime(12507):
I/Process (12507): Sending signal. PID: 12507 SIG: 9
Lost connection to device.

Exited.

from http.

brianquinlan avatar brianquinlan commented on August 28, 2024

@atrope

Did you modify your code to release the engine i.e. https://github.com/SuaMusica/cronet_http_test/pull/1/files

It did not crash for me with the loop running 2000 times.

from http.

atrope avatar atrope commented on August 28, 2024

Hello @brianquinlan, by setting closeEngine to true, I was able to download 1500 files. I believe this should resolve the issue.

Thank you!

from http.

brianquinlan avatar brianquinlan commented on August 28, 2024

I'll close this issue, thanks for all the help debugging!

from http.

atrope avatar atrope commented on August 28, 2024

@brianquinlan Now that we fixed this one I can see another error coming from using cronet in isolates.

They all Happen in the foreground do you happen to know what could be? I am not able to reproduce. Do I Open a new issue for this one?
Here is one stacktrace:

Thanks!

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 8480 >>> suamusica.suamusicaapp <<<

backtrace:
  #00  pc 0x0000000000006fc0  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libdartjni.so (getMethodID+217) (BuildId: 8c8d5a374f130640e74311fc4f467ef4d837e03a)
  #01  pc 0x00000000007e6674  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #02  pc 0x00000000009d60dc  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #03  pc 0x00000000009d5fcc  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #04  pc 0x00000000009d5f6c  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #05  pc 0x0000000000873748  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #06  pc 0x00000000009d4894  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #07  pc 0x0000000001341b10  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #08  pc 0x000000000148aee0  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #09  pc 0x0000000001341a28  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #10  pc 0x0000000001341624  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #11  pc 0x00000000013415c4  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #12  pc 0x0000000000e29fac  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #13  pc 0x000000000148d7d8  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #14  pc 0x00000000007f320c  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #15  pc 0x00000000007f309c  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #16  pc 0x00000000007f11cc  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #17  pc 0x00000000007f1b04  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #18  pc 0x000000000148dd84  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #19  pc 0x00000000007f042c  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #20  pc 0x000000000148d7d8  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #21  pc 0x00000000007f320c  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #22  pc 0x00000000007f309c  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #23  pc 0x00000000007f11cc  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #24  pc 0x00000000007f1b04  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #25  pc 0x000000000083e588  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #26  pc 0x00000000007f0c78  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #27  pc 0x00000000007f0b84  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #28  pc 0x00000000007f0b54  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #29  pc 0x000000000082f37c  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #30  pc 0x000000000082f32c  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #31  pc 0x00000000007e8638  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libapp.so (BuildId: 7bf2d0b48605b0329eaf42acdd2cc262)
  #32  pc 0x00000000005ff7ab  /data/app/~~eE_N_EGiaH8mhBg8Xedp3A==/suamusica.suamusicaapp-c6iLAP0x1GikkpjemcM_TA==/lib/arm/libflutter.so (BuildId: 40d62f1a02b6396f56425b70354081510133280d)

from http.

atrope avatar atrope commented on August 28, 2024

@flutter-symbolizer-bot #1136 (comment)

from http.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.