react-native: Android App Crash with `Animated node with tag (child) [xxxx] does not exists`
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:
04-27 13:20:21.717 27102 27102 E AndroidRuntime: FATAL EXCEPTION: main
04-27 13:20:21.717 27102 27102 E AndroidRuntime: Process: io.evix.reactnativetvexample, PID: 27102
04-27 13:20:21.717 27102 27102 E AndroidRuntime: com.facebook.react.bridge.JSApplicationIllegalArgumentException: connectAnimatedNodes: Animated node with tag (child) [5998] does not exist
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at com.facebook.react.animated.NativeAnimatedNodesManager.connectAnimatedNodes(NativeAnimatedNodesManager.java:346)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at com.facebook.react.animated.NativeAnimatedModule$16.execute(NativeAnimatedModule.java:751)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at com.facebook.react.animated.NativeAnimatedModule$ConcurrentOperationQueue.executeBatch(NativeAnimatedModule.java:147)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at com.facebook.react.animated.NativeAnimatedModule$3.execute(NativeAnimatedModule.java:332)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at com.facebook.react.uimanager.UIViewOperationQueue$UIBlockOperation.execute(UIViewOperationQueue.java:579)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:915)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1026)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at com.facebook.react.uimanager.UIViewOperationQueue.access$2600(UIViewOperationQueue.java:47)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1086)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1035)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at android.view.Choreographer.doCallbacks(Choreographer.java:845)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at android.view.Choreographer.doFrame(Choreographer.java:775)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:938)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at android.os.Looper.loop(Looper.java:288)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7839)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
04-27 13:20:21.717 27102 27102 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1006)
But sometimes also with this one:
04-27 13:18:32.957 26938 26938 E AndroidRuntime: FATAL EXCEPTION: main
04-27 13:18:32.957 26938 26938 E AndroidRuntime: Process: io.evix.reactnativetvexample, PID: 26938
04-27 13:18:32.957 26938 26938 E AndroidRuntime: java.lang.RuntimeException: java.lang.IllegalArgumentException: Mapped property node does not exists
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at com.facebook.react.animated.NativeAnimatedModule$1.doFrameGuarded(NativeAnimatedModule.java:230)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1035)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at android.view.Choreographer.doCallbacks(Choreographer.java:845)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at android.view.Choreographer.doFrame(Choreographer.java:775)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:938)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at android.os.Looper.loop(Looper.java:288)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7839)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1006)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: Caused by: java.lang.IllegalArgumentException: Mapped property node does not exists
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at com.facebook.react.animated.PropsAnimatedNode.updateView(PropsAnimatedNode.java:100)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at com.facebook.react.animated.NativeAnimatedNodesManager.updateNodes(NativeAnimatedNodesManager.java:690)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at com.facebook.react.animated.NativeAnimatedNodesManager.runUpdates(NativeAnimatedNodesManager.java:597)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: at com.facebook.react.animated.NativeAnimatedModule$1.doFrameGuarded(NativeAnimatedModule.java:214)
04-27 13:18:32.957 26938 26938 E AndroidRuntime: ... 15 more
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/
_Originally posted by @wouterds in https://github.com/facebook/react-native/issues/33686#issuecomment-1525541443_
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 16
- Comments: 106 (9 by maintainers)
Commits related to this issue
- fix: experiment with patch provided by @yrichard https://github.com/facebook/react-native/issues/37267#issuecomment-1608146075 — committed to wouterds/react-native-tv-example by wouterds a year ago
- fix: experiment with patch provided by @yrichard https://github.com/facebook/react-native/issues/37267#issuecomment-1608146075 — committed to wouterds/react-native-tvos by wouterds a year ago
We are also facing this issue throughout our ReactNative Android app. We deduced the screens in which the crash occurred, using Crashlytics and analytic events. The first goal was to zero-in on the component (in the screen) that caused the crash. To do this,
This process of debugging can help you zero-in on the component/prop that causes this crash. And then take the next steps to solve it.
Hope this helps!
Has anyone managed to resolve this problem?
Any update guys ?? Going through a lot of crashes in a short span.
“Don’t use animations” is a ridiculous suggestion, animations are of paramount importance to UX.
Let’s think and try to find a solution instead.
Besides that, and as mentioned multiple times before, it’s not only *your* animations. It’s any animation by any library. Going that route requires you to find every reference of
useNativeDriver
in your node_modules and patch all your third-party libs.It also affects the little things like navigation animations. It’s a very poor UX, I tried it (in production) and it does reduce the crash rate a lot, but the app feels very cheap & unprofessional.
@freeboub Yeah, I experimented with this patch as well but it seems unreliable. Sometimes it looks like it can recover from it and you see the soft crash passing in the logs and the app continues working - but often I see it just crashing further down the line with the same exception as you reported.
java.lang.IllegalArgumentException: Mapped property node does not exists
Wouldn’t recommend this patch as a workaround.
–
@cortinico The issue can be reproduced relatively easily with this project on this branch. While react-native-tvos is a fork and this specific example is a little more complex it is the fasted way I found to reproduce the issue, the same bug resides in react-native core, and code crashes somewhere in NativeAnimatedNodesManager.java.
To reproduce just run the example and switch between screens on the main navigation until it crashes. For me it takes about 5 - 10 times switching screens (while running on a real Android (12) TV device, the crappier the better).
I’m currently trying to create a reproducible example with a vanilla react-native project on Android but so far no luck.
@cortinico I’m gonna have a look this weekend to create a reproducible example for a vanilla
react-native
app@wouterds @cortinico It is really hard to reproduce it in any simulators even we use a real device.
It happened if the device used falls into these criteria:
I reported it in React Navigation before and even the example app provided by React Navigation can replicate it easily in Android Go devices https://github.com/react-navigation/react-navigation/issues/11180
The production environment on Android devices will crash.
“react-native”: “0.71.16”
Thanks, @wouterds, for clarification.
@sebas21, I would suggest this: https://github.com/facebook/react-native/pull/37927 since many apps, including mine, are solve the crash totally as we can replicate it on a specific set of real devices, including TVOS. We used it already for one month on a production setup but we tweak it to only use the
LinkedBlockingQueue
in Android 12, and so far there has been no performance degradation. This is not a totally concrete solution, but it has completely mitigate any crashes related to the animated node.ref: https://issuetracker.google.com/issues/261481042
Happening after upgrading to 0.71.7 from 0.66.3
We tried it. It worked, It’s probably an android bug,Refer to this: https://issuetracker.google.com/issues/261481042
@sebas21 This patches solve this issue completely?
I have been using the patch I have provided for 1 month now. I can assume it fixes the issue. We are 10 people working on android tv 12 ONLY (I don’t count customers) we don’t see the crash anymore and no ‘strange’ behavior happens. I can say it is safe.
Note: a similar patch shall be applied on react-native-reanimated
I also get this error in production. “react-native”: “0.73.6”
I am going through the same situation, with over 42 thousand errors in a short period. @cipolleschi
Hi React Native Team, @shaik41 @rezaarifian @redpanda-bit We’re encountering a sporadic issue on
"react-native": "^0.72.3"
with the following error:This issue seems to occur randomly and is challenging to reproduce consistently, making it difficult to pinpoint the root cause. We’ve received suggestions from different developers:
@cortinico How do we move forward? Clearly, nobody is able to create a simple vanilla app to reproduce the issue. The next best thing we have, at this moment, is the example repository/branch linked in the original post. Isn’t that sufficient to get started? It’s reproducible within 20 seconds on those cheap $50 Android TV boxes from Amazon (running Android 12).
@wilav-dev
It only happens on Android 12 as far as I can see, we also discovered it that way.
@nemzutkovic
Yea, doesn’t help.
@lucasoliveiracruz thats the patch mentioned in react-native pull request. yet take it with grain of salt better test because it replace the none-blocking Queue with a blocking one
These are the patches applied for RN 0.71.13
react-native-camera+4.2.1.patch react-native-reanimated+2.17.0.patch react-native+0.71.13.patch
any suggestion welcome!
@sebas21 There were two temporary solutions provided above 1 and 2 with number 2 having a promising follow up.
if none of those work I would change the UI to not use the animation causing the crash – some users might prefer not to be distracted by motion anyway.
@freeboub @coolguy001tv @yrichard Feel free to try to create a reproducible example, I have this but so far I haven’t found a way to consistently and quickly reproduce it on Android 12 devices react-native-animated-nodes-crash-example.
As mentioned in https://github.com/facebook/react-native/issues/37267#issue-1697375660 there is a reproducible example on the react-native-tvos fork (that *is* relatively easy to reproduce on an Android 12 device), but as I understood from @cortinico that is not good enough as reproducible example.
For context, I’m also still waiting for a reproducer from someone.
Animated component of React Native
https://github.com/react-navigation/react-navigation/issues/11890#issuecomment-2090294675
My project also encountered so many crash issues from it every day. When will React Native officially fix it? com.facebook.react.bridge.JSApplicationIllegalArgumentException: connectAnimatedNodeToView: Animated node with tag [5] does not exist at com.facebook.react.animated.NativeAnimatedNodesManager.connectAnimatedNodeToView(Unknown Source:148) at com.facebook.react.animated.NativeAnimatedModule$17.execute(Unknown Source:4) at com.facebook.react.animated.NativeAnimatedModule.executeAllOperations(Unknown Source:31) at com.facebook.react.animated.NativeAnimatedModule.access$400(Unknown Source:0) at com.facebook.react.animated.NativeAnimatedModule$3.execute(Unknown Source:8) at com.facebook.react.uimanager.UIViewOperationQueue$UIBlockOperation.execute(Unknown Source:8) at com.facebook.react.uimanager.UIViewOperationQueue$1.run(Unknown Source:135) at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(Unknown Source:53) at com.facebook.react.uimanager.UIViewOperationQueue.access$2600(Unknown Source:0) at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(Unknown Source:31) at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(Unknown Source:0) at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(Unknown Source:46) at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(Unknown Source:2) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1238) at android.view.Choreographer.doCallbacks(Choreographer.java:1012) at android.view.Choreographer.doFrame(Choreographer.java:917) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1225) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:233) at android.os.Looper.loop(Looper.java:334) at android.app.ActivityThread.main(ActivityThread.java:8513) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)
I have tried multiple patches, like here https://github.com/react-native-tvos/react-native-tvos/pull/657
But, I notice a slow UI, which clearly affects the UX in my preliminary tests, although I have no more unexpected crashes, I feel that it should be something that is verified from the RN library itself, and if it is possible that it was backward compatible with previous versions by RN
no friend, the patch only implement
LinkedBlockingQueue
on android version 12. Other than that it is not affected. reffer patch on thisReturning early to avoid throwing or disabling all native animations are indeed not fixes addressing the underlying issue.
@yrichard Would you mind sharing the commit or code changes that you did as a patch fix…
Hello! I’m facing the same issue on Android 12. So far, I’ve encountered the problem on the following devices: Motorola, Samsung, and Xiaomi. My application is experiencing several errors daily related to this issue.
@wouterds can we get this repro on a vanilla React Native App on 0.71?
Has anyone managed to resolve this problem? Users: 6.3k Events: 21k
My analysis data shows that all issues occur on Android 12.
react-native: 0.66.4
Solution:
@sebas21, I’d like to apply your solution to patch my application. Could you please share if you’ve noticed any improvement in your production app after applying these patches? Has the problem been resolved for you?
I’m still experiencing a significant number of errors daily, specifically on Android 12 devices like:
Additionally, I attempted to reproduce the crash using an Android 12 emulator, but unfortunately, I wasn’t able to replicate it 😕.
@wesvh Friend no, but you can take the file as a reference or already where they cited the change https://github.com/facebook/react-native/pull/37927
@saghul Yes you will have to rebuild the AARs
You’d still need to rebuild RN to get the updated AAR right? That’s the only annoying part of needing to patch the Android side IMHO.
Setting
useNativeDriver: false
is not a solution + you would need to patch *all* your sub packages, not just your code. It is very visible on budget Android devices, even on simple navigation transitions.I tried it previously and would not recommend it, although it does reduce crash rate if you are ok with a significant worse UX.
@hangjunping there is no solution as far as I know (and it is imo a bug inside react-native). I still have to create that reproducible demo in a vanilla react native project though. But feel free to create one if you can quickly and easily reproduce it on a simple demo project.