appcenter-sdk-android
appcenter-sdk-android copied to clipboard
Several ANRs when report
Description
We catch this error using ANRWatchDog https://github.com/nwestfall/Xamarin.ANRWatchDog in production and the same AppCenter report this custom crash. This it's the stacktrace:
{
"$id": "1",
"ExtraStackTrace": " at System.Environment.get_StackTrace () [0x00000] in 1[T] extraCallInException, System.Action extraCallInFinally, System.Boolean showToUser, System.Boolean reportToLog) [0x00000] in <52d50126f704452c93dd4755842cb2cd>:0 \n at Project.Droid.Services.ANRWatchDogService.ANRListener.OnAppNotResponding (Xamarin.ANRWatchDog.ANRError error) [0x00000] in <3884ddcc9e8c4e0ca33687178f27fa32>:0 \n at Xamarin.ANRWatchDog.ANRWatchDog.Run () [0x00000] in <52a15e0883994e2e9d7036c2bcaa1ded>:0 \n at Java.Lang.Thread.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00000] in <71103707bc754834b2ad65a04606167c>:0 \n at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V (_JniMarshal_PP_V callback, System.IntPtr jnienv, System.IntPtr klazz) [0x00000] in <71103707bc754834b2ad65a04606167c>:0 ", "Error": { "$id": "2", "ApplicationNotRespondingStackTrace": "\n --- End of managed Xamarin.ANRWatchDog.ANRError stack trace ---\ncrc6426ad4e10c8cd0a92.ANRError: Application Not Responding\nCaused by: crc6426ad4e10c8cd0a92.ANRError__ThreadTrace__Thread: main (state = RUNNABLE)\n\tat mono.java.lang.RunnableImplementor.n_run(Native Method)\n\tat mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:31)\n\tat android.os.Handler.handleCallback(Handler.java:938)\n\tat android.os.Handler.dispatchMessage(Handler.java:99)\n\tat android.os.Looper.loopOnce(Looper.java:201)\n\tat android.os.Looper.loop(Looper.java:288)\n\tat android.app.ActivityThread.main(ActivityThread.java:7900)\n\tat java.lang.reflect.Method.invoke(Native Method)\n\tat com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:568)\n\tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)\nCaused by: crc6426ad4e10c8cd0a92.ANRError__ThreadTrace__Thread: ConnectivityThread (state = RUNNABLE)\n\tat android.os.MessageQueue.nativePollOnce(Native Method)\n\tat android.os.MessageQueue.next(MessageQueue.java:335)\n\tat android.os.Looper.loopOnce(Looper.java:161)\n\tat android.os.Looper.loop(Looper.java:288)\n\tat android.os.HandlerThread.run(HandlerThread.java:67)\nCaused by: crc6426ad4e10c8cd0a92.ANRError__ThreadTrace__Thread: FinalizerDaemon (state = WAITING)\n\tat java.lang.Object.wait(Native Method)\n\tat java.lang.Object.wait(Object.java:442)\n\tat java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:203)\n\tat java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:224)\n\tat java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:300)\n\tat java.lang.Daemons$Daemon.run(Daemons.java:140)\n\tat java.lang.Thread.run(Thread.java:1012)\nCaused by: crc6426ad4e10c8cd0a92.ANRError__ThreadTrace__Thread: WifiManagerThread (state = RUNNABLE)\n\tat android.os.MessageQueue.nativePollOnce(Native Method)\n\tat android.os.MessageQueue.next(MessageQueue.java:335)\n\tat android.os.Looper.loopOnce(Looper.java:161)\n\tat android.os.Looper.loop(Looper.java:288)\n\tat android.os.HandlerThread.run(HandlerThread.java:67)\nCaused by: crc6426ad4e10c8cd0a92.ANRError__ThreadTrace__Thread: ScrollPolicy (state = RUNNABLE)\n\t... 5 more\nCaused by: crc6426ad4e10c8cd0a92.ANRError__ThreadTrace__Thread: FramePolicy (state = RUNNABLE)\n\t... 5 more\nCaused by: crc6426ad4e10c8cd0a92.ANRError__ThreadTrace__Thread: |ANR-WatchDog| (state = RUNNABLE)\n\tat dalvik.system.VMStack.getThreadStackTrace(Native Method)\n\tat java.lang.Thread.getStackTrace(Thread.java:1841)\n\tat java.lang.Thread.getAllStackTraces(Thread.java:1909)\n\tat crc6426ad4e10c8cd0a92.ANRWatchDog.n_run(Native Method)\n\tat crc6426ad4e10c8cd0a92.ANRWatchDog.run(ANRWatchDog.java:39)\nCaused by: crc6426ad4e10c8cd0a92.ANRError__ThreadTrace__Thread: Okio Watchdog (state = WAITING)\n\tat java.lang.Object.wait(Native Method)\n\tat java.lang.Object.wait(Object.java:442)\n\tat java.lang.Object.wait(Object.java:568)\n\tat com.android.okhttp.okio.AsyncTimeout.awaitTimeout(AsyncTimeout.java:313)\n\tat com.android.okhttp.okio.AsyncTimeout.access$000(AsyncTimeout.java:42)\n\tat com.android.okhttp.okio.AsyncTimeout$Watchdog.run(AsyncTimeout.java:288)\nCaused by: crc6426ad4e10c8cd0a92.ANRError__ThreadTrace__Thread: FinalizerWatchdogDaemon (state = TIMED_WAITING)\n\tat java.lang.Thread.sleep(Native Method)\n\tat java.lang.Thread.sleep(Thread.java:450)\n\tat java.lang.Thread.sleep(Thread.java:355)\n\tat java.lang.Daemons$FinalizerWatchdogDaemon.sleepForNanos(Daemons.java:438)\n\tat java.lang.Daemons$FinalizerWatchdogDaemon.waitForProgress(Daemons.java:480)\n\tat java.lang.Daemons$FinalizerWatchdogDaemon.runInternal(Daemons.java:369)\n\tat java.lang.Daemons$Daemon.run(Daemons.java:140)\n\tat java.lang.Thread.run(Thread.java:1012)\nCaused by: crc6426ad4e10c8cd0a92.ANRError__ThreadTrace__Thread: AppCenter.Looper (state = RUNNABLE)\n\tat android.os.MessageQueue.nativePollOnce(Native Method)\n\tat android.os.MessageQueue.next(MessageQueue.java:335)\n\tat android.os.Looper.loopOnce(Looper.java:161)\n\tat android.os.Looper.loop(Looper.java:288)\n\tat android.os.HandlerThread.run(HandlerThread.java:67)\nCaused by: crc6426ad4e10c8cd0a92.ANRError__ThreadTrace__Thread: launch (state = RUNNABLE)\n\t... 5 more\nCaused by: crc6426ad4e10c8cd0a92.ANRError__ThreadTrace__Thread: AsyncTask #19 (state = WAITING)\n\tat jdk.internal.misc.Unsafe.park(Native Method)\n\tat java.util.concurrent.locks.LockSupport.park(LockSupport.java:194)\n\tat java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:461)\n\tat java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:361)\n\tat java.util.concurrent.SynchronousQueue.take(SynchronousQueue.java:922)\n\tat java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1063)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1123)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)\n\tat java.lang.Thread.run(Thread.java:1012)\nCaused by: crc6426ad4e10c8cd0a92.ANRError__ThreadTrace__Thread: ReferenceQueueDaemon (state = WAITING)\n\tat java.lang.Object.wait(Native Method)\n\tat java.lang.Object.wait(Object.java:442)\n\tat java.lang.Object.wait(Object.java:568)\n\tat java.lang.Daemons$ReferenceQueueDaemon.runInternal(Daemons.java:232)\n\tat java.lang.Daemons$Daemon.run(Daemons.java:140)\n\t... 1 more\nCaused by: crc6426ad4e10c8cd0a92.ANRError__ThreadTrace__Thread: queued-work-looper (state = RUNNABLE)\n\tat android.os.MessageQueue.nativePollOnce(Native Method)\n\tat android.os.MessageQueue.next(MessageQueue.java:335)\n\tat android.os.Looper.loopOnce(Looper.java:161)\n\tat android.os.Looper.loop(Looper.java:288)\n\tat android.os.HandlerThread.run(HandlerThread.java:67)\n", "Message": "Serialized Application Not Responding", "Data": {}, "InnerException": null, "StackTrace": null, "HelpLink": null, "Source": null, "HResult": -2146233088 }, "ExceptionToProperties": { "Message": "Serialized Application Not Responding", "StackTrace": null, "Source": null, "InnerException": null, "ExtraStackTrace": " at System.Environment.get_StackTrace () [0x00000] in <f6ff5c514b394832a659b6cebda3b7c6>:0 \n at Project.Utils..PrepareException (System.Exception exception, System.Object[] messageProperties, System.String callerName, System.String callerFilePath, System.Int32 callerLineNumber) [0x00000] in <52d50126f704452c93dd4755842cb2cd>:0 \n at Project.Utils.Logger.Log (System.Exception exception, System.Boolean showToUser, System.Int32 timeShowMessageMs, System.Object[] messageProperties, System.String callerName, System.String callerFilePath, System.Int32 callerLineNumber) [0x00000] in <52d50126f704452c93dd4755842cb2cd>:0 \n at Project.Droid.Services.ANRWatchDogService.ANRListener+<>c__DisplayClass0_0.<OnAppNotResponding>b__0 () [0x00000] in <3884ddcc9e8c4e0ca33687178f27fa32>:0 \n at Project.Utils.SecureCalls.SecureCall (System.Action invoke, System.Action1[T] extraCallInException, System.Action extraCallInFinally, System.Boolean showToUser, System.Boolean reportToLog) [0x00000] in <52d50126f704452c93dd4755842cb2cd>:0 \n at Project.Droid.Services.ANRWatchDogService.ANRListener.OnAppNotResponding (Xamarin.ANRWatchDog.ANRError error) [0x00000] in <3884ddcc9e8c4e0ca33687178f27fa32>:0 \n at Xamarin.ANRWatchDog.ANRWatchDog.Run () [0x00000] in <52a15e0883994e2e9d7036c2bcaa1ded>:0 \n at Java.Lang.Thread.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00000] in <71103707bc754834b2ad65a04606167c>:0 \n at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V (_JniMarshal_PP_V callback, System.IntPtr jnienv, System.IntPtr klazz) [0x00000] in <71103707bc754834b2ad65a04606167c>:0 "
},
"CallerName": "OnAppNotResponding",
"FilePath": "/Users/runner/work/1/s/Project.Droid/Services/ANRWatchDogService/ANRListener.cs",
"CallerLineNumber": 31,
"ExtraProperties": null,
"EventLevel": 4,
"ExtraPropertiesForError": {
"CallerName": "OnAppNotResponding",
"FilePath": "/Users/runner/work/1/s/Project.Droid/Services/ANRWatchDogService/ANRListener.cs",
"CallerLineNumber": "31"
},
"ConvertExtraProperties": {}
}
Repro Steps
I not pretty sure because happens in production, it's true, the application working in a scenario that connection should be compromised. Large places with Access points, large times in offline.
I'm trying to reproduce locally, sending a lot of request to AppCenter concurrently and trying to reproduce the same scenario, low connection issues, offline situations...
All that I know it's seems something that block inside of the AppCenter.Looper.
Any help to improve the situation will be appreciated. Thanks!
Details
- Which SDK version are you using? -5.0.1
- Which OS version did you experience the issue on?
- Android 10, Android 11 and Android 12
- What device version did you see this error on? Were you using an emulator or a physical device?
- Several devices
- What third party libraries are you using?
- Use the AppCenter nuget Xamarin flavour
- Please enable verbose logging for your app using
AppCenter.setLogLevel(Log.VERBOSE)before your call toAppCenter.start(...)and include the logs here: I can't because it's ANR error in production