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

0x104f2f700 -[REAAnimationsManager clearSharedTransitionConfigForTag:] Thread 1: EXC_BAD_ACCESS (code=1, address=0x10) #5947

Closed
ggnsingh opened this issue Apr 27, 2024 · 24 comments · Fixed by #5975
Labels
Missing repro This issue need minimum repro scenario Platform: iOS This issue is specific to iOS Reproducible 🎉

Comments

@ggnsingh
Copy link

ggnsingh commented Apr 27, 2024

Description

Thread 1: EXC_BAD_ACCESS (code=1, address=0x10)

Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [66341]

Triggered by Thread:  0

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   Barber                        	       0x104f2f700 -[REAAnimationsManager clearSharedTransitionConfigForTag:] + 64 (REAAnimationsManager.m:622)
1   Barber                        	       0x104f6f984 -[REASharedTransitionManager clearAllSharedConfigsForViewTag:] + 100 (REASharedTransitionManager.m:743)
2   Barber                        	       0x104f7024c __51-[REASharedTransitionManager clearConfigForScreen:]_block_invoke + 104 (REASharedTransitionManager.m:818)
3   Barber                        	       0x104f2ad28 REANodeFind + 176 (REAAnimationsManager.m:18)
4   Barber                        	       0x104f701c0 -[REASharedTransitionManager clearConfigForScreen:] + 152 (REASharedTransitionManager.m:817)
5   Barber                        	       0x104f6e560 -[REASharedTransitionManager runSharedTransitionForSharedViewsOnScreen:isInteractive:withOffsetX:withOffsetY:] + 348 (REASharedTransitionManager.m:578)
6   Barber                        	       0x104f6d960 -[REASharedTransitionManager screenRemovedFromStack:withOffsetX:withOffsetY:] + 468 (REASharedTransitionManager.m:471)
7   Barber                        	       0x104f6d6bc -[REASharedTransitionManager reanimated_viewIsAppearing:] + 292 (REASharedTransitionManager.m:442)
8   UIKitCore                     	       0x184ca6290 -[UIViewController __viewIsAppearing:skipWindowCheck:] + 168
9   UIKitCore                     	       0x185909f64 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1040
10  QuartzCore                    	       0x18a1ae654 CA::Layer::layout_if_needed(CA::Transaction*) + 440
11  QuartzCore                    	       0x18a1b940c CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 124
12  QuartzCore                    	       0x18a0f2d30 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 460
13  QuartzCore                    	       0x18a122aa8 CA::Transaction::commit() + 652
14  QuartzCore                    	       0x18a123f7c CA::Transaction::flush_as_runloop_observer(bool) + 68
15  CoreFoundation                	       0x18040de34 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
16  CoreFoundation                	       0x180408838 __CFRunLoopDoObservers + 528
17  CoreFoundation                	       0x180408cf0 __CFRunLoopRun + 968
18  CoreFoundation                	       0x180408514 CFRunLoopRunSpecific + 572
19  GraphicsServices              	       0x18ef06ae4 GSEventRunModal + 160
20  UIKitCore                     	       0x1853e8040 -[UIApplication _run] + 868
21  UIKitCore                     	       0x1853ebcc8 UIApplicationMain + 124
22  Barber                        	       0x104b18228 main + 100 (main.m:8)
23  dyld_sim                      	       0x10a7c1544 start_sim + 20
24  dyld                          	       0x10a1b20e0 start + 2360

Working propery with version 3.8.1

Steps to reproduce

Running a react native app with library version 3.9.0 crashes the app on ios with this logs.

Snack or a link to a repository

none

Reanimated version

3.9.0

React Native version

0.72.5

Platforms

iOS

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

Iphone 15 pro

Acknowledgements

Yes

@github-actions github-actions bot added Platform: iOS This issue is specific to iOS Missing repro This issue need minimum repro scenario labels Apr 27, 2024
Copy link

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

@ggnsingh ggnsingh changed the title 0x104f2f700 -[REAAnimationsManager clearSharedTransitionConfigForTag:] 0x104f2f700 -[REAAnimationsManager clearSharedTransitionConfigForTag:] Thread 1: EXC_BAD_ACCESS (code=1, address=0x10) Apr 27, 2024
@levancho
Copy link

levancho commented Apr 27, 2024

i am also getting same , as soon as user logs into the application app crashes ... same happens if i run from xcode or install it via testflight...

i can not provide access to code since its private project, and obviously its impossible to create reproducible snack, due to complexity of the project.. ..

i used to use 3.6.x version of reanimated, upgraded to latest 3.9 today but still getting same error.

here is the stack :

Thread 1: EXC_BAD_ACCESS (code=1, address=0x10)
#0	0x0000000104aa7204 in -[REAAnimationsManager clearSharedTransitionConfigForTag:] at /Users/levancho/dev/xxxxx/node_modules/react-native-reanimated/apple/LayoutReanimation/REAAnimationsManager.m:622
#1	0x0000000104aec014 in -[REASharedTransitionManager clearAllSharedConfigsForViewTag:] at /Users/levancho/dev/xxxxxnode_modules/react-native-reanimated/apple/LayoutReanimation/REASharedTransitionManager.m:743
#2	0x0000000104aec8dc in __51-[REASharedTransitionManager clearConfigForScreen:]_block_invoke at /Users/levancho/dev/xxxx/node_modules/react-native-reanimated/apple/LayoutReanimation/REASharedTransitionManager.m:818
#3	0x0000000104aa282c in REANodeFind at /Users/levancho/dev/xxxx/node_modules/react-native-reanimated/apple/LayoutReanimation/REAAnimationsManager.m:18
#4	0x0000000104aec850 in -[REASharedTransitionManager clearConfigForScreen:] at /Users/levancho/dev/xxxx/node_modules/react-native-reanimated/apple/LayoutReanimation/REASharedTransitionManager.m:817
#5	0x0000000104aeabf0 in -[REASharedTransitionManager runSharedTransitionForSharedViewsOnScreen:isInteractive:withOffsetX:withOffsetY:] at /Users/levancho/dev/xxxxx/node_modules/react-native-reanimated/apple/LayoutReanimation/REASharedTransitionManager.m:578
#6	0x0000000104ae9ff0 in -[REASharedTransitionManager screenRemovedFromStack:withOffsetX:withOffsetY:] at /Users/levancho/dev/xxxxx/node_modules/react-native-reanimated/apple/LayoutReanimation/REASharedTransitionManager.m:471
#7	0x0000000104ae9d4c in -[REASharedTransitionManager reanimated_viewIsAppearing:] at /Users/levancho/dev/xxxxxx/node_modules/react-native-reanimated/apple/LayoutReanimation/REASharedTransitionManager.m:442
#8	0x00000001a17fec38 in -[UIViewController __viewIsAppearing:skipWindowCheck:] ()

@levancho
Copy link

levancho commented Apr 27, 2024

more investigative info I have is that, screen that seens to be crashing is using following animation code :

const animated = new Animated.Value(Dimensions.get('window').width);
  const duration = 5000;
  useEffect(() => {
    Animated.timing(animated, {
      toValue: 0,
      duration: 500,
      easing: Easing.linear,
      useNativeDriver: true,
    }).start();

  }, [isNotificationSettingsAdded, isLocationPermissionGranted]);

but this code is very old and we have not touched it for a loooong time.

@Vladimirrr666

This comment was marked as spam.

@levancho
Copy link

downgrading to 2.17 solved the poblem for me.

@KazakovVS
Copy link

KazakovVS commented Apr 28, 2024

Having the same problem

Crashed: com.apple.main-thread
0  App                     0x19aa78 -[REAAnimationsManager clearSharedTransitionConfigForTag:] + 622 (REAAnimationsManager.m:622)
1  App                     0x1a627c -[REASharedTransitionManager clearAllSharedConfigsForViewTag:] + 743 (REASharedTransitionManager.m:743)
2  App                     0x1a67b0 __51-[REASharedTransitionManager clearConfigForScreen:]_block_invoke + 818 (REASharedTransitionManager.m:818)
3  App                     0x1980cc REANodeFind + 18 (REAAnimationsManager.m:18)
4  App                     0x1a6774 -[REASharedTransitionManager clearConfigForScreen:] + 821 (REASharedTransitionManager.m:821)
5  App                     0x1a55b4 -[REASharedTransitionManager runSharedTransitionForSharedViewsOnScreen:isInteractive:withOffsetX:withOffsetY:] + 582 (REASharedTransitionManager.m:582)
6  App                     0x1a4ee8 -[REASharedTransitionManager screenRemovedFromStack:withOffsetX:withOffsetY:] + 486 (REASharedTransitionManager.m:486)
7  App                     0x1a4d48 -[REASharedTransitionManager reanimated_viewIsAppearing:] + 442 (REASharedTransitionManager.m:442)
8  UIKitCore                      0x13cd3c -[UIViewController __viewIsAppearing:skipWindowCheck:] + 148
9  UIKitCore                      0x327b8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1076
10 QuartzCore                     0x66aa8 CA::Layer::layout_if_needed(CA::Transaction*) + 500
11 QuartzCore                     0x66630 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 144
12 QuartzCore                     0x6cb60 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 464
13 QuartzCore                     0x65e3c CA::Transaction::commit() + 648
14 QuartzCore                     0x65ae4 CA::Transaction::flush_as_runloop_observer(bool) + 88
15 UIKitCore                      0xaaccc _UIApplicationFlushCATransaction + 52
16 UIKitCore                      0xaa7e4 _UIUpdateSequenceRun + 84
17 UIKitCore                      0xa9ed4 schedulerStepScheduledMainSection + 144
18 UIKitCore                      0xa9f90 runloopSourceCallback + 92
19 CoreFoundation                 0x3712c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
20 CoreFoundation                 0x363a8 __CFRunLoopDoSource0 + 176
21 CoreFoundation                 0x34b5c __CFRunLoopDoSources0 + 244
22 CoreFoundation                 0x33898 __CFRunLoopRun + 828
23 CoreFoundation                 0x33478 CFRunLoopRunSpecific + 608
24 GraphicsServices               0x34f8 GSEventRunModal + 164
25 UIKitCore                      0x22c62c -[UIApplication _run] + 888
26 UIKitCore                      0x22bc68 UIApplicationMain + 340
27 App                     0x8184 main + 8 (main.m:8)
28 ???                            0x1bdb92dcc (Missing)

Reanimated version
3.9.0

React Native version
0.74

Platforms
iOS

@felixmueller-cnnctvstn
Copy link

felixmueller-cnnctvstn commented Apr 28, 2024

Same error here... crashes when navigating to other screens. I am not using this library, but its a dependency of react-native-reanimated-carousel, which I am also only using in one component deep down...

react-native-reanimated@^3.8.1:
  version "3.9.0"
image

tmp fix => downgrading to ~3.8.1

@KazakovVS
Copy link

Same error here... crashes when navigating to other screens. I am not using this library, but its a dependency of react-native-reanimated-carousel, which I am also only using in one component deep down...

react-native-reanimated@^3.8.1:
  version "3.9.0"
image tmp fix => downgrading to ~3.8.1

Downgrade didn’t work for me, the app is still crashing while navigating.

@pernestrand
Copy link

Same error here... crashes when navigating to other screens. I am not using this library, but its a dependency of react-native-reanimated-carousel, which I am also only using in one component deep down...

react-native-reanimated@^3.8.1:
  version "3.9.0"
image tmp fix => downgrading to ~3.8.1

Can confirm downgrading from 3.9.0 => ~3.8.1 worked.

@felixmueller-cnnctvstn
Copy link

felixmueller-cnnctvstn commented Apr 29, 2024

Downgrade didn’t work for me, the app is still crashing while navigating.

@KazakovVS try to remove and add node_modules folder and run bundle exec pod deintegrate && bundle exec pod install --repo-update in ios folder

@ferasabufares
Copy link

ferasabufares commented Apr 30, 2024

same problem !!!

"react-native": "^0.74.0",

so for ios
this will work react-native-reanimated@^3.8.1

and for android
this will work react-native-reanimated@3.9.0-rc.1

but this is not a solution can someone provide a better solution for this problem please

@DnEgorWeb
Copy link

DnEgorWeb commented May 1, 2024

Also happens for 3.10.0
Indeed react-native 0.74.0 is compatible with <=3.8.1 (iOS) and with >=3.9.0 (Android), which basically makes react-native 0.74.0 incompatible with the library

@SyntaxError843
Copy link

doesn't ^3.8.1 also include 3.10.0?

@dan-trewin
Copy link

dan-trewin commented May 1, 2024

I am also getting this hard crashing issue and agree with the others that this issue started happening with 3.9.0. This is my versions:

"react-native": "0.73.6",
"react-native-reanimated": "3.9.0", (also tried "3.10.0")

I have a feeling this issue could possibly be related to: #5274 (as that was added in 3.9.0) since the crash stack references "shared element transitions". That being said, I tried upgrading the dependency requirements outlined in that PR to their latest versions as well:

"react-native-screens": "^3.31.1",
"react-native-gesture-handler": "^2.16.1",

...and that didn't seem to help matters. Still crashing on certain forward/back navigations (happens 100% of the time when clicking back button in nav header early after app launches).


This is a pretty serious issue! It's worse when you consider that apps that usereact-native-reanimated have to update to at least 3.9.0 by May 1, 2024 to comply with the new Apple privacy requirements: #5819 (this was added in 3.9.0)

Hoping the maintainers recognize this issue and work on a fix ASAP 🤞 . In the meantime, I have downgraded to 3.8.1 (last working version) and applied the following patch-package so that my team is not blocked from releasing app updates due to the new Apple privacy requirements:

diff --git a/node_modules/react-native-reanimated/apple/sensor/ReanimatedSensor.m b/node_modules/react-native-reanimated/apple/sensor/ReanimatedSensor.m
index 863c788..656a27a 100644
--- a/node_modules/react-native-reanimated/apple/sensor/ReanimatedSensor.m
+++ b/node_modules/react-native-reanimated/apple/sensor/ReanimatedSensor.m
@@ -48,7 +48,7 @@ - (bool)initializeGyroscope
   [_motionManager
       startGyroUpdatesToQueue:[NSOperationQueue mainQueue]
                   withHandler:^(CMGyroData *sensorData, NSError *error) {
-                    double currentTime = [[NSProcessInfo processInfo] systemUptime];
+                    double currentTime = CACurrentMediaTime() * 1000;
                     if (currentTime - self->_lastTimestamp < self->_interval) {
                       return;
                     }
@@ -69,7 +69,7 @@ - (bool)initializeAccelerometer
   [_motionManager startAccelerometerUpdates];
   [_motionManager startAccelerometerUpdatesToQueue:[NSOperationQueue mainQueue]
                                        withHandler:^(CMAccelerometerData *sensorData, NSError *error) {
-                                         double currentTime = [[NSProcessInfo processInfo] systemUptime];
+                                         double currentTime = CACurrentMediaTime() * 1000;
                                          if (currentTime - self->_lastTimestamp < self->_interval) {
                                            return;
                                          }
@@ -96,7 +96,7 @@ - (bool)initializeGravity
   [_motionManager
       startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue]
                           withHandler:^(CMDeviceMotion *sensorData, NSError *error) {
-                            double currentTime = [[NSProcessInfo processInfo] systemUptime];
+                            double currentTime = CACurrentMediaTime() * 1000;
                             if (currentTime - self->_lastTimestamp < self->_interval) {
                               return;
                             }
@@ -121,7 +121,7 @@ - (bool)initializeMagnetometer
   [_motionManager
       startMagnetometerUpdatesToQueue:[NSOperationQueue mainQueue]
                           withHandler:^(CMMagnetometerData *sensorData, NSError *error) {
-                            double currentTime = [[NSProcessInfo processInfo] systemUptime];
+                            double currentTime = CACurrentMediaTime() * 1000;
                             if (currentTime - self->_lastTimestamp < self->_interval) {
                               return;
                             }
@@ -157,7 +157,7 @@ - (bool)initializeOrientation
   [_motionManager startDeviceMotionUpdatesUsingReferenceFrame:(1 << _referenceFrame)
                                                       toQueue:[NSOperationQueue mainQueue]
                                                   withHandler:^(CMDeviceMotion *sensorData, NSError *error) {
-                                                    double currentTime = [[NSProcessInfo processInfo] systemUptime];
+                                                    double currentTime = CACurrentMediaTime() * 1000;
                                                     if (currentTime - self->_lastTimestamp < self->_interval) {
                                                       return;
                                                     }

@efstathiosntonas
Copy link
Contributor

@dan-trewin easy boi, this is open source software so instead of ranting open a PR and try to fix the issue.

@jordank195
Copy link

I also have the same issue. I'm not using expo, but I tried the suggestion of importing reanimated into index.js; this still didn't fix the problem.

@levancho
Copy link

levancho commented May 4, 2024

@dan-trewin easy boi, this is open source software so instead of ranting open a PR and try to fix the issue.

i dont think he is ranting.. and as opposed to you, who acts like a cyber-judge he at least spent time on research and posted his findings here, and further more, your statment that its opensource means nothing... when library claims
that its "better than native animation " , people trust that and when SHTF like this, you , the author first of all have to take the responsibility, so from that angle he is also correct ... so why dont you, instead of judging people go ahead and open a PR??

@ferasabufares
Copy link

same problem !!!

"react-native": "^0.74.0",

so for ios this will work react-native-reanimated@^3.8.1

and for android this will work react-native-reanimated@3.9.0-rc.1

but this is not a solution can someone provide a better solution for this problem please

any update on this ?

also tried "3.10.0" and it is crash on ios

image

@erez-unitronics
Copy link

React native 0.74.1 solved this problem for me.
(with v3.10.0)

@tomekzaw
Copy link
Member

tomekzaw commented May 5, 2024

I was able to reproduce this issue on 81c4130.

Recording
Screen.Recording.2024-05-05.at.14.28.27.mov

Steps to reproduce

  1. Install @react-navigation/bottom-tabs:
cd Example
yarn add @react-navigation/bottom-tabs
  1. Paste the following repro in Example/App.tsx:
Example/App.tsx
import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import React from 'react';

const Stack = createNativeStackNavigator();

const Tab = createBottomTabNavigator();

function Feed() {
  return null;
}

function Messages() {
  return null;
}

function Profile() {
  return null;
}

function Settings() {
  return null;
}

function Home() {
  return (
    <Tab.Navigator>
      <Tab.Screen name="Feed" component={Feed} />
      <Tab.Screen name="Messages" component={Messages} />
    </Tab.Navigator>
  );
}

export default function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen
          name="Home"
          component={Home}
          options={{headerShown: false}}
        />
        <Stack.Screen name="Profile" component={Profile} />
        <Stack.Screen name="Settings" component={Settings} />
      </Stack.Navigator>
    </NavigationContainer>
  );
}
  1. Navigate to second tab
  2. Navigate back to first tab
  3. Crash

@tomekzaw
Copy link
Member

tomekzaw commented May 5, 2024

Bumped Example app to react-native@0.74.1, still crashing

@tomekzaw
Copy link
Member

tomekzaw commented May 5, 2024

Workaround: import something from react-native-reanimated so that the library gets initialized correctly

import Animated from 'react-native-reanimated';

console.log(Animated); // make sure to use the imported thing, otherwise the import will be optimized away

@tomekzaw
Copy link
Member

tomekzaw commented May 5, 2024

PR with a temporary fix:

@efstathiosntonas
Copy link
Contributor

efstathiosntonas commented May 5, 2024

@dan-trewin easy boi, this is open source software so instead of ranting open a PR and try to fix the issue.

i dont think he is ranting.. and as opposed to you, who acts like a cyber-judge he at least spent time on research and posted his findings here, and further more, your statment that its opensource means nothing... when library claims that its "better than native animation " , people trust that and when SHTF like this, you , the author first of all have to take the responsibility, so from that angle he is also correct ... so why dont you, instead of judging people go ahead and open a PR??

@levancho you definitely need to redefine the term open source in your head, specially the last paragraph of the MIT license.

github-merge-queue bot pushed a commit that referenced this issue May 5, 2024
…TransitionConfigForTag:]` (#5975)

## Summary

Fixes
#5947.
Fixes
#5968.

When `react-native-reanimated` is installed but not used directly,
switching between bottom tabs from `@react-navigation/bottom-tabs` will
result in a `EXC_BAD_ACCESS` crash on iOS.

This PR adds missing mock for `_clearSharedTransitionConfigForTag` as
suggested by @bartlomiejbloniarz.

## Test plan

Try repro from
#5947 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing repro This issue need minimum repro scenario Platform: iOS This issue is specific to iOS Reproducible 🎉
Projects
None yet