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 4 years ago
- Reactions: 21
- Comments: 143 (22 by maintainers)
Links to this issue
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 3 years 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 3 years 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!
Any update guys ?? Going through a lot of crashes in a short span.
Has anyone managed to resolve this problem?
“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
useNativeDriverin 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 existsWouldn’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-nativeappThe production environment on Android devices will crash.
“react-native”: “0.71.16”
@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
@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.
I am going through the same situation, with over 42 thousand errors in a short period.
@cipolleschi
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
LinkedBlockingQueuein 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
@dimaischenko Thanks for the reference! I’ll share it with people with more Android expertise to understand why it hasn’t been accepted!
@sebas21 This patches solve this issue completely?
@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
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
For your information, the patch changes
ConcurrentLinkedQueuetoLinkedBlockingQueue,eliminating concurrency and explaining why it fixes the issues. Since the problem is on Android 12, the fix should be specific; we do not have the issue in all other versions. Also, the linked Google issues state that theConcurrentLinkedQueueis broken only on Android 12 builds, which correlates with everyone pasting problems on Android 12 only. Finally, the above change, without proof, can also affect performance since the concurrency gain is no longer there.patch-package never worked for React Native Android as of version 0.20 because we shipped prebuilt (@douglasjunior the coordinate change you mentioned is irrelevant). You’ll have to build-from-source if you want to apply to apply changes with patch-package.
I was experiencing the same issue on android 12 Tecno BF6. This fixed it. Are there any performance implications for switching the queues?
I also get this error in production. “react-native”: “0.73.6”
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).
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!
Thanks @dprevost-LMI for the summary! 😄
This bug has been going on for a long time. I set up a fix by building the source with an early proposed patch, but it makes building and updating various react-native packages very slow and requires a full rebuild when updating any minor package. Does anyone have a better solution? What about react-native
0.76, is it still the same? (I’m currently using0.73)My analysis data shows that all issues occur on Android 12.
react-native: 0.66.4
Solution:
no friend, the patch only implement
LinkedBlockingQueueon android version 12. Other than that it is not affected. reffer patch on this@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.
I am using below patch as a workaround to disable animation for android 12 devices, this is for version 0.72.4, hope it helps someone.
@shubhamguptadream11 I haven’t switched to the new architecture yet
@dprevost-LMI Thank you! I think you’re right, and I’ll keep building projects with my own local patch for Android 12 for now 😄
@dimaischenko can you share the fix you had, perhaps in a PR? I can forward it to people with relevant context on Animations and, if it’s the right fix, we can try to upstream it.
Hmm I guess it could be, but that was mainly a clean-up, with hopes of resolving a different issue we’re seeing with NativeViewHierarchyManager/ViewGroupManager.
I checked with @cortinico and we don’t have a good repro for this issue at the moment, so I’ll have to defer to the community on whether #45984 helps here.
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
Returning 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…
Setting
useNativeDriver: falseis 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.
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?
I’m just a bystander with no control or power over that! Doing so would be the best compromise since Android 12 faulty builds still exist without knowing why. However, considering that in this thread or multiple others, the scope of Android 12 was already proposed, and nothing was adopted yet, I am not sure it will go through.
Benchmarks of different scenarios using the code in question with performance metrics of the execution. You compare multiple runs with both queues and analyze the difference. I’m not sure it’s worth your time, though, lol.
On my part, I was hoping for a fix a long time ago, but today, seeing that Android 15 is nearby, time will do its job, and Android 12 will eventually die in a couple of years 😄
I’m also encountering these kinds of errors in the React Native Expo project.
Emulator - Android version 14
Packages used in the project
@pSapien you can’t just use
patch-packageor replace files in react-native, that only works with other packages that aren’t prebuilt. As @efstathiosntonas mentioned, to patch react-native you’ll need to build react-native from source.you need to build from source. Patch package or swiping files right before build won’t work.
more info: https://reactnative.dev/contributing/how-to-build-from-source
To provide more data on the error:
In the last 30 days, the failure event occurred only on Android 12 version, on the following devices:
See patch-packge and this.
There are many different patches in this thread. I will let you choose the one appropriate to you.
I would recommend keeping the thread for the main topic and redirecting your question to a better place (not sure where, though)
https://github.com/software-mansion/react-native-reanimated/issues/4242#issuecomment-2090310726
Has anyone managed to resolve this problem? Users: 6.3k Events: 21k
@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.
Possible related fix #37927
Please, i’m getting many firebase crashes on Android 12 and can’t reproduce. It started after an OS update without any app update. Any idea?
@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.