wonderpush / wonderpush-android-sdk

Android SDK for WonderPush − This plugin makes it easy to set up WonderPush push notifications on your Android apps for mobiles devices. High volume, fast delivery and full-featured starting €1/month.
https://docs.wonderpush.com/docs/android-push-notifications-quickstart
Apache License 2.0
5 stars 6 forks source link

ANR when trying to subscribe/unsubscribe from notifications #13

Closed nenahlo closed 5 months ago

nenahlo commented 5 months ago

SDK hangs with ANR when WonderPush.subscribeToNotifications/unsubscribeFromNotifications is called. Reproduced on API level 24 android emulator, 4.4.0 and 4.4.1 version. Works fine on api level 33.

The following commit https://github.com/wonderpush/wonderpush-android-sdk/commit/700be05d91056a72803b94790f49eb1c30f5d9ee may be related to this issue, as the SDK does not hang with version 4.3.4.

anr trace

"main" prio=5 tid=1 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x75e62000 self=0x7046095a00
  | sysTid=12245 nice=-4 cgrp=default sched=0/0 handle=0x7049feea98
  | state=S schedstat=( 698495986 74310979 1973 ) utm=61 stm=8 core=1 HZ=100
  | stack=0x7febe8a000-0x7febe8c000 stackSize=8MB
  | held mutexes=
  at java.lang.Object.wait!(Native method)
  - waiting on <0x00e388ff> (a java.lang.Object)
  at java.lang.Thread.parkFor$(Thread.java:2127)
  - locked <0x00e388ff> (a java.lang.Object)
  at sun.misc.Unsafe.park(Unsafe.java:325)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:161)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:840)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:994)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1303)
  at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:203)
  at com.wonderpush.sdk.DeferredFuture$FutureImpl.get(DeferredFuture.java:53)
  at com.wonderpush.sdk.JSONSyncInstallation.waitForInitialization(JSONSyncInstallation.java:72)
  at com.wonderpush.sdk.JSONSyncInstallation.forUser(JSONSyncInstallation.java:159)
  at com.wonderpush.sdk.JSONSyncInstallation.forCurrentUser(JSONSyncInstallation.java:155)
  at com.wonderpush.sdk.WonderPush.getSubscriptionStatus(WonderPush.java:2827)
  at com.wonderpush.sdk.WonderPushImpl.refreshSubscriptionStatus(WonderPushImpl.java:134)
  at com.wonderpush.sdk.WonderPushImpl.setNotificationEnabled(WonderPushImpl.java:125)
  at com.wonderpush.sdk.WonderPushImpl.subscribeToNotifications(WonderPushImpl.java:92)
  at com.wonderpush.sdk.WonderPushImpl.subscribeToNotifications(WonderPushImpl.java:97)
  at com.wonderpush.sdk.WonderPush.subscribeToNotifications(WonderPush.java:2588)
ofavre commented 5 months ago

Thanks for contacting us through the chat on your WonderPush dashboard. The problem was fixed by properly disabling the SDK auto-init. I'm closing this issue now.