firebase-android-sdk icon indicating copy to clipboard operation
firebase-android-sdk copied to clipboard

"java.lang.IllegalArgumentException: Service not registered" when unbinding in SessionLifecycleServiceBinderImpl

Open francescocervone opened this issue 1 year ago • 1 comments

  • Android Studio version: Android Studio Iguana | 2023.2.1 Patch 1
  • Android Gradle Plugin version: 8.3.2
  • Firebase Component: Firebase Sessions
  • Component version: Firebase BoM 32.8.0

Steps to reproduce:

Not able to reproduce the issue, but we are getting dozens of crashes on a specific device of one of our customers:

  • Wind River, Armor 2, Android 7
Fatal Exception: java.lang.IllegalArgumentException: Service not registered: [obfuscated]
       at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1331)
       at android.app.ContextImpl.unbindService(ContextImpl.java:1528)
       at android.content.ContextWrapper.unbindService(ContextWrapper.java:648)
       at com.google.firebase.sessions.SessionLifecycleServiceBinderImpl.bindToService(SessionLifecycleServiceBinder.kt:65)
       at com.google.firebase.sessions.SessionLifecycleClient.bindToService(SessionLifecycleClient.java:105)
       at com.google.firebase.sessions.FirebaseSessions$1.invokeSuspend(FirebaseSessions.kt:53)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
       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(D8$$SyntheticClass:1047)
       at java.lang.Thread.run(Thread.java:761)

Relevant Code:

I see that on that line, the class is trying to unbind a service that was unable to bind before:

if (!isServiceBound) {
  appContext.unbindService(serviceConnection)
  Log.i(TAG, "Session lifecycle service binding failed.")
}

francescocervone avatar Apr 15 '24 08:04 francescocervone

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Apr 15 '24 08:04 google-oss-bot