react-native: Random crash on Android (Animated node with tag (child) [xxxx] does not exist)
Description
I can not find any pattern to get to the crash issue.
It randomly crashes on any screen.
Please help me if anyone knows about this issue.
Version
0.67.1,0.68.1(no new arch)
Output of npx react-native info
System: OS: macOS 12.1 CPU: (10) arm64 Apple M1 Max Memory: 108.63 MB / 64.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.14.2 - /usr/local/bin/node Yarn: 1.22.15 - /usr/local/bin/yarn npm: 8.5.0 - /usr/local/bin/npm Watchman: 2022.03.21.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /Users/mike_1_2/.rvm/gems/ruby-2.7.4/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7935034 Xcode: 13.3/13E113 - /usr/bin/xcodebuild Languages: Java: 11.0.11 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.67.4 => 0.67.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
I can not find any pattern to get to the crash issue.
It completely randomly crashes on any screen.
This is the stacktrace I got from bugsnag.
com.facebook.react.bridge.JSApplicationIllegalArgumentException: connectAnimatedNodes: Animated node with tag (child) [7965] does not exist at com.facebook.react.animated.NativeAnimatedNodesManager.connectAnimatedNodes(NativeAnimatedNodesManager.java:340) at com.facebook.react.animated.NativeAnimatedModule$15.execute(NativeAnimatedModule.java:681) at com.facebook.react.animated.NativeAnimatedModule.executeAllOperations(NativeAnimatedModule.java:258) at com.facebook.react.animated.NativeAnimatedModule.access$400(NativeAnimatedModule.java:85) at com.facebook.react.animated.NativeAnimatedModule$3.execute(NativeAnimatedModule.java:287) at com.facebook.react.uimanager.UIViewOperationQueue$UIBlockOperation.execute(UIViewOperationQueue.java:579) at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:915) at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1026) at com.facebook.react.uimanager.UIViewOperationQueue.access$2600(UIViewOperationQueue.java:47) at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1086) 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:1106) at android.view.Choreographer.doCallbacks(Choreographer.java:866) at android.view.Choreographer.doFrame(Choreographer.java:792) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1092) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8663) at java.lang.reflect.Method.invoke(Method.java:-2) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
Snack, code example, screenshot, or link to a repository
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 7
- Comments: 47 (3 by maintainers)
We also see this crash quite often. It is our top crash. Providing a reproducible sample is not possible as we don’t know what exactly causes it and it happens only from time to time for our clients. Please reopen and investigate in more detail and spend more time as the clues clearly point to an issue in the react framework.
I was able to create a reproducible example in a test build where I added 20 swimlanes of which 2 out of 3 randomly animate, the screen is quite heavy but if you navigate a few times the app eventually crashes quite quickly with little effort.
Mostly with this exception:
But sometimes also with this one:
Both seem to originate from NativeAnimatedNodesManager.java.
https://user-images.githubusercontent.com/1210628/234848355-ed5b4d7c-8d4d-43fe-bba7-286567cbc70b.mp4
A reproducible example can be found here: https://github.com/wouterds/react-native-tv-example/tree/bug/animation-crash
I can’t attach the .apk because it’s above the limits of GitHub file upload, but crashlog, video & apk can be found here: https://drops.evix.io/rn-crash-connectAnimatedNodes/
any solution for this one?
It’s incredible how this error has existed for years and still without any correction.
Setting
useNativeDriver: false
everywhere is not a solution, it’s a bad workaround imo. The UX suffers greatly.are you available this weekend? we can fix together.
We are on 0.71.3 and are still facing this crash on Android 12
The bug is inside
react-native
.I believe the problem here is the bug is not consistently reproducible to begin with. We’ve received 230 crashes in the last week for example, with the following distribution in devices / versions.
Try as I might, can’t reproduce it at will.
@LiuIos @bhavzie as far as I know, it’s never been explicitly fixed. The main issue (https://github.com/facebook/react-native/issues/33375) was closed and it wasn’t really re-opened elsewhere / people stopped talking about it (assuming it had been fixed along the way).
I tried creating an example repository to reproduce the issue but so far I could not. We do see the issue in our project at work though. What seems related is
useAnimatedDriver: true
. If we set this explicitly to false everywhere (also in all libraries used by the project) we notice significantly fewer crashes. But that degrades UX as well, especially on Android you see the animations stutter a lot and they’re far from smooth.I’m not saying it is the cause but it is definitely related. I don’t have enough experience with native Android development to further debug this, unfortunately.
An example repository I once made is using the
react-native-tvos
fork, which currently runs on 0.69.8, compiles for both iOS, tvOS, Android Mobile & Android TV but essentially it’s the same bug. However as mentioned above, I can not reproduce it in the example yet. Probably because it doesn’t contain enough animations, I will look into adding some animated shimmer components that might help reproducing it.please reopen
I’m still facing this issue on Android 12
+1 very similar numbers ^ It’s only on Android 12 and it isn’t consistently reproducible, hence the numbers aren’t exactly super high
is there any solution ?