-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[Android] Native crash on React Native 0.65-rc3 / reanimated 2.3 alpha 2 #2256
Comments
Issue validatorThe issue is invalid!
|
Seems similar to #2098 |
I am also running into this issue on android with the [email protected] release. DescriptionThe application crashes immediately when running on android in the simplest use case. Expected behaviorThe application does not crash. Actual behavior & steps to reproduceCreate a bare react native project. Install [email protected], follow the instructions for the android setup and then build the app. The app builds successfully on android studio but crashes immediately when trying to run it. If I downgrade the version of react-native-reanimated to 2.2.0 in the same project it starts working again. This problem ONLY exists on android. On iOS version 2.3.0-alpha.2 works fine. Snack or minimal code examplehttps://github.com/hmust92/AwesomeProject
Package versions
Affected platforms
|
I’ll copy the link to another issue with my logs about this crash: #2290 (comment) |
Apparently my crash is connected to |
Getting the same issue, after upgrading to RN
I have a horizontal progress bar component that appears to be the culprit. When I comment it out the app launches fine... import React, { useEffect } from 'react';
import { Dimensions, StyleSheet, View } from 'react-native';
import Animated, {
cancelAnimation,
useAnimatedStyle,
useSharedValue,
withRepeat,
withTiming,
} from 'react-native-reanimated';
const { width } = Dimensions.get('screen');
const HEIGHT = 4;
const PROGRESS_WIDTH = width / 2;
const DURATION = 1000;
const styles = StyleSheet.create({
container: {
width,
height: HEIGHT,
},
progress: {
width: PROGRESS_WIDTH,
height: HEIGHT,
backgroundColor: Color.accent,
},
});
function ProgressBar({ visible }: { visible: boolean }): React.ReactElement {
const translateX = useSharedValue(-PROGRESS_WIDTH);
const animationAllowed = useSharedValue(true);
useEffect(() => {
animationAllowed.value = visible;
}, [visible, animationAllowed]);
useEffect(() => {
if (visible) {
translateX.value = -PROGRESS_WIDTH;
translateX.value = withRepeat(
withTiming(
width,
{
duration: DURATION,
},
() => {
if (!animationAllowed.value) {
cancelAnimation(translateX);
}
}
),
-1
);
}
}, [translateX, visible, animationAllowed]);
const animatedProgressStyle = useAnimatedStyle(() => ({
transform: [{ translateX: translateX.value }],
}));
return (
<View style={styles.container}>
<Animated.View style={[styles.progress, animatedProgressStyle]} />
</View>
);
} |
I don't think #2040 is related, that crash was originally reported on 2.1.0 as well, but we weren't having any crashes up until 2.3.0-alpha. I believe There seems to be a 2.2.1 version planned which brings RN 0.65 support on the 2.2.0 line. It was initially scheduled for last week, but it seems it got delayed. The 2.3.0 crash might've been introduced by #1879 as per other reports. I'm hoping that 2.2.1 will work properly. |
So I managed to workaround my issue by delaying when I add my ProgressBar component to the root component tree. Now I add it to the tree when I want to use it for the first time, as opposed to it existing in the tree during app launch. Before function MyRootComponent() {
return (
<SomeProvider>
<SomeComponent />
{/*
ProgressBar is hidden on launch but Reanimated2
code still executes i.e. useAnimatedStyle() which
causes the app to crash on Android
*/}
<ProgressBar />
</SomeProvider>
);
} After function MyRootComponent() {
return (
<SomeProvider>
<SomeComponent />
{/*
Don't add ProgressBar to the component tree until the first time it's needed.
App no longer crashes and progress bar appears to animate correctly again.
*/}
{progressBarVisibleAtLeastOnce && <ProgressBar />}
</SomeProvider>
);
} Having a component that uses Reanimated2 in my component tree during app launch did work prior to the RN 0.65 / Reanimated 2.3.0-alpha2 upgrade, so it does appear that there's some regression related to Reanimated2 and app launch perhaps? Specifically with Update: This workaround doesn't actually fix the issue 100% and I'm noticing that my app will still crash intermittently as I'm using it with the same |
@piaskowyk when will 2.2.1 be release? |
@KoreanThinker , hey let's don't chase the guys so much. We are all would like to use the latest react-native version with reanimated on board, but let's try to be patience :) Hope we will see 2.2.1 or new alpha soon :) |
I can't rollback from RN 0.65.1 because I cannot install proguard-annotations-1.14.1.pom. I can't install it because facebook has removed this package. As a result, I have version 0.65.1, but it is not supported by the reanimated one. So I would like to receive the patch as soon as possible. v2 alpha breaks ios and android |
It seems that There does seem to be a difference, it crashes a bit later. With alpha.2 it was crashing instantly. But with alpha.3 I can interact with the app a bit before it crashes.
|
Just got a different stacktrace for an android crash on
|
Well, with Btw, the error message becomes readable once
Again, the crash happens when we try to |
We're not using I just tried switching to JSC and the error is the same:
It also seems to be the same error originally mentioned in #2098, however that report is on 2.2.0 and we were not getting this error on 2.2.0. |
@OsapBender you can always roll back progaurd-annotations is still available, it's just on jcenter(), re-add jcenter to your list of possible maven repositories https://mvnrepository.com/artifact/com.facebook.yoga/proguard-annotations?repo=jcenter |
I was able to create a repro for this. It seems to be a race condition of some sort because if I delay adding the component that uses reanimated for a bit, the crash doesn't occur. But if it's added at app start, it crashes. This branch shows it: Relevant files: It's a dirty repro, but I just hacked it together quick based on a real app it occurs in. (cc @piaskowyk @jmysliv) |
Same for me regarding the color interpolation. |
Did someone have this problem on react native 0.64 or another version older than 0.65? |
@piaskowyk I also remember that everything seemed to work fine on 0.64 while creating the repro in #2256 (comment). I believe the crash started occurring after updating the project to 0.65 indeed. |
@piaskowyk Yes, the app built successfully but crashed immediately on android on any react native version older than 0.65.0. This is with reanimated 2.3 alpha 2. |
This issue is probably related to this Hermes's issue: facebook/hermes#590 |
That issue indicates that Hermes 0.8.1 fixes the issue? And react-native 0.65 uses Hermes 0.8.1: facebook/react-native@e53745e So, may be related but only conceptually if 0.8.1 was supposed to "fix" it ? |
I have just prepared PR with a short description of the problem here: #2389 |
Interesting, that seems like a different error than the one reported in #2256 (comment) Been getting both in this project. Not sure if we should open a new issue. |
@andreialecu Yes, your case looks like a different problem. Could you open a new issue? |
@piaskowyk It's the same error as in the stack trace in #2098 and #2213 (if you expand the Stack trace in each issue, they're collapsed by default) I thought they were the same issue originally. Because our app on 2.3.0-alpha.2 crashes randomly with either If 2.2.1 (once released) does not crash with I'll test it as soon as it is released and open a new issue once I have more info. |
Authors: @Szymon20000 @piaskowyk After changes in Hermes's garbage collector - the host object destructor can be called from another thread than JNI is assigned. We need to change the way of calling JNI in destructors to avoid calling a function on a null object. We should make it like Hermes: https://github.com/facebook/hermes/blob/6e5868763b08eb80f4164a926abb92fa5c71117f/lib/Platform/Intl/PlatformIntlAndroid.cpp#L319 Related issue: facebook/hermes#590 Fixes #2256
Just an update here. I built 2.2.1 manually and started testing it and all the crashes seem to be gone. If anyone else wants to test 2.2.1 before it's officially released, I attached a The |
Description
The application ends up crashing after a few seconds of use with an issue seemingly originated in libreanimated.so:
react-native-reanimated@^2.3.0-alpha.2:
react-native@^0.65.0-rc.3
The logs are from a simulator but it also happens on device. Please do let me know if I can provide you with any more debug info.
The crash:
Previous logs from application launch:
15998 15998 W m.getpaired.ap: Unexpected CPU variant for X86 using defaults: x86_64
Expected behavior
Actual behavior & steps to reproduce
Can't reproduce it deterministically, it always happens after a few seconds.
Snack or minimal code example
I hope the above stack traces can help narrow down the issue, we have a very complex app with heavy use of reanimated.
The text was updated successfully, but these errors were encountered: