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

Android [split_config.arm64_v8a.apk!libc++_shared.so] std::__ndk1::recursive_mutex::lock() ANR #75893

Closed
ksvslk opened this issue Apr 10, 2023 · 23 comments · Fixed by #76399
Closed

Comments

@ksvslk
Copy link

ksvslk commented Apr 10, 2023

Godot version

3.6.1.beta

System information

Android, GLES2

Issue description

Multiple ANRs.

"main" tid=1 Native
  #00  pc 0x000000000001ed2c  /system/lib64/libc.so (syscall+28)
  #01  pc 0x000000000002202c  /system/lib64/libc.so (__futex_wait_ex(void volatile*, bool, int, bool, timespec const*)+140)
  #02  pc 0x00000000000840f0  /system/lib64/libc.so (NonPI::MutexLockWithTimeout(pthread_mutex_internal_t*, bool, timespec const*)+632)
  #03  pc 0x00000000000c2d30  /data/app/com.mygame-8MPfiTRLHD8Ji_TFwFmX5g==/split_config.arm64_v8a.apk (std::__ndk1::recursive_mutex::lock()+12)
  at org.godotengine.godot.GodotLib.touch (Native method)
  at org.godotengine.godot.input.GodotInputHandler.onTouchEvent (GodotInputHandler.java:175)
  at org.godotengine.godot.GodotView.onTouchEvent (GodotView.java:108)
  at android.view.View.dispatchTouchEvent (View.java:12555)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3083)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2741)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3083)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2741)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3083)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2741)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3083)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2741)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3083)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2741)
  at com.android.internal.policy.DecorView.superDispatchTouchEvent (DecorView.java:474)
  at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent (PhoneWindow.java:1830)
  at android.app.Activity.dispatchTouchEvent (Activity.java:3400)
  at com.android.internal.policy.DecorView.dispatchTouchEvent (DecorView.java:432)
  at android.view.View.dispatchPointerEvent (View.java:12799)
  at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent (ViewRootImpl.java:5314)
  at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess (ViewRootImpl.java:5108)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4621)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:4674)
  at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:4640)
  at android.view.ViewRootImpl$AsyncInputStage.forward (ViewRootImpl.java:4780)
  at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:4648)
  at android.view.ViewRootImpl$AsyncInputStage.apply (ViewRootImpl.java:4837)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4621)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:4674)
  at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:4640)
  at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:4648)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4621)
  at android.view.ViewRootImpl.deliverInputEvent (ViewRootImpl.java:7394)
  at android.view.ViewRootImpl.doProcessInputEvents (ViewRootImpl.java:7346)
  at android.view.ViewRootImpl.enqueueInputEvent (ViewRootImpl.java:7297)
  at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent (ViewRootImpl.java:7551)
  at android.view.InputEventReceiver.dispatchInputEvent (InputEventReceiver.java:186)
  at android.os.MessageQueue.nativePollOnce (Native method)
  at android.os.MessageQueue.next (MessageQueue.java:327)
  at android.os.Looper.loop (Looper.java:196)
  at android.app.ActivityThread.main (ActivityThread.java:6760)
  at java.lang.reflect.Method.invoke (Native method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:911)

"Signal Catcher" tid=3 Runnable
  #00  pc 0x00000000003c7ac4  /system/lib64/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char>>&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+220)
  #01  pc 0x0000000000496520  /system/lib64/libart.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char>>&, bool, BacktraceMap*, bool) const+352)
  #02  pc 0x00000000004b0564  /system/lib64/libart.so (art::DumpCheckpoint::Run(art::Thread*)+996)
  #03  pc 0x00000000004a9208  /system/lib64/libart.so (art::ThreadList::RunCheckpoint(art::Closure*, art::Closure*)+488)
  #04  pc 0x00000000004a864c  /system/lib64/libart.so (art::ThreadList::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char>>&, bool)+1036)
  #05  pc 0x00000000004a8154  /system/lib64/libart.so (art::ThreadList::DumpForSigQuit(std::__1::basic_ostream<char, std::__1::char_traits<char>>&)+884)
  #06  pc 0x0000000000478004  /system/lib64/libart.so (art::Runtime::DumpForSigQuit(std::__1::basic_ostream<char, std::__1::char_traits<char>>&)+188)
  #07  pc 0x0000000000483ecc  /system/lib64/libart.so (art::SignalCatcher::HandleSigQuit()+1372)
  #08  pc 0x0000000000482bc0  /system/lib64/libart.so (art::SignalCatcher::Run(void*)+256)
  #09  pc 0x0000000000083134  /system/lib64/libc.so (__pthread_start(void*)+36)
  #10  pc 0x00000000000233bc  /system/lib64/libc.so (__start_thread+68)

"Jit thread pool worker thread 0" tid=2 Native
  #00  pc 0x000000000001ed2c  /system/lib64/libc.so (syscall+28)
  #01  pc 0x00000000000d7424  /system/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+148)
  #02  pc 0x00000000004b1ddc  /system/lib64/libart.so (art::ThreadPool::GetTask(art::Thread*)+260)
  #03  pc 0x00000000004b1334  /system/lib64/libart.so (art::ThreadPoolWorker::Run()+124)
  #04  pc 0x00000000004b0de4  /system/lib64/libart.so (art::ThreadPoolWorker::Callback(void*)+148)
  #05  pc 0x0000000000083134  /system/lib64/libc.so (__pthread_start(void*)+36)
  #06  pc 0x00000000000233bc  /system/lib64/libc.so (__start_thread+68)

"ReferenceQueueDaemon" tid=4 Waiting
  at java.lang.Object.wait (Native method)
  at java.lang.Daemons$ReferenceQueueDaemon.runInternal (Daemons.java:178)
  at java.lang.Daemons$Daemon.run (Daemons.java:103)
  at java.lang.Thread.run (Thread.java:764)

"FinalizerDaemon" tid=5 Waiting
  at java.lang.Object.wait (Native method)
  at java.lang.Object.wait (Object.java:422)
  at java.lang.ref.ReferenceQueue.remove (ReferenceQueue.java:188)
  at java.lang.ref.ReferenceQueue.remove (ReferenceQueue.java:209)
  at java.lang.Daemons$FinalizerDaemon.runInternal (Daemons.java:232)
  at java.lang.Daemons$Daemon.run (Daemons.java:103)
  at java.lang.Thread.run (Thread.java:764)

"FinalizerWatchdogDaemon" tid=6 Waiting
  at java.lang.Object.wait (Native method)
  at java.lang.Daemons$FinalizerWatchdogDaemon.sleepUntilNeeded (Daemons.java:297)
  at java.lang.Daemons$FinalizerWatchdogDaemon.runInternal (Daemons.java:277)
  at java.lang.Daemons$Daemon.run (Daemons.java:103)
  at java.lang.Thread.run (Thread.java:764)

"HeapTaskDaemon" tid=7 Waiting
  #00  pc 0x000000000001ed2c  /system/lib64/libc.so (syscall+28)
  #01  pc 0x00000000000d7424  /system/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+148)
  #02  pc 0x000000000022f7d8  /system/lib64/libart.so (art::gc::TaskProcessor::GetTask(art::Thread*)+504)
  #03  pc 0x0000000000230050  /system/lib64/libart.so (art::gc::TaskProcessor::RunAllTasks(art::Thread*)+96)
  at dalvik.system.VMRuntime.runHeapTasks (Native method)
  at java.lang.Daemons$HeapTaskDaemon.runInternal (Daemons.java:475)
  at java.lang.Daemons$Daemon.run (Daemons.java:103)
  at java.lang.Thread.run (Thread.java:764)

"Binder:18496_1" tid=8 Native
  #00  pc 0x000000000006f6ec  /system/lib64/libc.so (__ioctl+4)
  #01  pc 0x0000000000029168  /system/lib64/libc.so (ioctl+136)
  #02  pc 0x000000000005a844  /system/lib64/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+260)
  #03  pc 0x000000000005aa20  /system/lib64/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+24)
  #04  pc 0x000000000005b174  /system/lib64/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+60)
  #05  pc 0x000000000007bc4c  /system/lib64/libbinder.so (android::PoolThread::threadLoop()+28)
  #06  pc 0x000000000000fc08  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+280)
  #07  pc 0x00000000000b6634  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+140)
  #08  pc 0x0000000000083134  /system/lib64/libc.so (__pthread_start(void*)+36)
  #09  pc 0x00000000000233bc  /system/lib64/libc.so (__start_thread+68)

"Binder:18496_2" tid=9 Native
  #00  pc 0x000000000006f6ec  /system/lib64/libc.so (__ioctl+4)
  #01  pc 0x0000000000029168  /system/lib64/libc.so (ioctl+136)
  #02  pc 0x000000000005a844  /system/lib64/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+260)
  #03  pc 0x000000000005aa20  /system/lib64/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+24)
  #04  pc 0x000000000005b174  /system/lib64/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+60)
  #05  pc 0x000000000007bc4c  /system/lib64/libbinder.so (android::PoolThread::threadLoop()+28)
  #06  pc 0x000000000000fc08  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+280)
  #07  pc 0x00000000000b6634  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+140)
  #08  pc 0x0000000000083134  /system/lib64/libc.so (__pthread_start(void*)+36)
  #09  pc 0x00000000000233bc  /system/lib64/libc.so (__start_thread+68)

"Profile Saver" tid=10 Native
  #00  pc 0x000000000001ed2c  /system/lib64/libc.so (syscall+28)
  #01  pc 0x00000000000d7424  /system/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+148)
  #02  pc 0x00000000003261a0  /system/lib64/libart.so (art::ProfileSaver::Run()+384)
  #03  pc 0x00000000003295ac  /system/lib64/libart.so (art::ProfileSaver::RunProfileSaverThread(void*)+92)
  #04  pc 0x0000000000083134  /system/lib64/libc.so (__pthread_start(void*)+36)
  #05  pc 0x00000000000233bc  /system/lib64/libc.so (__start_thread+68)

"ScionFrontendApi" tid=12 Timed Waiting
  at java.lang.Object.wait (Native method)
  at java.lang.Thread.parkFor$ (Thread.java:2137)
  at sun.misc.Unsafe.park (Unsafe.java:358)
  at java.util.concurrent.locks.LockSupport.parkNanos (LockSupport.java:230)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos (AbstractQueuedSynchronizer.java:2101)
  at java.util.concurrent.LinkedBlockingQueue.poll (LinkedBlockingQueue.java:467)
  at java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1091)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1152)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
  at java.lang.Thread.run (Thread.java:764)

"GmsDynamite" tid=14 Waiting
  at java.lang.Object.wait (Native method)
  at com.google.android.gms.dynamite.zza.run (com.google.android.gms:play-services-basement@@18.1.0:2)

"WM.task-1" tid=15 Waiting
  at java.lang.Object.wait (Native method)
  at java.lang.Thread.parkFor$ (Thread.java:2137)
  at sun.misc.Unsafe.park (Unsafe.java:358)
  at java.util.concurrent.locks.LockSupport.park (LockSupport.java:190)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2059)
  at java.util.concurrent.LinkedBlockingQueue.take (LinkedBlockingQueue.java:442)
  at java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1092)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1152)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
  at java.lang.Thread.run (Thread.java:764)

"WM.task-2" tid=16 Waiting
  at java.lang.Object.wait (Native method)
  at java.lang.Thread.parkFor$ (Thread.java:2137)
  at sun.misc.Unsafe.park (Unsafe.java:358)
  at java.util.concurrent.locks.LockSupport.park (LockSupport.java:190)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2059)
  at java.util.concurrent.LinkedBlockingQueue.take (LinkedBlockingQueue.java:442)
  at java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1092)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1152)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
  at java.lang.Thread.run (Thread.java:764)

"GoogleApiHandler" tid=17 Native
  #00  pc 0x000000000006f600  /system/lib64/libc.so (__epoll_pwait+8)
  #01  pc 0x0000000000014248  /system/lib64/libutils.so (android::Looper::pollInner(int)+144)
  #02  pc 0x0000000000014114  /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+60)
  #03  pc 0x00000000001231e4  /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)+44)
  at android.os.MessageQueue.nativePollOnce (Native method)
  at android.os.MessageQueue.next (MessageQueue.java:327)
  at android.os.Looper.loop (Looper.java:196)
  at android.os.HandlerThread.run (HandlerThread.java:65)

"magnifier pixel copy result handler" tid=18 Native
  #00  pc 0x000000000006f600  /system/lib64/libc.so (__epoll_pwait+8)
  #01  pc 0x0000000000014248  /system/lib64/libutils.so (android::Looper::pollInner(int)+144)
  #02  pc 0x0000000000014114  /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+60)
  #03  pc 0x00000000001231e4  /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)+44)
  at android.os.MessageQueue.nativePollOnce (Native method)
  at android.os.MessageQueue.next (MessageQueue.java:327)
  at android.os.Looper.loop (Looper.java:196)
  at android.os.HandlerThread.run (HandlerThread.java:65)

"GLThread 1442" tid=19 Native
  #00  pc 0x0000000000070124  /system/lib64/libc.so (read+4)
  #01  pc 0x000000000007b55c  /system/lib64/libc.so (__sread+44)
  #02  pc 0x000000000007b4bc  /system/lib64/libc.so (__srefill+268)
  #03  pc 0x000000000007f1f8  /system/lib64/libc.so (fread_unlocked+200)
  #04  pc 0x000000000007f0e8  /system/lib64/libc.so (fread+72)
  #05  pc 0x0000000000037dd4  /system/lib64/libc.so (android_getaddrinfofornetcontext+2388)
  #06  pc 0x0000000000037458  /system/lib64/libc.so (android_getaddrinfofornet+56)
  #07  pc 0x000000000002acd8  /system/lib64/libjavacore.so (Linux_android_getaddrinfo(_JNIEnv*, _jobject*, _jstring*, _jobject*, int)+336)
  at libcore.io.Linux.android_getaddrinfo (Native method)
  at libcore.io.BlockGuardOs.android_getaddrinfo (BlockGuardOs.java:172)
  at java.net.Inet6AddressImpl.lookupHostByName (Inet6AddressImpl.java:137)
  at java.net.Inet6AddressImpl.lookupAllHostAddr (Inet6AddressImpl.java:105)
  at java.net.InetAddress.getAllByName (InetAddress.java:1154)
  at com.android.okhttp.Dns$1.lookup (Dns.java:39)
  at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress (RouteSelector.java:175)
  at com.android.okhttp.internal.http.RouteSelector.nextProxy (RouteSelector.java:141)
  at com.android.okhttp.internal.http.RouteSelector.next (RouteSelector.java:83)
  at com.android.okhttp.internal.http.StreamAllocation.findConnection (StreamAllocation.java:174)
  at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection (StreamAllocation.java:126)
  at com.android.okhttp.internal.http.StreamAllocation.newStream (StreamAllocation.java:95)
  at com.android.okhttp.internal.http.HttpEngine.connect (HttpEngine.java:299)
  at com.android.okhttp.internal.http.HttpEngine.sendRequest (HttpEngine.java:237)
  at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute (HttpURLConnectionImpl.java:472)
  at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse (HttpURLConnectionImpl.java:418)
  at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode (HttpURLConnectionImpl.java:549)
  at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode (DelegatingHttpsURLConnection.java:105)
  at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode (HttpsURLConnectionImpl.java:26)
  at com.mygame.GPack.isConnectedToInternet (GPack.java:395)
  at com.mygame.GPack.askForReview (GPack.java:125)
  at org.godotengine.godot.GodotLib.step (Native method)
  at org.godotengine.godot.GodotRenderer.onDrawFrame (GodotRenderer.java:57)
  at org.godotengine.godot.gl.GLSurfaceView$GLThread.guardedRun (GLSurfaceView.java:1576)
  at org.godotengine.godot.gl.GLSurfaceView$GLThread.run (GLSurfaceView.java:1278)

"queued-work-looper" tid=22 Native
  #00  pc 0x000000000006f600  /system/lib64/libc.so (__epoll_pwait+8)
  #01  pc 0x0000000000014248  /system/lib64/libutils.so (android::Looper::pollInner(int)+144)
  #02  pc 0x0000000000014114  /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+60)
  #03  pc 0x00000000001231e4  /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)+44)
  at android.os.MessageQueue.nativePollOnce (Native method)
  at android.os.MessageQueue.next (MessageQueue.java:327)
  at android.os.Looper.loop (Looper.java:196)
  at android.os.HandlerThread.run (HandlerThread.java:65)

"ConnectivityThread" tid=11 Native
  #00  pc 0x000000000006f600  /system/lib64/libc.so (__epoll_pwait+8)
  #01  pc 0x0000000000014248  /system/lib64/libutils.so (android::Looper::pollInner(int)+144)
  #02  pc 0x0000000000014114  /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+60)
  #03  pc 0x00000000001231e4  /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)+44)
  at android.os.MessageQueue.nativePollOnce (Native method)
  at android.os.MessageQueue.next (MessageQueue.java:327)
  at android.os.Looper.loop (Looper.java:196)
  at android.os.HandlerThread.run (HandlerThread.java:65)

"GoogleApiHandler" tid=25 Native
  #00  pc 0x000000000006f600  /system/lib64/libc.so (__epoll_pwait+8)
  #01  pc 0x0000000000014248  /system/lib64/libutils.so (android::Looper::pollInner(int)+144)
  #02  pc 0x0000000000014114  /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+60)
  #03  pc 0x00000000001231e4  /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)+44)
  at android.os.MessageQueue.nativePollOnce (Native method)
  at android.os.MessageQueue.next (MessageQueue.java:327)
  at android.os.Looper.loop (Looper.java:196)
  at android.os.HandlerThread.run (HandlerThread.java:65)

"AdWorker(NG) #1" tid=26 Timed Waiting
  at java.lang.Object.wait (Native method)
  at java.lang.Thread.parkFor$ (Thread.java:2137)
  at sun.misc.Unsafe.park (Unsafe.java:358)
  at java.util.concurrent.locks.LockSupport.parkNanos (LockSupport.java:230)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos (AbstractQueuedSynchronizer.java:2101)
  at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1132)
  at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:849)
  at java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1092)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1152)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
  at java.lang.Thread.run (Thread.java:764)

"pool-4-thread-1" tid=28 Timed Waiting
  at java.lang.Object.wait (Native method)
  at java.lang.Thread.parkFor$ (Thread.java:2137)
  at sun.misc.Unsafe.park (Unsafe.java:358)
  at java.util.concurrent.locks.LockSupport.parkNanos (LockSupport.java:230)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos (AbstractQueuedSynchronizer.java:2101)
  at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1132)
  at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:849)
  at java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1092)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1152)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
  at java.lang.Thread.run (Thread.java:764)

"Chrome_ProcessLauncherThread" tid=30 Native
  #00  pc 0x000000000006f600  /system/lib64/libc.so (__epoll_pwait+8)
  #01  pc 0x0000000000014248  /system/lib64/libutils.so (android::Looper::pollInner(int)+144)
  #02  pc 0x0000000000014114  /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+60)
  #03  pc 0x00000000001231e4  /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)+44)
  at android.os.MessageQueue.nativePollOnce (Native method)
  at android.os.MessageQueue.next (MessageQueue.java:327)
  at android.os.Looper.loop (Looper.java:196)
  at android.os.HandlerThread.run (HandlerThread.java:65)

"GoogleApiHandler" tid=33 Native
  #00  pc 0x000000000006f600  /system/lib64/libc.so (__epoll_pwait+8)
  #01  pc 0x0000000000014248  /system/lib64/libutils.so (android::Looper::pollInner(int)+144)
  #02  pc 0x0000000000014114  /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+60)
  #03  pc 0x00000000001231e4  /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)+44)
  at android.os.MessageQueue.nativePollOnce (Native method)
  at android.os.MessageQueue.next (MessageQueue.java:327)
  at android.os.Looper.loop (Looper.java:196)
  at android.os.HandlerThread.run (HandlerThread.java:65)

"Chrome_IOThread" tid=34 Native
  #00  pc 0x000000000006f600  /system/lib64/libc.so (__epoll_pwait+8)
  #01  pc 0x00000000045144c0  /data/app/com.android.chrome-5y1WJhCX8DHAFFN7LHLdNw==/base.apk

"ThreadPoolForeg" tid=35 Native
  #00  pc 0x000000000001ed30  /system/lib64/libc.so (syscall+32)
  #01  pc 0x000000000002202c  /system/lib64/libc.so (__futex_wait_ex(void volatile*, bool, int, bool, timespec const*)+140)
  #02  pc 0x00000000000826e0  /system/lib64/libc.so (pthread_cond_timedwait+120)
  #03  pc 0x00000000022aa348  /data/app/com.android.chrome-5y1WJhCX8DHAFFN7LHLdNw==/base.apk

"Binder:18496_3" tid=36 Native
  #00  pc 0x000000000006f6ec  /system/lib64/libc.so (__ioctl+4)
  #01  pc 0x0000000000029168  /system/lib64/libc.so (ioctl+136)
  #02  pc 0x000000000005a844  /system/lib64/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+260)
  #03  pc 0x000000000005aa20  /system/lib64/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+24)
  #04  pc 0x000000000005b174  /system/lib64/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+60)
  #05  pc 0x000000000007bc4c  /system/lib64/libbinder.so (android::PoolThread::threadLoop()+28)
  #06  pc 0x000000000000fc08  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+280)
  #07  pc 0x00000000000b6634  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+140)
  #08  pc 0x0000000000083134  /system/lib64/libc.so (__pthread_start(void*)+36)
  #09  pc 0x00000000000233bc  /system/lib64/libc.so (__start_thread+68)

"PlatformServiceBridgeHandlerThread" tid=37 Native
  #00  pc 0x000000000006f600  /system/lib64/libc.so (__epoll_pwait+8)
  #01  pc 0x0000000000014248  /system/lib64/libutils.so (android::Looper::pollInner(int)+144)

In Google Play Dashboard there is extra message about the ANR:
This native synchronization routine is blocking the main thread, causing an ANR

I'm using quite a few Android plugins (I put the all in one plugin):

   implementation 'com.google.firebase:firebase-analytics:21.2.0'
   implementation 'com.google.android.gms:play-services-ads:21.3.0'
   implementation 'com.google.android.ump:user-messaging-platform:2.0.0'
   implementation "com.google.android.gms:play-services-games-v2:17.0.0"
   implementation 'com.google.android.play:review:2.0.1'

I use also GodotGooglePlayBilling

I'm not sure if it is bug or misuse of the engine - but I cannot provide you the steps to reproduce or MRP.

Steps to reproduce

I cannot provide this.

Minimal reproduction project

I cannot provide this.

@lawnjelly
Copy link
Member

lawnjelly commented Apr 11, 2023

Do these occur on latest 3.x? (i.e. 3.5.2?) Or is your project incompatible? Just in case some of these bugs are fixed.

@akien-mga
Copy link
Member

Judging by the stacktrace, this might also have been fixed by #65398, which is included in 3.6. We'll soon release 3.6 beta 1 which can be used for testing.

@ksvslk
Copy link
Author

ksvslk commented Apr 11, 2023

OK. Tested on 3.5 only now. I will wait for the 3.6 beta 1 and then make an update to get more info.

@ksvslk
Copy link
Author

ksvslk commented Apr 18, 2023

Same ANR in production with 3.6 beta 1.

Following is a mix of 3.5.1 and 3.6 beta 1.

Some devices it happens on:
Xiaomi olivelite
vivo 2036
OPPO OP4B80L1
POCO surya
Others

Some Android versions:
Android 9 (SDK 28)
Android 11 (SDK 30)
Android 10 (SDK 29)
Android 12 (SDK 31)
Android 12L (SDK 32)

Mostly happens when app is in the foreground.
EDIT: Add Google insights about this ANR: https://i.imgur.com/yZ9I3LK.png

"main" tid=1 Native
  #00  pc 0x000000000008a01c  /apex/com.android.runtime/lib64/bionic/libc.so (syscall+28)
  #01  pc 0x000000000008eaf0  /apex/com.android.runtime/lib64/bionic/libc.so (__futex_wait_ex(void volatile*, bool, int, bool, timespec const*)+144)

<<<- INSERTED BY GOOGLE  This native synchronization routine is blocking the main thread, causing an ANR - >>>

  #02  pc 0x00000000000fe7b0  /apex/com.android.runtime/lib64/bionic/libc.so (NonPI::MutexLockWithTimeout(pthread_mutex_internal_t*, bool, timespec const*)+656)
  #03  pc 0x00000000000fe380  /apex/com.android.runtime/lib64/bionic/libc.so (pthread_mutex_lock+256)
  #04  pc 0x00000000000c2d30  /data/app/~~jVCZve2c3Z4FqK9cQI_U_w==/com.mygame-TiANaJFzBkEKGwL_tqwrIQ==/split_config.arm64_v8a.apk (std::__ndk1::recursive_mutex::lock()+12)
  #05  pc 0x0000000000617660  /data/app/~~jVCZve2c3Z4FqK9cQI_U_w==/com.mygame-TiANaJFzBkEKGwL_tqwrIQ==/split_config.arm64_v8a.apk
  #06  pc 0x00000000005eff94  /data/app/~~jVCZve2c3Z4FqK9cQI_U_w==/com.mygame-TiANaJFzBkEKGwL_tqwrIQ==/split_config.arm64_v8a.apk
  #07  pc 0x00000000005f069c  /data/app/~~jVCZve2c3Z4FqK9cQI_U_w==/com.mygame-TiANaJFzBkEKGwL_tqwrIQ==/split_config.arm64_v8a.apk
  #08  pc 0x00000000005fcbec  /data/app/~~jVCZve2c3Z4FqK9cQI_U_w==/com.mygame-TiANaJFzBkEKGwL_tqwrIQ==/split_config.arm64_v8a.apk (Java_org_godotengine_godot_GodotLib_dispatchTouchEvent+212)
  at org.godotengine.godot.GodotLib.dispatchTouchEvent (Native method)
  at org.godotengine.godot.input.GodotInputHandler.handleTouchEvent (GodotInputHandler.java:534)
  at org.godotengine.godot.input.GodotInputHandler.handleTouchEvent (GodotInputHandler.java:519)
  at org.godotengine.godot.input.GodotInputHandler.handleMotionEvent (GodotInputHandler.java:438)
  at org.godotengine.godot.input.GodotGestureHandler.onSingleTapUp (GodotGestureHandler.kt:71)
  at android.view.GestureDetector.onTouchEvent (GestureDetector.java:824)
  at org.godotengine.godot.input.GodotInputHandler.onTouchEvent (GodotInputHandler.java:181)
  at org.godotengine.godot.GodotView.onTouchEvent (GodotView.java:111)
  at android.view.View.dispatchTouchEvent (View.java:15544)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3316)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2990)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3316)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2990)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3316)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2990)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3316)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2990)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3316)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2990)
  at com.android.internal.policy.DecorView.superDispatchTouchEvent (DecorView.java:1112)
  at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent (PhoneWindow.java:1971)
  at android.app.Activity.dispatchTouchEvent (Activity.java:4388)
  at com.android.internal.policy.DecorView.dispatchTouchEvent (DecorView.java:1070)
  at android.view.View.dispatchPointerEvent (View.java:15803)
  at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent (ViewRootImpl.java:8153)
  at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess (ViewRootImpl.java:7877)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:7213)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:7270)
  at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:7236)
  at android.view.ViewRootImpl$AsyncInputStage.forward (ViewRootImpl.java:7434)
  at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:7244)
  at android.view.ViewRootImpl$AsyncInputStage.apply (ViewRootImpl.java:7491)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:7217)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:7270)
  at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:7236)
  at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:7244)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:7217)
  at android.view.ViewRootImpl.deliverInputEvent (ViewRootImpl.java:10788)
  at android.view.ViewRootImpl.doProcessInputEvents (ViewRootImpl.java:10676)
  at android.view.ViewRootImpl.enqueueInputEvent (ViewRootImpl.java:10632)
  at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent (ViewRootImpl.java:10926)
  at android.view.InputEventReceiver.dispatchInputEvent (InputEventReceiver.java:285)
  at android.os.MessageQueue.nativePollOnce (Native method)
  at android.os.MessageQueue.next (MessageQueue.java:335)
  at android.os.Looper.loopOnce (Looper.java:186)
  at android.os.Looper.loop (Looper.java:313)
  at android.app.ActivityThread.main (ActivityThread.java:8757)
  at java.lang.reflect.Method.invoke (Native method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)

"Signal Catcher" tid=5 Runnable
  #00  pc 0x0000000000535c24  /apex/com.android.art/lib64/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+128)
  #01  pc 0x00000000006efd94  /apex/com.android.art/lib64/libart.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool, BacktraceMap*, bool) const+236)
  #02  pc 0x00000000006fd620  /apex/com.android.art/lib64/libart.so (art::DumpCheckpoint::Run(art::Thread*)+208)
  #03  pc 0x0000000000362a60  /apex/com.android.art/lib64/libart.so (art::ThreadList::RunCheckpoint(art::Closure*, art::Closure*)+440)
  #04  pc 0x00000000006fbdc0  /apex/com.android.art/lib64/libart.so (art::ThreadList::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool)+280)
  #05  pc 0x00000000006fb7b4  /apex/com.android.art/lib64/libart.so (art::ThreadList::DumpForSigQuit(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+292)
  #06  pc 0x00000000006d4904  /apex/com.android.art/lib64/libart.so (art::Runtime::DumpForSigQuit(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+184)
  #07  pc 0x00000000006e0924  /apex/com.android.art/lib64/libart.so (art::SignalCatcher::HandleSigQuit()+468)
  #08  pc 0x000000000056fa5c  /apex/com.android.art/lib64/libart.so (art::SignalCatcher::Run(void*)+264)
  #09  pc 0x00000000000fd040  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208)
  #10  pc 0x000000000008f5e0  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)

"perfetto_hprof_listener" tid=7 Native
  #00  pc 0x00000000000e7094  /apex/com.android.runtime/lib64/bionic/libc.so (read+4)
  #01  pc 0x000000000001d840  /apex/com.android.art/lib64/libperfetto_hprof.so (void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, ArtPlugin_Initialize::$_34> >(void*)+260)
  #02  pc 0x00000000000fd040  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208)
  #03  pc 0x000000000008f5e0  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)

"Jit thread pool worker thread 0" tid=8 Native
  #00  pc 0x000000000008a01c  /apex/com.android.runtime/lib64/bionic/libc.so (syscall+28)
  #01  pc 0x000000000047a830  /apex/com.android.art/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+140)
  #02  pc 0x000000000047a6c8  /apex/com.android.art/lib64/libart.so (art::ThreadPool::GetTask(art::Thread*)+120)
  #03  pc 0x0000000000615214  /apex/com.android.art/lib64/libart.so (art::ThreadPoolWorker::Run()+136)
  #04  pc 0x00000000006150f4  /apex/com.android.art/lib64/libart.so (art::ThreadPoolWorker::Callback(void*)+160)
  #05  pc 0x00000000000fd040  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208)
  #06  pc 0x000000000008f5e0  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)

"HeapTaskDaemon" tid=9 Waiting
  #00  pc 0x000000000008a01c  /apex/com.android.runtime/lib64/bionic/libc.so (syscall+28)
  #01  pc 0x000000000047a830  /apex/com.android.art/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+140)
  #02  pc 0x000000000046ad3c  /apex/com.android.art/lib64/libart.so (art::gc::TaskProcessor::GetTask(art::Thread*)+736)
  #03  pc 0x000000000046aa10  /apex/com.android.art/lib64/libart.so (art::gc::TaskProcessor::RunAllTasks(art::Thread*)+32)
  at dalvik.system.VMRuntime.runHeapTasks (Native method)
  at java.lang.Daemons$HeapTaskDaemon.runInternal (Daemons.java:609)
  at java.lang.Daemons$Daemon.run (Daemons.java:140)
  at java.lang.Thread.run (Thread.java:1012)

"ReferenceQueueDaemon" tid=10 Waiting
  at java.lang.Object.wait (Native method)
  at java.lang.Object.wait (Object.java:442)
  at java.lang.Object.wait (Object.java:568)
  at java.lang.Daemons$ReferenceQueueDaemon.runInternal (Daemons.java:232)
  at java.lang.Daemons$Daemon.run (Daemons.java:140)
  at java.lang.Thread.run (Thread.java:1012)

"FinalizerDaemon" tid=11 Waiting
  at java.lang.Object.wait (Native method)
  at java.lang.Object.wait (Object.java:442)
  at java.lang.ref.ReferenceQueue.remove (ReferenceQueue.java:203)
  at java.lang.ref.ReferenceQueue.remove (ReferenceQueue.java:224)
  at java.lang.Daemons$FinalizerDaemon.runInternal (Daemons.java:300)
  at java.lang.Daemons$Daemon.run (Daemons.java:140)
  at java.lang.Thread.run (Thread.java:1012)

"FinalizerWatchdogDaemon" tid=12 Timed Waiting
  at java.lang.Thread.sleep (Native method)
  at java.lang.Thread.sleep (Thread.java:450)
  at java.lang.Thread.sleep (Thread.java:355)
  at java.lang.Daemons$FinalizerWatchdogDaemon.sleepForNanos (Daemons.java:438)
  at java.lang.Daemons$FinalizerWatchdogDaemon.waitForProgress (Daemons.java:480)
  at java.lang.Daemons$FinalizerWatchdogDaemon.runInternal (Daemons.java:369)
  at java.lang.Daemons$Daemon.run (Daemons.java:140)
  at java.lang.Thread.run (Thread.java:1012)

"binder:25804_1" tid=13 Native
  #00  pc 0x00000000000e7374  /apex/com.android.runtime/lib64/bionic/libc.so (__ioctl+4)
  #01  pc 0x0000000000098e0c  /apex/com.android.runtime/lib64/bionic/libc.so (ioctl+156)
  #02  pc 0x000000000005b3ac  /system/lib64/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+284)
  #03  pc 0x000000000005b6a8  /system/lib64/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+24)
  #04  pc 0x000000000005bfc4  /system/lib64/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+68)
  #05  pc 0x000000000008c21c  /system/lib64/libbinder.so (android::PoolThread::threadLoop()+444)
  #06  pc 0x0000000000013550  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+416)
  #07  pc 0x00000000000cd7bc  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+140)
  #08  pc 0x00000000000fd040  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208)
  #09  pc 0x000000000008f5e0  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)

"binder:25804_2" tid=14 Native
  #00  pc 0x00000000000e7374  /apex/com.android.runtime/lib64/bionic/libc.so (__ioctl+4)
  #01  pc 0x0000000000098e0c  /apex/com.android.runtime/lib64/bionic/libc.so (ioctl+156)
  #02  pc 0x000000000005b3ac  /system/lib64/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+284)
  #03  pc 0x000000000005b6a8  /system/lib64/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+24)
  #04  pc 0x000000000005bfc4  /system/lib64/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+68)
  #05  pc 0x000000000008c21c  /system/lib64/libbinder.so (android::PoolThread::threadLoop()+444)
  #06  pc 0x0000000000013550  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+416)
  #07  pc 0x00000000000cd7bc  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+140)
  #08  pc 0x00000000000fd040  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208)
  #09  pc 0x000000000008f5e0  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)

"binder:25804_3" tid=15 Native
  #00  pc 0x00000000000e7374  /apex/com.android.runtime/lib64/bionic/libc.so (__ioctl+4)
  #01  pc 0x0000000000098e0c  /apex/com.android.runtime/lib64/bionic/libc.so (ioctl+156)
  #02  pc 0x000000000005b3ac  /system/lib64/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+284)
  #03  pc 0x000000000005b6a8  /system/lib64/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+24)
  #04  pc 0x000000000005bfc4  /system/lib64/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+68)
  #05  pc 0x000000000008c21c  /system/lib64/libbinder.so (android::PoolThread::threadLoop()+444)
  #06  pc 0x0000000000013550  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+416)
  #07  pc 0x00000000000cd7bc  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+140)
  #08  pc 0x00000000000fd040  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208)
  #09  pc 0x000000000008f5e0  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)

"Profile Saver" tid=16 Native
  #00  pc 0x000000000008a01c  /apex/com.android.runtime/lib64/bionic/libc.so (syscall+28)
  #01  pc 0x000000000047a830  /apex/com.android.art/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+140)
  #02  pc 0x000000000053ecb8  /apex/com.android.art/lib64/libart.so (art::ProfileSaver::Run()+372)
  #03  pc 0x0000000000534504  /apex/com.android.art/lib64/libart.so (art::ProfileSaver::RunProfileSaverThread(void*)+148)
  #04  pc 0x00000000000fd040  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208)
  #05  pc 0x000000000008f5e0  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)

"ScionFrontendApi" tid=17 Timed Waiting
  at jdk.internal.misc.Unsafe.park (Native method)
  at java.util.concurrent.locks.LockSupport.parkNanos (LockSupport.java:234)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos (AbstractQueuedSynchronizer.java:2123)
  at java.util.concurrent.LinkedBlockingQueue.poll (LinkedBlockingQueue.java:458)
  at java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1062)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1123)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:637)
  at java.lang.Thread.run (Thread.java:1012)

"WM.task-1" tid=20 Waiting
  at jdk.internal.misc.Unsafe.park (Native method)
  at java.util.concurrent.locks.LockSupport.park (LockSupport.java:194)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2081)
  at java.util.concurrent.LinkedBlockingQueue.take (LinkedBlockingQueue.java:433)
  at java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1063)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1123)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:637)
  at java.lang.Thread.run (Thread.java:1012)

"GmsDynamite" tid=21 Waiting
  at java.lang.Object.wait (Native method)
  at java.lang.Object.wait (Object.java:442)
  at java.lang.Object.wait (Object.java:568)
  at com.google.android.gms.dynamite.zza.run (com.google.android.gms:play-services-basement@@18.1.0:2)

"RenderThread" tid=22 Native
  #00  pc 0x00000000000e8358  /apex/com.android.runtime/lib64/bionic/libc.so (__epoll_pwait+8)
  #01  pc 0x0000000000017ffc  /system/lib64/libutils.so (android::Looper::pollInner(int)+188)
  #02  pc 0x0000000000017ee0  /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+112)
  #03  pc 0x000000000051c5ec  /system/lib64/libhwui.so (android::uirenderer::ThreadBase::waitForWork()+156)
  #04  pc 0x000000000053dd3c  /system/lib64/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+412)
  #05  pc 0x0000000000013550  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+416)
  #06  pc 0x00000000000fd040  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208)
  #07  pc 0x000000000008f5e0  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)

"GoogleApiHandler" tid=23 Native
  #00  pc 0x00000000000e8358  /apex/com.android.runtime/lib64/bionic/libc.so (__epoll_pwait+8)
  #01  pc 0x0000000000017ffc  /system/lib64/libutils.so (android::Looper::pollInner(int)+188)
  #02  pc 0x0000000000017ee0  /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+112)
  #03  pc 0x0000000000166c7c  /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)+44)
  at android.os.MessageQueue.nativePollOnce (Native method)
  at android.os.MessageQueue.next (MessageQueue.java:335)
  at android.os.Looper.loopOnce (Looper.java:186)
  at android.os.Looper.loop (Looper.java:313)
  at android.os.HandlerThread.run (HandlerThread.java:67)

"WM.task-2" tid=26 Waiting
  at jdk.internal.misc.Unsafe.park (Native method)
  at java.util.concurrent.locks.LockSupport.park (LockSupport.java:194)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2081)
  at java.util.concurrent.LinkedBlockingQueue.take (LinkedBlockingQueue.java:433)
  at java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1063)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1123)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:637)
  at java.lang.Thread.run (Thread.java:1012)

"GLThread 139" tid=25 Native
  #00  pc 0x00000000000e7ef4  /apex/com.android.runtime/lib64/bionic/libc.so (recvfrom+4)
  #01  pc 0x00000000000298c8  /apex/com.android.art/lib64/libopenjdk.so (NET_Read+80)
  #02  pc 0x000000000002a440  /apex/com.android.art/lib64/libopenjdk.so (SocketInputStream_socketRead0+216)
  at java.net.SocketInputStream.socketRead0 (Native method)
  at java.net.SocketInputStream.socketRead (SocketInputStream.java:118)
  at java.net.SocketInputStream.read (SocketInputStream.java:173)

ALSO: This ANR is happening in game built with 3.3.0 mono.

@m4gr3d
Copy link
Contributor

m4gr3d commented Apr 20, 2023

@ksvslk Do you use accumulated input or input buffering in your game?

cc @RandomShaper, if the issue occurs despite either options being enabled, we may need to revisit the previous approach which would dispatch input events on a separate thread.

@ksvslk
Copy link
Author

ksvslk commented Apr 20, 2023

@ksvslk Do you use accumulated input or input buffering in your game?

cc @RandomShaper, if the issue occurs despite either options being enabled, we may need to revisit the previous approach which would dispatch input events on a separate thread.

I use the default values for these.

@suzanshakya
Copy link

@ksvslk Hi,
We are also getting this ANR in our android game.
How did you fix or workaround this ANR issue?

Thank you!

@ksvslk
Copy link
Author

ksvslk commented Mar 4, 2024

@ksvslk Hi, We are also getting this ANR in our android game. How did you fix or workaround this ANR issue?

Thank you!

I'm using 3.5.3 stable now and have not seen these anymore.

@lawnjelly
Copy link
Member

@ksvslk Hi, We are also getting this ANR in our android game. How did you fix or workaround this ANR issue?

Thank you!

If you can, do let us know what version you experienced them in, so we can establish whether the fix worked, or the issue should be reopened.

@suzanshakya
Copy link

suzanshakya commented Mar 4, 2024

We are also using 3.5.3, but still getting the recursive_mutex::lock() ANR.

This ANR is predominant in low end devices.

Our ANR distribution varies across RAM capacity as below:
0.5 - 1 GB -> 3.94%
1.5 - 2 GB -> 0.92%
2 - 3 GB -> 0.50%
3 - 4 GB -> 0.32%
5 - 6 GB -> 0.13%
6 - 8 GB -> 0.08%
≥ 8GB -> 0.07%

Google Play Console's threshold rate is 0.47%, and we are just above it at 0.48%

Please let me know if you need any other info.

Thank you.

@suzanshakya
Copy link

@lawnjelly Would you recommend cherrypicking #76839 on 3.5.3?
Only way to test is to make public release and see the ANR data for about 1 week!

@ksvslk
Copy link
Author

ksvslk commented Mar 4, 2024

@ksvslk Hi, We are also getting this ANR in our android game. How did you fix or workaround this ANR issue?
Thank you!

If you can, do let us know what version you experienced them in, so we can establish whether the fix worked, or the issue should be reopened.

I went from 3.6.beta2 to 3.5.3.stable.
Last 90 days has 0 crashes/ANRs - but only 176 users in this timeframe.

@lawnjelly
Copy link
Member

lawnjelly commented Mar 7, 2024

Would you recommend cherrypicking #76839 on 3.5.3?
Only way to test is to make public release and see the ANR data for about 1 week!

This seems to be a misconception, my PR there was primarily to improve agile input, it had the side effect of also potentially fixing the input thread calling user code and hence giving ANRs. This was written before another fix was merged to address the ANRs, so I can't guarantee that my draft PR would have any improvement.

What we really need is a minimum reproduction project to examine ANRs. There are a lot of possible causes, and to suggest a PR might fix it is straying towards magical thinking. Things that are likely to cause a problem are things like advertising addons running on the input thread, or doing some other time sapping process.

You can probably test this yourself by storing the input yourself and deferring your action, and acting on it instead inside _process, instead of reacting to it immediately, and see if it cures ANR. To try and cause ANR, maybe try reacting to the input by doing some expensive processing for 10/15 seconds.

Our ANR distribution varies across RAM capacity as below:

This suggests something is being done (on the input thread? but maybe also on the main thread, it's a while since I looked at this) which is taking too long to process and return control to the OS. Without an MRP, we have no idea what this might be, it might be user side, or something in the engine.

@suzanshakya
Copy link

Thanks @lawnjelly. I appreciate your inputs.

Is it possible to use GameActivity instead of FragmentActivity in FullScreenGodotApp?

Unity recently added support for GameActivity, and they reported reduction in ANR.

If you could share any insights upon how difficult it would be to integrate GameActivity in Godot 3.6, that would help us to decide whether to pursue further on trying to integrate it ourselves, or to hire somebody expert to do it.

@lawnjelly
Copy link
Member

@suzanshakya That's really one for @m4gr3d , who is our Android expert.

@m4gr3d
Copy link
Contributor

m4gr3d commented Nov 1, 2024

Thanks @lawnjelly. I appreciate your inputs.

Is it possible to use GameActivity instead of FragmentActivity in FullScreenGodotApp?

No. We were consulted early on to provide feedback on the design of GameActivity, and our feedback was that it does improve on what was previously available (i.e: NativeActivity) but it doesn't do anything different than what Godot is already doing and doesn't bring any benefits. In fact, GameActivity would take away some of Godot capabilities given it's built on the activity model, a design we moved away from long before GameActivity was released.

Unity recently added support for GameActivity, and they reported reduction in ANR.

If you could share any insights upon how difficult it would be to integrate GameActivity in Godot 3.6, that would help us to decide whether to pursue further on trying to integrate it ourselves, or to hire somebody expert to do it.

We've made several improvements to address ANR on the 4.x branch and from discussing with Google, Godot 4.x ANR rate is one of the lowest among game engines, so the primary concern here is the ability to backport those changes to the 3.x branch.

Unfortunately I am only able to cover the 4.x branch (volunteer maintainer with a non-Godot related full time job), so the best way to help would be to support the 3.x contributors and the Godot Foundation so they can dedicate more resources to address those issues.

@suzanshakya
Copy link

Thanks a lot @lawnjelly and @m4gr3d for your valuable insights.

We are open to supporting and sponsoring 3.x contributors to bring the ANR related fixes to 3.x.
Can you let me know who should I contact for this?

If that's not possible, we will plan to migrate our game to 4.3 or 4.4 (when it will be available).
Anyway, thanks again.

@lawnjelly
Copy link
Member

lawnjelly commented Nov 8, 2024

@suzanshakya

First port of call should be to load your project in 3.6 latest, it should be trivial to update minor version, and it may be that it is fixed already.

For paid support, as far as I understand it:

  • there are some Godot support companies (but they may not be available for smaller jobs)
  • we don't currently have a system for recommending developers.

You could try asking in rocket chat (in devel channel maybe?) or on the forum, or on a general Android c++ forum (not Godot specific, it is open source and fairly easy to compile and read).

(I personally don't have the bandwidth to look at this either (especially not without MRP), and I am far from expert at Android specifics. Bear in mind also that I am not a spokesperson for the project, just a volunteer maintainer.)

@m4gr3d
Copy link
Contributor

m4gr3d commented Nov 8, 2024

Thanks a lot @lawnjelly and @m4gr3d for your valuable insights.

We are open to supporting and sponsoring 3.x contributors to bring the ANR related fixes to 3.x. Can you let me know who should I contact for this?

If that's not possible, we will plan to migrate our game to 4.3 or 4.4 (when it will be available). Anyway, thanks again.

cc @coppolaemilio @akien-mga

@coppolaemilio
Copy link
Member

The Foundation can't take money to work on a particular issue, but there are a lot of Godot contractors that might want to take on the job. I think the best idea if you are going to be supporting the project for a long time is to port to Godot 4, but if not, I would look for some company or developer that can backport the ANR fixes to 3.x. You can write me at [email protected]. Cheers!

@suzanshakya
Copy link

Thanks @coppolaemilio for your inputs.
I shall email you soon!

@suzanshakya
Copy link

Hi @coppolaemilio,
I had emailed you the last week. I was wondering if it reached your inbox successfully.
Could you please confirm?

Thanks!

@coppolaemilio
Copy link
Member

Hello @suzanshakya, I got it, but I'm a bit behind with my emails. I'll get to it soon. Sorry for the delay!

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

Successfully merging a pull request may close this issue.

7 participants