novoda / merlin

Observes network connection status & gives callbacks
Other
543 stars 79 forks source link

Crash #194

Closed lasayoub closed 5 years ago

lasayoub commented 5 years ago

here is the crash log

java.lang.IllegalArgumentException: Too many NetworkRequests filed at android.os.Parcel.readException(Parcel.java:1688) at android.os.Parcel.readException(Parcel.java:1637) at android.net.IConnectivityManager$Stub$Proxy.listenForNetwork(IConnectivityManager.java:2425) at android.net.ConnectivityManager.sendRequestForNetwork(ConnectivityManager.java:2871) at android.net.ConnectivityManager.registerNetworkCallback(ConnectivityManager.java:3090) at com.novoda.merlin.ConnectivityChangesRegister.registerNetworkCallbacks(ConnectivityChangesRegister.java:41) at com.novoda.merlin.ConnectivityChangesRegister.register(ConnectivityChangesRegister.java:32) at com.novoda.merlin.MerlinService.start(MerlinService.java:47) at com.novoda.merlin.MerlinService.access$200(MerlinService.java:8) at com.novoda.merlin.MerlinService$LocalBinder.onBindComplete(MerlinService.java:94) at com.novoda.merlin.MerlinServiceBinder$MerlinServiceConnection.onServiceConnected(MerlinServiceBinder.java:86) at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1453) at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1481) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6125) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Mecharyry commented 5 years ago

@lasayoub can you please follow the issue template. Can you also let us know reproduction steps, android version, device this is reproducible on. If you can reproduce this on the demo it would also be very beneficial.

Mecharyry commented 5 years ago

Closing due to lack of information.

javierpe commented 5 years ago

This happen in my app and reported by Crashlytics many times...

Captura de Pantalla 2019-07-08 a la(s) 14 21 06
Mecharyry commented 5 years ago

@javierpe We need reproduction steps in order to be able to help. We would, as a minimum, need to know how you create merlin and when you do the binding etc.

Mecharyry commented 5 years ago

Closing due to lack of information.

ghiyatshanif commented 5 years ago

Hi, I'm also getting this identical crash reports in fabric for my app, this is how I implement merlin in my BaseActivity :

private val merlin by lazy {
        Merlin.Builder()
            .withBindableCallbacks()
            .withConnectableCallbacks()
            .withDisconnectableCallbacks()
            .build(this@BaseActivity)
}

override fun onStart() {
        super.onStart()
        merlin.bind()
        if (shouldObserveConnectivity()) {
            merlin.apply {
                registerBindable(this@BaseActivity)
                registerConnectable(this@BaseActivity)
                registerDisconnectable(this@BaseActivity)
            }
        }
 }

override fun onStop() {
        merlin.unbind()
        super.onStop()
}

and I also have instance of MerlinsBeard in my BaseActivity to check hasInternetAccess()

zegnus commented 5 years ago

@ghiyatshanif @javierpe can you please provide steps to reproduce this issue? without this, we cannot check that any fix that we do actually fixes your problem. You can provide detailed steps or you can also create a sample application that crashes and share it with us, for example with a Github repo.

ghiyatshanif commented 5 years ago

That's the case, to this date, we could't reproduce this issue on our devices, it only affect small numbers of our users tho. I'll let you guys know if I finally could reproduce the issue

Mecharyry commented 5 years ago

@ghiyatshanif Where is merlin created in your app? Is it single instance?

ghiyatshanif commented 5 years ago

@Mecharyry it's created in the BaseActivity and it's not single instance, it creates new instance for each activity

Mecharyry commented 5 years ago

Thanks @ghiyatshanif, we've had a couple of issues related to using multiple instances of Merlin, I thought we had updated the docs to recommend using single instance but apparently not -> https://github.com/novoda/merlin/issues/163#issuecomment-375226654

ghiyatshanif commented 5 years ago

I see, we'll try to update our code, and see if the report persist, we'll get back to you with the update.

ghiyatshanif commented 5 years ago

Hi guys, it's a positive update, it's been 3 weeks since I reported this issue, and so far, we're not getting any more reports regarding this. we changed our way of implementing Merlin, so instead of creating new instance in each activity we only use a Singleton provided by our dependency injection library.

single {
            Merlin.Builder()
                .withBindableCallbacks()
                .withConnectableCallbacks()
                .withDisconnectableCallbacks()
                .build(get())
        }
zegnus commented 5 years ago

nice! glad that it works, thanks for posting the update