Closed heroic closed 1 year ago
The issue is valid!
I am experiencing exactly the same issue since upgrading to 2.3 in production.
Input dispatching timed out (9fff00a [My app Activity] (server) is not responding. Waited 10002ms for FocusEvent(hasFocus=false))
"main" prio=5 tid=1 Waiting
at sun.misc.Unsafe.park (Native method)
at java.util.concurrent.locks.LockSupport.park (LockSupport.java:190)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt (AbstractQueuedSynchronizer.java:868)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly (AbstractQueuedSynchronizer.java:1023)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly (AbstractQueuedSynchronizer.java:1334)
at java.util.concurrent.Semaphore.acquire (Semaphore.java:318)
at com.swmansion.reanimated.NodesManager.performOperations (NodesManager.java:249)
at com.swmansion.reanimated.NodesManager.onAnimationFrame (NodesManager.java:278)
at com.swmansion.reanimated.NodesManager.access$000 (NodesManager.java:63)
at com.swmansion.reanimated.NodesManager$1.doFrameGuarded (NodesManager.java:168)
at com.facebook.react.uimanager.GuardedFrameCallback.doFrame (GuardedFrameCallback.java:29)
at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame (ReactChoreographer.java:175)
at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame (ChoreographerCompat.java:85)
at android.view.Choreographer$CallbackRecord.run (Choreographer.java:970)
at android.view.Choreographer.doCallbacks (Choreographer.java:796)
at android.view.Choreographer.doFrame (Choreographer.java:727)
at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:957)
at android.os.Handler.handleCallback (Handler.java:938)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loop (Looper.java:250)
at android.app.ActivityThread.main (ActivityThread.java:7868)
at java.lang.reflect.Method.invoke (Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:958)
Hey @heroic
Did you find any solution for it? We started facing a similar issue when we moved from APK to App bundle.
Thanks.
Hi all, thanks for reporting. The ANR is likely cause by a deadlock due to the code we use for making synchronizing UI updates. However, w/o more details it is very little we can do about it. It'd be important for us to get some more information about what kind of animations run when this occurs, or get traces from other threads if available. Any kind of additional detail that you may share may be helpful in getting to the bottom of this issue.
From what I can tell the only animations that are happening are the React Navigation screen changes. We're seeing this when going from one Screen
to a Screen
containing Tabs
, and also when going from one simple Screen
to another Screen
.
Here's a pastebin from one of the crash logs: https://pastebin.com/pxBRCn63
@heroic
Can you please confirm your react navigation version?
We are also seeing similar behavior at the same place where we are using Stack navigation > Tab navigation
@joy-betterhalf RN v5
@kmagiera In our case, we have tried removing every place where we directly use react-native-reanimated
for animation and kept the library as a dependency for other modules such as https://gorhom.github.io/react-native-bottom-sheet/
still we are getting many ANRs with the same error everyone facing here and we are not sure what causes the ANR and that's why I asked @heroic on React navigation version since I thought it's old and could be causing this problem. We were using V4 which now migrated to V5 but still, we are facing the same issue.
Same issue here
We have the same issue.
can we merge this ? still facing this issue..
Yes, please merge the PR #3440 in the master and release an update to hopefully fix this issue. Thanks!
Facing same issue on android multiple devices: React-native : 0.66.4 react-native-reanimated : 2.9.1 (^2.2 on package.json)
"dependencies": { "@ptomasroos/react-native-multi-slider": "^2.2.2", "@react-native-async-storage/async-storage": "^1.15.4", "@react-native-community/art": "https://github.com/react-native-art/art.git", "@react-native-community/blur": "^3.6.0", "@react-native-community/masked-view": "^0.1.10", "@react-native-community/slider": "^3.0.3", "@react-native-firebase/analytics": "^11.5.0", "@react-native-firebase/app": "^11.5.0", "@react-native-firebase/crashlytics": "^11.5.0", "@react-native-firebase/messaging": "^11.5.0", "@react-native-firebase/perf": "^11.5.0", "@react-navigation/bottom-tabs": "^5.11.9", "@react-navigation/native": "^5.9.4", "@react-navigation/stack": "^5.14.4", "@reduxjs/toolkit": "^1.5.1", "@sentry/react-native": "^3.1.1", "@shopify/restyle": "^1.4.0", "@snowplow/react-native-tracker": "^1.2.1", "axios": "^0.21.1", "babel-plugin-module-resolver": "^4.1.0", "babel-plugin-transform-remove-console": "^6.9.4", "clevertap-react-native": "^0.8.1", "launchdarkly-react-native-client-sdk": "^5.1.0", "lodash": "^4.17.21", "lottie-ios": "3.4.0", "lottie-react-native": "^5.1.3", "moment": "^2.29.1", "query-string": "^7.0.0", "react": "17.0.2", "react-native": "0.66.3", "react-native-branch": "^5.5.0", "react-native-code-push": "^7.0.4", "react-native-dash": "^0.0.11", "react-native-dropdown-picker": "5.0", "react-native-fast-image": "^8.3.4", "react-native-fbsdk-next": "^7.0.1", "react-native-flipper": "^0.91.2", "react-native-geocoding": "^0.5.0", "react-native-geolocation-service": "5.2.0", "react-native-gesture-handler": "^2.4.0", "react-native-image-pan-zoom": "^2.1.12", "react-native-in-app-review": "^3.2.3", "react-native-linear-gradient": "^2.5.6", "react-native-modal": "^13.0.1", "react-native-modal-dropdown": "^1.0.0", "react-native-neomorph-shadows": "^1.1.2", "react-native-otp-verify": "^1.0.4", "react-native-pager-view": "^5.1.9", "react-native-progress": "^5.0.0", "react-native-radial-gradient": "^1.0.9", "react-native-reanimated": "2.6.0", "react-native-render-html": "^6.3.4", "react-native-safe-area-context": "^3.2.0", "react-native-screens": "^3.1.1", "react-native-shimmer-placeholder": "^2.0.7", "react-native-simple-toast": "^1.1.3", "react-native-size-matters": "^0.4.0", "react-native-smooth-picker": "^1.1.5", "react-native-splash-screen": "^3.2.0", "react-native-svg": "^12.1.1", "react-native-svg-transformer": "^0.14.3", "react-native-tab-view": "^3.0.1", "react-native-tracking-transparency": "^0.1.1", "react-native-ultimate-config": "^3.3.4", "react-native-version-info": "^1.1.0", "react-native-video": "^5.2.0", "react-native-walkthrough-tooltip": "^1.3.0", "react-native-webview": "^11.4.0", "react-native-wheel-scrollview-picker": "^2.0.0", "react-redux": "^7.2.3", "redux-flipper": "^1.4.2", "redux-logger": "^3.0.6", "redux-persist": "^6.0.0", "yup": "^0.32.9" },
Did anyone tried this change https://github.com/software-mansion/react-native-reanimated/pull/3440 in prod?
We're seeing this as well and it started when we integrated react-native-reanimated-carousel. If we show a carousel right away after app launch, the app hangs and never recovers. I don't know if that helps you but we had to disable our tutorial carousel as a result and are still seeing ANRs as a result. The crash happens before there is any interaction with the carousel.
We don't use react-native-reanimated-carousel
but this ANR started increasing for us once we added more animations on the same screen using reanimated.
Quick update from our side. We patched this fix (using rn-patch) and shipped on prod https://github.com/software-mansion/react-native-reanimated/pull/3440 and number of ANRs decreased significantly! 🚀 In order to patch it properly, we needed to force rebuild reanimated from source by passing reanimated = [ buildFromSource: true ]
to gradle config.
There's a small issue with this approach, but overall the app is more stable
Same ANRs in production here! This is by far the most common ANR cause in our apps at the moment (+60%) Any workarounds while the bug is fixed?
See my comment above
Following. We are also seeing significant crashes for iOS that appear related to this, thousands daily.
@androideveloper is your fix working well so far in production app ? any issues you see like animation is starting with delay ? we are also seeing same ANRs on play console.
No major issues so far 👍
Thanks for the help @androideveloper, we had added the patch https://github.com/software-mansion/react-native-reanimated/pull/3440 in our app. This helps us to fix the ANR issue on the app 👍
But using the above fix we facing an increase in user crashes, below is the crash log for the same.
Fatal Exception: com.facebook.jni.CppException: bad_weak_ptr
at com.swmansion.reanimated.Scheduler.triggerUI(Scheduler.java)
at com.swmansion.reanimated.Scheduler$1.run(Scheduler.java:24)
at com.swmansion.reanimated.Scheduler$2.runGuarded(Scheduler.java:43)
at com.facebook.react.bridge.GuardedRunnable.run(GuardedRunnable.java:31)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:257)
at android.app.ActivityThread.main(ActivityThread.java:8218)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:626)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1016)
We are using react-native
version 0.69.4
and react-native-reanimated
version 2.12.0
.
@androideveloper we have also applied the patch. no anr or issue so far. @prince-housing we were also facing this crash. I can confirm react-native-reanimated 3.0.0 solved the issue for us. no instances seen after 3.0.0.
@pavangoyal42 did you also use the patch with react-native-reanimated
3.0.0
?
@prince-housing yes I have used patch with 3.0.0. this solved the crash and ANR. so side effects as of now.
Fixed with https://github.com/software-mansion/react-native-reanimated/pull/4239, the fix is available since 3.+ versions
Description
We are seeing multiple ANRs with reanimated at the top of the stacktrace. These are not showing in bugsnag either, only on Play Store which is now penalising our app.
Expected behavior
No ANR
Actual behavior & steps to reproduce
Snack or minimal code example
None available
Package versions
Affected platforms