Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANR - com.onesignal.GMSLocationController$FusedLocationApiWrapper.requestLocationUpdates (GMSLocationController.java:201) #1612

Open
1 task done
eugurguner opened this issue Jul 10, 2022 · 9 comments

Comments

@eugurguner
Copy link

What happened?

Since from May 24th, 32 of my users had an ANR issue of com.onesignal.GMSLocationController$FusedLocationApiWrapper.requestLocationUpdates (GMSLocationController.java:201).

Environment

What version of the Android SDK are you using? 4.7.0 - 4.8.0
How did you add the SDK to your project ? Maven

Anything else:
A lot of these instances don't have any stack traces and the ones that have as the thread with below stack trace blocked.

Steps to reproduce?

None. Only evidence is the ANR reports on Play store and Firebase Crashlytics.

What did you expect to happen?

I expected that no ANR issue would happen to any of my users.

OneSignal Android SDK version

Release 4.7.0 - 4.8.0

Android version

12, 11

Specific Android models

* Samsung Galaxy A13
* Redmi Note 8
* Galaxy S20
* Galaxy A71
* Redmi Note 10 5G
* Galaxy Note 10 Lite
* Galaxy A51
* Galaxy M30s
* Galaxy A31
* Galaxy A52
* Redmi Note 11 Pro
* Galaxy A21s

Relevant log output

androidx.work-1 (waiting)
tid=41 systid=14097
Root blocking
sun.misc.Unsafe.park (Native method)

com.google.android.gms.internal.location.zzz.requestLocationUpdates (com.google.android.gms:play-services-location@@18.0.0:5)
com.onesignal.GMSLocationController$FusedLocationApiWrapper.requestLocationUpdates (GMSLocationController.java:201)
com.onesignal.GMSLocationController$LocationUpdateListener.init (GMSLocationController.java:182)
com.onesignal.GMSLocationController$LocationUpdateListener.<init> (GMSLocationController.java:166)
com.onesignal.GMSLocationController.onFocusChange (GMSLocationController.java:118)
com.onesignal.LocationController.onFocusChange (LocationController.java:326)
com.onesignal.OneSignal.onAppLostFocus (OneSignal.java:1345)
com.onesignal.OSFocusHandler$Companion.onLostFocusDoWork (OSFocusHandler.kt:139)
com.onesignal.OSFocusHandler$OnLostFocusWorker.doWork (OSFocusHandler.kt:118)
androidx.work.Worker$1.run (Worker.java:86)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)

java.lang.Thread.run (Thread.java:923)
main (blocked)
tid=1 systid=13969 | waiting to lock <0x0d69b429> (com.onesignal.LocationController$1) held by thread 41
Triggered ANR
com.onesignal.LocationController.onFocusChange (LocationController.java:324)
com.onesignal.OneSignal.onAppFocus (OneSignal.java:1402)
com.onesignal.OSFocusHandler.startOnFocusWork (OSFocusHandler.kt:49)
com.onesignal.ActivityLifecycleHandler.handleFocus (ActivityLifecycleHandler.java:191)
com.onesignal.ActivityLifecycleHandler.onActivityResumed (ActivityLifecycleHandler.java:95)
com.onesignal.ActivityLifecycleListener.onActivityResumed (ActivityLifecycleListener.java:91)
android.app.Application.dispatchActivityResumed (Application.java:455)

com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)
Signal Catcher (runnable)
tid=5 systid=13981
art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)
HeapTaskDaemon (waiting)
tid=7 systid=13983
syscall
Jit thread pool worker thread 0 (native)
tid=8 systid=13982
syscall
ReferenceQueueDaemon (waiting)
tid=9 systid=13984
java.lang.Object.wait
Binder:13969_1 (native)
tid=10 systid=13987
__ioctl
FinalizerDaemon (waiting)
tid=11 systid=13985
java.lang.Object.wait
FinalizerWatchdogDaemon (timed waiting)
tid=12 systid=13986
java.lang.Thread.sleep
Binder:13969_2 (native)
tid=13 systid=13988
__ioctl
Binder:13969_3 (native)
tid=14 systid=13989
__ioctl
Profile Saver (native)
tid=15 systid=13990
syscall
pool-4-thread-1 (waiting)
tid=16 systid=13992
sun.misc.Unsafe.park
Crashlytics Exception Handler1 (waiting)
tid=18 systid=14005
sun.misc.Unsafe.park
awaitEvenIfOnMainThread task continuation executor1 (waiting)
tid=20 systid=14009
sun.misc.Unsafe.park
GmsDynamite (waiting)
tid=22 systid=14006
java.lang.Object.wait
pool-11-thread-1 (waiting)
tid=23 systid=14011
sun.misc.Unsafe.park
com.google.firebase.crashlytics.startup1 (waiting)
tid=24 systid=14007
sun.misc.Unsafe.park
queued-work-looper (native)
tid=31 systid=14022
__epoll_pwait
WM.task-1 (waiting)
tid=32 systid=14023
sun.misc.Unsafe.park
ConnectivityThread (native)
tid=34 systid=14026
__epoll_pwait
OSH_WritePrefs (native)
tid=33 systid=14028
__epoll_pwait
WM.task-2 (waiting)
tid=36 systid=14030
sun.misc.Unsafe.park
WM.task-3 (waiting)
tid=40 systid=14034
sun.misc.Unsafe.park
WM.task-4 (waiting)
tid=42 systid=14036
sun.misc.Unsafe.park
Okio Watchdog (waiting)
tid=38 systid=14043
java.lang.Object.wait
Thread-7 (waiting)
tid=43 systid=14053
sun.misc.Unsafe.park
Thread-6 (waiting)
tid=44 systid=14052
sun.misc.Unsafe.park
Thread-8 (waiting)
tid=45 systid=14054
sun.misc.Unsafe.park
Thread-5 (waiting)
tid=46 systid=14051
sun.misc.Unsafe.park
Thread-10 (waiting)
tid=47 systid=14056
sun.misc.Unsafe.park
Thread-11 (waiting)
tid=48 systid=14058
sun.misc.Unsafe.park
Thread-9 (waiting)
tid=50 systid=14055
sun.misc.Unsafe.park
Thread-12 (waiting)
tid=51 systid=14059
sun.misc.Unsafe.park
Thread-14 (waiting)
tid=35 systid=14062
sun.misc.Unsafe.park
GoogleApiHandler (native)
tid=52 systid=14065
__epoll_pwait
Thread-13 (waiting)
tid=53 systid=14060
sun.misc.Unsafe.park
pool-17-thread-1 (waiting)
tid=55 systid=14066
sun.misc.Unsafe.park
OSH_NetworkHandlerThread_PUSH (native)
tid=56 systid=14069
__epoll_pwait
com.mixpanel.android.AnalyticsWorker (native)
tid=57 systid=14068
__epoll_pwait
OS_GMS_LOCATION_FALLBACK (blocked)
tid=58 systid=14070 | waiting to lock <0x0d69b429> (com.onesignal.LocationController$1) held by thread 41
com.onesignal.LocationController.fireFailedComplete
OSH_LocationHandlerThread (blocked)
tid=59 systid=14071 | waiting to lock <0x0d69b429> (com.onesignal.LocationController$1) held by thread 41
com.onesignal.GMSLocationController$GoogleApiClientListener.onConnected
androidx.work-2 (blocked)
tid=2 systid=14898 | waiting to lock <0x0d69b429> (com.onesignal.LocationController$1) held by thread 41
com.onesignal.LocationController.onFocusChange
Binder:13969_4 (native)
tid=4 systid=15145
__ioctl
androidx.work-3 (blocked)
tid=3 systid=17902 | waiting to lock <0x0d69b429> (com.onesignal.LocationController$1) held by thread 41
com.onesignal.LocationController.onFocusChange
androidx.work-4 (blocked)
tid=6 systid=19749 | waiting to lock <0x0d69b429> (com.onesignal.LocationController$1) held by thread 41
com.onesignal.LocationController.onFocusChange
MessengerIpcClient (waiting)
tid=25 systid=26974
sun.misc.Unsafe.park
RenderThread (native)
tid=17 systid=15225
__epoll_pwait
ScionFrontendApi (timed waiting)
tid=19 systid=15241
sun.misc.Unsafe.park
Apollo Dispatcher (timed waiting)
tid=21 systid=15248
sun.misc.Unsafe.park
Apollo Dispatcher (timed waiting)
tid=26 systid=15249
sun.misc.Unsafe.park
Apollo Dispatcher (timed waiting)
tid=27 systid=15250
sun.misc.Unsafe.park
OkHttp Dispatcher (timed waiting)
tid=28 systid=15251
sun.misc.Unsafe.park
FrameMetricsAggregator (native)
tid=29 systid=15254
__epoll_pwait
pool-27-thread-1 (timed waiting)
tid=39 systid=15260
sun.misc.Unsafe.park
pool-28-thread-1 (timed waiting)
tid=54 systid=15261
sun.misc.Unsafe.park
pool-26-thread-1 (timed waiting)
tid=60 systid=15262
sun.misc.Unsafe.park
pool-13-thread-2 (timed waiting)
tid=61 systid=15263
sun.misc.Unsafe.park
OkHttp zeus.fizbot.net (native)
tid=37 systid=15271
recvfrom
OkHttp ConnectionPool (timed waiting)
tid=64 systid=15272
java.lang.Object.wait
Okio Watchdog (timed waiting)
tid=65 systid=15273
java.lang.Object.wait
OkHttp zeus.fizbot.net Writer (waiting)
tid=66 systid=15274
sun.misc.Unsafe.park
OkHttp Http2Connection (timed waiting)
tid=67 systid=15275
sun.misc.Unsafe.park
OSH_NetworkHandlerThread_EMAIL (native)
tid=68 systid=15276
__epoll_pwait
OSH_NetworkHandlerThread_SMS (native)
tid=69 systid=15277
__epoll_pwait
mali-mem-purge (unknown)
tid=15229 systid=15229
syscall
mali-utility-wo (unknown)
tid=15230 systid=15230
syscall
mali-utility-wo (unknown)
tid=15231 systid=15231
syscall
mali-utility-wo (unknown)
tid=15232 systid=15232
syscall
mali-utility-wo (unknown)
tid=15233 systid=15233
syscall
mali-utility-wo (unknown)
tid=15234 systid=15234
syscall
mali-utility-wo (unknown)
tid=15235 systid=15235
syscall
mali-utility-wo (unknown)
tid=15236 systid=15236
syscall
mali-utility-wo (unknown)
tid=15237 systid=15237
syscall
mali-cmar-backe (unknown)
tid=15238 systid=15238
__ppoll
mali-hist-dump (unknown)
tid=15239 systid=15239
syscall
ged-swd (unknown)
tid=15240 systid=15240

Code of Conduct

  • I agree to follow this project's Code of Conduct
@nan-li
Copy link
Contributor

nan-li commented Jul 15, 2022

Hi @eugurguner,

Thank you for reporting this issue. This is an ANR that has been reported by others, and that we are investigating.

Please let us know some information:

  1. You mention this started happening from May 24th - did anything change around this time? For example, did you upgrade versions of the OneSignal-Android-SDK?
  2. You list the SDK versions as a range 4.7.0 - 4.8.0. Can you narrow this down, or give more details about what versions you used? This may also be related to the first question above.
  3. I forgot to ask this, but is also helpful to know what percent of your users this has affected. It will help gauge how rare or common this ANR can happen.

@eugurguner
Copy link
Author

@nan-li Hello,

I would like to answer your questions,

  1. Yes, I have upgraded OneSignal-Android-SDK versions. However, other than I have upgraded gradle version in Android project but I do not think that would effect OneSignal in that way.

  2. Yes, I listed SDK versions as a range 4.7.0 - 4.8.0 because I always keep my dependencies up to date. So, I can say that I follow every update of OneSignal and used.

  3. This ANR happened in the approximately 3 percent of all users.

@jt-gilkeson
Copy link

jt-gilkeson commented Aug 4, 2022

We've seen this too. Here are the stats I have for ANRs in recent releases:

  • 4.65 GMSLocationController.java line 116 com.onesignal.GMSLocationController.onFocusChange last 90 days: Unique users: 66, 89% android 12, 11% android 11
  • 4.80 GMSLocationController.java line 198 com.onesignal.GMSLocationController$FusedLocationApiWrapper.requestLocationUpdates About a Month Unique users: 66 android 12: 100%
  • 4.81 GMSLocationController.java line 199 com.onesignal.GMSLocationController$FusedLocationApiWrapper.requestLocationUpdates About A week Unique users: 64, android 12: 74% android 11: 26%

So it looks like the number of occurrences has accelerated in 4.81 vs 4.80

These ANRs are happening to a very small percentage of users, but app-wide are the most common ANRs reported.

@nan-li
Copy link
Contributor

nan-li commented Aug 12, 2022

Hi @eugurguner and @jt-gilkeson,

Thank you for sharing those details. As a workaround while we investigate solutions, if you don't need location points in OneSignal, you can call OneSignal.setLocationShared(false) to disable these location updates.

@eugurguner
Copy link
Author

@nan-li thank you. I just wanted to update that this issue keeps happening. Therefore, I used the function OneSignal.setLocationShared(false) as you mentioned.

@iballan
Copy link

iballan commented Jan 19, 2023

It is weird, Why after closing the location still getting location related crashes?

I did also set:

OneSignal.setLocationShared(false)

Still getting the same ANR!

Root Blocking:

OSH_LocationHandlerThread (timed waiting):tid=100 systid=27762 
       at sun.misc.Unsafe.park(Unsafe.java)
       at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1063)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1358)
       at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:278)
       at com.google.android.gms.internal.location.zzau.getLastLocation(com.google.android.gms:play-services-location@@21.0.1:12)
       at com.onesignal.GMSLocationController$FusedLocationApiWrapper.getLastLocation(GMSLocationController.java:210)
       at com.onesignal.GMSLocationController$GoogleApiClientListener.onConnected(GMSLocationController.java:134)
       at com.google.android.gms.common.internal.zak.zad(com.google.android.gms:play-services-base@@18.1.0:11)
       at com.google.android.gms.common.api.internal.zabe.zab(com.google.android.gms:play-services-base@@18.1.0:3)
       at com.google.android.gms.common.api.internal.zaaw.zaC(com.google.android.gms:play-services-base@@18.1.0:11)
       at com.google.android.gms.common.api.internal.zaaw.zag(com.google.android.gms:play-services-base@@18.1.0:4)
       at com.google.android.gms.common.api.internal.zabi.onConnected(com.google.android.gms:play-services-base@@18.1.0:2)
       at com.google.android.gms.common.api.internal.zat.onConnected(com.google.android.gms:play-services-base@@18.1.0:1)
       at com.google.android.gms.common.internal.zah.onConnected(com.google.android.gms:play-services-base@@18.1.0:1)
       at com.google.android.gms.common.internal.zzf.zzd(com.google.android.gms:play-services-basement@@18.1.0:10)
       at com.google.android.gms.common.internal.zza.zza(com.google.android.gms:play-services-basement@@18.1.0:4)
       at com.google.android.gms.common.internal.zzc.zze(com.google.android.gms:play-services-basement@@18.1.0:3)
       at com.google.android.gms.common.internal.zzb.handleMessage(com.google.android.gms:play-services-basement@@18.1.0:31)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.os.HandlerThread.run(HandlerThread.java:67)

Triggered ANR:

main (blocked):tid=1 systid=27511 | waiting to lock <0x0b415e47> (com.onesignal.d0$a) held by thread 100
       at com.onesignal.LocationController.onFocusChange(LocationController.java:324)
       at com.onesignal.OneSignal.onAppFocus(OneSignal.java:1409)
       at com.onesignal.OSFocusHandler.startOnFocusWork(OSFocusHandler.kt:54)
       at com.onesignal.ActivityLifecycleHandler.handleFocus(ActivityLifecycleHandler.java:191)
       at com.onesignal.ActivityLifecycleHandler.onActivityResumed(ActivityLifecycleHandler.java:95)
       at com.onesignal.ActivityLifecycleListener.onActivityResumed(ActivityLifecycleListener.java:91)
       at android.app.Application.dispatchActivityResumed(Application.java:436)
       at android.app.Activity.dispatchActivityResumed(Activity.java:1408)
       at android.app.Activity.onResume(Activity.java:1934)
       at androidx.fragment.app.FragmentActivity.onResume(FragmentActivity.java:310)
       at com.moe.app.activities.base.BaseActivity.onResume(BaseActivity.kt:164)
       at com.moe.app.activities.main.MainActivity.onResume(MainActivity.kt:306)
       at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1456)
       at android.app.Activity.performResume(Activity.java:8238)
       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4552)
       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4597)
       at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2130)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:8001)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:635)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

@viniciusalvesmello
Copy link

Same problem here! We recently updated the OneSignal SDK to version 4.8.3.

image

@arpitkushwaha
Copy link

Did anyone manage to find a solution to this problem? I reported the same bug here. It continues to be at the top of our ANRs list, and I'm still unable to determine the root cause. I've also upgraded the OneSignal SDK to the latest version, but the issue persists.

@daniestrella
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants