jwplayer / jwplayer-react-native

MIT License
32 stars 9 forks source link

[ASK] Android: Unable to stop service com.jwplayer.pub.api.background.MediaService@7f9f93d: java.lang.IllegalArgumentException: Receiver not registered: null #55

Closed Solly74 closed 1 month ago

Solly74 commented 4 months ago

What isn't clear?

RN version: 0.73.4 JW player version: 1.0.1 Platform: Android

Not sure if this is a bug or we've implemented it incorrectly but we're seeing a high number of crashes with the following error on Android: "Unable to stop service com.jwplayer.pub.api.background.MediaService@7f9f93d: java.lang.IllegalArgumentException: Receiver not registered: null"

I looked at the service code and can see the same activity that binds the service also unbinds it but is it possible that the context switches and is unable to unbind it? Do you have a suggestion on how to resolve this?

Jmilham21 commented 4 months ago

Hey @Solly74, could you provide a full stack trace? It'll help with understanding what is causing the crash

Solly74 commented 4 months ago

@Jmilham21

Fatal Exception: java.lang.RuntimeException: Unable to stop service com.jwplayer.pub.api.background.MediaService@e460354: java.lang.IllegalArgumentException: Receiver not registered: null at android.app.ActivityThread.handleStopService(ActivityThread.java:5293) at android.app.ActivityThread.-$$Nest$mhandleStopService() at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2452) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8762) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

Caused by java.lang.IllegalArgumentException: Receiver not registered: null at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:1770) at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1899) at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:829) at com.jwplayer.pub.api.background.MediaService.onDestroy(SourceFile:74) at android.app.ActivityThread.handleStopService(ActivityThread.java:5273) at android.app.ActivityThread.-$$Nest$mhandleStopService() at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2452) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8762) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

ScionFrontendApi: at jdk.internal.misc.Unsafe.park(Unsafe.java) at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:234) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2123) at java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:458) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1062) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1123) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at java.lang.Thread.run(Thread.java:1012)

OkHttp ConnectionPool: at java.lang.Object.wait(Object.java) at com.android.okhttp.ConnectionPool$1.run(ConnectionPool.java:106) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at java.lang.Thread.run(Thread.java:1012)

Firebase Background Thread #3: at jdk.internal.misc.Unsafe.park(Unsafe.java) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1063) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1123) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0$com-google-firebase-concurrent-CustomThreadFactory(CustomThreadFactory.java:47) at com.google.firebase.concurrent.CustomThreadFactory$$ExternalSyntheticLambda0.run(:4) at java.lang.Thread.run(Thread.java:1012)

Firebase Background Thread #0: at jdk.internal.misc.Unsafe.park(Unsafe.java) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1063) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1123) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0$com-google-firebase-concurrent-CustomThreadFactory(CustomThreadFactory.java:47) at com.google.firebase.concurrent.CustomThreadFactory$$ExternalSyntheticLambda0.run(:4) at java.lang.Thread.run(Thread.java:1012)

WM.task-1: at jdk.internal.misc.Unsafe.park(Unsafe.java) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1063) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1123) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at java.lang.Thread.run(Thread.java:1012)

queued-work-looper-data: at jdk.internal.misc.Unsafe.park(Unsafe.java) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1063) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1123) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at java.lang.Thread.run(Thread.java:1012)

awaitEvenIfOnMainThread task continuation executor1: at jdk.internal.misc.Unsafe.park(Unsafe.java) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1063) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1123) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at com.google.firebase.crashlytics.internal.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:67) at com.google.firebase.crashlytics.internal.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:27) at java.lang.Thread.run(Thread.java:1012)

Measurement Worker: at java.lang.Object.wait(Object.java) at java.lang.Object.wait(Object.java:442) at m.ky.run(:com.google.android.gms.dynamite_measurementdynamite@242335039@24.23.35 (190408-0):71)

FinalizerDaemon: at java.lang.Object.wait(Object.java) at java.lang.Object.wait(Object.java:442) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:203) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:224) at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:300) at java.lang.Daemons$Daemon.run(Daemons.java:140) at java.lang.Thread.run(Thread.java:1012)

GmsDynamite: at java.lang.Object.wait(Object.java) at java.lang.Object.wait(Object.java:442) at java.lang.Object.wait(Object.java:568) at com.google.android.gms.dynamite.zza.run(com.google.android.gms:play-services-basement@@18.3.0:2)

Crashlytics Exception Handler1: at dalvik.system.VMStack.getThreadStackTrace(VMStack.java) at java.lang.Thread.getStackTrace(Thread.java:1841) at java.lang.Thread.getAllStackTraces(Thread.java:1909) at com.google.firebase.crashlytics.internal.common.CrashlyticsReportDataCapture.populateThreadsList(CrashlyticsReportDataCapture.java:331) at com.google.firebase.crashlytics.internal.common.CrashlyticsReportDataCapture.populateExecutionData(CrashlyticsReportDataCapture.java:302) at com.google.firebase.crashlytics.internal.common.CrashlyticsReportDataCapture.populateEventApplicationData(CrashlyticsReportDataCapture.java:252) at com.google.firebase.crashlytics.internal.common.CrashlyticsReportDataCapture.captureEventData(CrashlyticsReportDataCapture.java:106) at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.persistEvent(SessionReportingCoordinator.java:279) at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.persistFatalEvent(SessionReportingCoordinator.java:128) at com.google.firebase.crashlytics.internal.common.CrashlyticsController$2.call(CrashlyticsController.java:205) at com.google.firebase.crashlytics.internal.common.CrashlyticsController$2.call(CrashlyticsController.java:190) at com.google.firebase.crashlytics.internal.common.CrashlyticsBackgroundWorker$3.then(CrashlyticsBackgroundWorker.java:105) at com.google.android.gms.tasks.zze.run(com.google.android.gms:play-services-tasks@@18.1.0:1) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at com.google.firebase.crashlytics.internal.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:67) at com.google.firebase.crashlytics.internal.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:27) at java.lang.Thread.run(Thread.java:1012)

com.google.firebase.crashlytics.startup1: at jdk.internal.misc.Unsafe.park(Unsafe.java) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1063) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1123) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at com.google.firebase.crashlytics.internal.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:67) at com.google.firebase.crashlytics.internal.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:27) at java.lang.Thread.run(Thread.java:1012)

WM.task-2: at jdk.internal.misc.Unsafe.park(Unsafe.java) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1063) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1123) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at java.lang.Thread.run(Thread.java:1012)

FinalizerWatchdogDaemon: at java.lang.Object.wait(Object.java) at java.lang.Object.wait(Object.java:442) at java.lang.Object.wait(Object.java:568) at java.lang.Daemons$FinalizerWatchdogDaemon.sleepUntilNeeded(Daemons.java:385) at java.lang.Daemons$FinalizerWatchdogDaemon.runInternal(Daemons.java:365) at java.lang.Daemons$Daemon.run(Daemons.java:140) at java.lang.Thread.run(Thread.java:1012)

queued-work-looper: at android.os.MessageQueue.nativePollOnce(MessageQueue.java) at android.os.MessageQueue.next(MessageQueue.java:335) at android.os.Looper.loopOnce(Looper.java:186) at android.os.Looper.loop(Looper.java:313) at android.os.HandlerThread.run(HandlerThread.java:67)

pool-9-thread-1: at jdk.internal.misc.Unsafe.park(Unsafe.java) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1063) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1123) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at java.lang.Thread.run(Thread.java:1012)

Firebase Blocking Thread #0: at jdk.internal.misc.Unsafe.park(Unsafe.java) at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:234) at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:463) at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:361) at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:939) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1062) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1123) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0$com-google-firebase-concurrent-CustomThreadFactory(CustomThreadFactory.java:47) at com.google.firebase.concurrent.CustomThreadFactory$$ExternalSyntheticLambda0.run(:4) at java.lang.Thread.run(Thread.java:1012)

Firebase Background Thread #1: at jdk.internal.misc.Unsafe.park(Unsafe.java) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1063) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1123) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0$com-google-firebase-concurrent-CustomThreadFactory(CustomThreadFactory.java:47) at com.google.firebase.concurrent.CustomThreadFactory$$ExternalSyntheticLambda0.run(:4) at java.lang.Thread.run(Thread.java:1012)

Firebase-Messaging-Topics-Io: at jdk.internal.misc.Unsafe.park(Unsafe.java) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1176) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:905) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1063) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1123) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at com.google.android.gms.common.util.concurrent.zza.run(com.google.android.gms:play-services-basement@@18.3.0:2) at java.lang.Thread.run(Thread.java:1012)

Firebase Background Thread #2: at jdk.internal.misc.Unsafe.park(Unsafe.java) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1063) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1123) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0$com-google-firebase-concurrent-CustomThreadFactory(CustomThreadFactory.java:47) at com.google.firebase.concurrent.CustomThreadFactory$$ExternalSyntheticLambda0.run(:4) at java.lang.Thread.run(Thread.java:1012)

Firebase-Messaging-Init: at jdk.internal.misc.Unsafe.park(Unsafe.java) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1176) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:905) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1063) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1123) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at com.google.android.gms.common.util.concurrent.zza.run(com.google.android.gms:play-services-basement@@18.3.0:2) at java.lang.Thread.run(Thread.java:1012)

ReferenceQueueDaemon: at java.lang.Object.wait(Object.java) at java.lang.Object.wait(Object.java:442) at java.lang.Object.wait(Object.java:568) at java.lang.Daemons$ReferenceQueueDaemon.runInternal(Daemons.java:232) at java.lang.Daemons$Daemon.run(Daemons.java:140) at java.lang.Thread.run(Thread.java:1012)

Okio Watchdog: at java.lang.Object.wait(Object.java) at java.lang.Object.wait(Object.java:442) at java.lang.Object.wait(Object.java:568) at com.android.okhttp.okio.AsyncTimeout.awaitTimeout(AsyncTimeout.java:313) at com.android.okhttp.okio.AsyncTimeout.access$000(AsyncTimeout.java:42) at com.android.okhttp.okio.AsyncTimeout$Watchdog.run(AsyncTimeout.java:288)

Jmilham21 commented 1 month ago

@Solly74 Have you been able to reliably reproduce this? Since it's related to the audio service, I'm inclined to think it's because multiple instances were instantiated at the same time (this isn't something we support).

Solly74 commented 1 month ago

@Jmilham21 Unfortunately cannot reproduce it, we're only seeing it in crashlytics but we're in communication with the JWP team. It's possibly related to the ads so we've implemented a fix by using the previous config for ads and publishing live soon.

Jmilham21 commented 1 month ago

Glad to hear you have some level of solution @Solly74. I'm going to close this issue then, but feel free to reopen / create a new one if you have more information on the crash.

You can also reach out to the JWP support team directly with sensitive information, so we can test with your advertising config.