[Bug]: ANR on OnePlus devices
What happened?
on a crash reporting service, we are facing a spike ANR for our users with OnePlus and Oppo devices.
There are different devices and reports are slightly different. But all in common for all of them are device manufacture.
Steps to reproduce?
There are no steps, we can see these reports only on a crash report service.
What did you expect to happen?
No ANR
OneSignal Android SDK version
4.8.7
Android version
13
Specific Android models
OnePlus CPH2449
OnePlus NE2213
OnePlus CPH2451
OnePlus NE2215
OPPO CPH2307
Relevant log output
An ANR is detected while the app is in the background.
at com.onesignal.e3.b(unavailable:0)
at com.onesignal.e3.a(unavailable:1)
at com.onesignal.q1.b(unavailable:2)
at com.onesignal.e3.S0(unavailable:108)
at com.onesignal.s0.b(unavailable:7)
at com.onesignal.SyncJobService.onStartJob(unavailable:9)
at android.app.job.JobService$1.onStartJob(JobService.java:106)
at android.app.job.JobServiceEngine$JobHandler.handleMessage(JobServiceEngine.java:195)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:368)
at android.app.ActivityThread.main(ActivityThread.java:8825)
at java.lang.reflect.Method.invoke(Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
<!-- probot = {"onesignal-probot":{"response_time_in_business_days":12}} -->
I'm also getting many ANRs while setting up Onesignal.
SDK Version
5.1.2
In Application File
OneSignal.initWithContext(this, "ONESIGNAL_APP_ID")
ANR Triggered
main (runnable):tid=1 systid=28755 #00 pc 0x4bf790 libart.so (art::DumpNativeStack + 108) (BuildId: 02bec5940be704b863f6514fc7d81c41) #01 pc 0x4b2940 libart.so (art::Thread::DumpStack const + 388) (BuildId: 02bec5940be704b863f6514fc7d81c41) #02 pc 0x4b2280 libart.so (art::DumpCheckpoint::Run + 164) (BuildId: 02bec5940be704b863f6514fc7d81c41) #03 pc 0x3c8c9c libart.so (art::Thread::RunCheckpointFunction + 148) (BuildId: 02bec5940be704b863f6514fc7d81c41) #04 pc 0x5afae0 libart.so (artTestSuspendFromCode + 232) (BuildId: 02bec5940be704b863f6514fc7d81c41) #05 pc 0x35501c libart.so (art_quick_test_suspend + 156) (BuildId: 02bec5940be704b863f6514fc7d81c41) at java.lang.reflect.Executable.getMethodNameInternal(Native method) at java.lang.reflect.Method.getName(Method.java:115) at java.lang.reflect.Method$1.compare(Method.java:72) at java.lang.reflect.Method$1.compare(Method.java:67) at libcore.util.CollectionUtils.removeDuplicates(CollectionUtils.java:89) at java.lang.Class.getMethods(Class.java:2226) at com.onesignal.common.modeling.Model.initializeFromJson(Model.kt:98) at com.onesignal.core.internal.operations.impl.OperationModelStore.create(OperationModelStore.kt:68) at com.onesignal.core.internal.operations.impl.OperationModelStore.create(OperationModelStore.kt:30) at com.onesignal.common.modeling.ModelStore.load(ModelStore.kt:162) at com.onesignal.core.internal.operations.impl.OperationModelStore.<init>(OperationModelStore.kt:32) at java.lang.reflect.Constructor.newInstance0(Native method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:89) at com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79) at com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67) at com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:82) at com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79) at com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67) at com.onesignal.internal.OneSignalImp.initWithContext(OneSignalImp.kt:523) at com.onesignal.OneSignal.initWithContext(OneSignal.kt:135) at com.xxx.yyy.android.MyApplication.onCreate(MyApplication.kt:37) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1335) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7570) at android.app.ActivityThread.-$$Nest$mhandleBindApplication(unavailable) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2416) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:257) at android.os.Looper.loop(Looper.java:368) at android.app.ActivityThread.main(ActivityThread.java:8815) at java.lang.reflect.Method.invoke(Native method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
Devices effecting
Realme GT 2 Pro Oppo A78 5G Oppo Realme 10 Pro+ 5G OnePlus Nord CE 2 Lite 5G Xiaomi Poco C55 OnePlus 11R 5G
Android Versions
13,14
@kotya341 Could you provide an unobfuscated stack trace?
@bineeshbabu The stack trace doesn't point to a line of code that could be frozen. Note that ANRs just report the last line of code running at the 5 second mark. I recommend making sure you are not doing to much other work before calling OneSignal.initWithContext in your MyApplication.onCreate. See Android's documentation on ANRs and how to benchmark the performance to solve the issue.
We have released Android SDK 5.1.12 in an attempt to resolve the specific ANR issues. Please give it a try and let us know if the ANR still persists. https://github.com/OneSignal/OneSignal-Android-SDK/releases/tag/5.1.12
Was this fixed in 4.8.8 ? Or fix is exclusive to user centric model?
@vknow360 This specific update only applies to 5.x.x, there is no 1 to 1 equivalent in 4.x.x so there isn't anything we can back port here.
Could you search through the already reported issues for your specific ANR? If you don't see anything, or the issue was closed, please open a new issue with the full stacktrace.