purchases-android icon indicating copy to clipboard operation
purchases-android copied to clipboard

Deadlock in IdentityManager

Open vegaro opened this issue 10 months ago • 2 comments

main (blocked):tid=1 systid=9933 | waiting to lock <0x0018fbd2> (com.revenuecat.purchases.identity.IdentityManager) held by thread 40
       at com.revenuecat.purchases.identity.IdentityManager.currentUserIsAnonymous(IdentityManager.kt)
       at com.revenuecat.purchases.PurchasesOrchestrator.getAllowSharingPlayStoreAccount(PurchasesOrchestrator.kt)
       at com.revenuecat.purchases.PurchasesOrchestrator$1.onConnected(PurchasesOrchestrator.kt)
       at com.revenuecat.purchases.google.BillingWrapper.onBillingSetupFinished$lambda$25(BillingWrapper.kt)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:368)
       at android.app.ActivityThread.main(ActivityThread.java:7710)
       at java.lang.reflect.Method.invoke(Native method)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
DefaultDispatcher-worker-6 (blocked):tid=40 systid=10096 | waiting to lock <0x0dc964a3> (com.revenuecat.purchases.PurchasesOrchestrator) held by thread 1
       at com.revenuecat.purchases.PurchasesOrchestrator$logOut$1.invoke(PurchasesOrchestrator.kt:411)
       at com.revenuecat.purchases.PurchasesOrchestrator$logOut$1.invoke(PurchasesOrchestrator.kt:407)
       at com.revenuecat.purchases.identity.IdentityManager$logOut$1.invoke(IdentityManager.kt:116)
       at com.revenuecat.purchases.identity.IdentityManager$logOut$1.invoke(IdentityManager.kt:113)
       at com.revenuecat.purchases.subscriberattributes.SubscriberAttributesManager$synchronizeSubscriberAttributesForAllUsers$1.invoke(SubscriberAttributesManager.kt:69)
       at com.revenuecat.purchases.subscriberattributes.SubscriberAttributesManager$synchronizeSubscriberAttributesForAllUsers$1.invoke(SubscriberAttributesManager.kt:60)
       at com.revenuecat.purchases.subscriberattributes.SubscriberAttributesManager$ObtainDeviceIdentifiersObservable.waitUntilIdle(SubscriberAttributesManager.kt)
       at com.revenuecat.purchases.subscriberattributes.SubscriberAttributesManager.synchronizeSubscriberAttributesForAllUsers(SubscriberAttributesManager.kt)
       at com.revenuecat.purchases.identity.IdentityManager.logOut(IdentityManager.kt)
       at com.revenuecat.purchases.PurchasesOrchestrator.logOut(PurchasesOrchestrator.kt)
       at com.revenuecat.purchases.Purchases.logOut(Purchases.kt:379)
       at com.revenuecat.purchases.Purchases.logOut$default(Purchases.kt)
       at xxx.RevenueCatDataSource$watchUserState$1$1.emit(RevenueCatDataSource.kt)
       at kotlinx.coroutines.flow.StateFlowImpl.collect(StateFlow.kt)
       at xxx.RevenueCatDataSource$watchUserState$1.invokeSuspend(RevenueCatDataSource.kt)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt)
       at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt)
       at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt)

There is a dead lock between thread 1 (main thread) and thread 40

Originally posted by @rantianhua in https://github.com/RevenueCat/purchases-android/issues/580#issuecomment-1770299145

vegaro avatar Nov 03 '23 14:11 vegaro