react-native-code-push icon indicating copy to clipboard operation
react-native-code-push copied to clipboard

[iOS] CodePush.restartApp() crash

Open kr-yeon opened this issue 1 year ago • 18 comments

Steps to Reproduce

  1. build on testflight
  2. start app
  3. request CodePush.restartApp()

Expected Behavior

What you expected to happen? Restart Application

Actual Behavior

What actually happens?

  STACK TRACE AND/OR SCREENSHOTS

Shutdown app

Reproducible Demo

  • Download https://github.com/microsoft/react-native-code-push/archive/master.zip and unzip. From Examples folder run node create-app.js appName [email protected] [email protected] command to generate plain CodePushified React Native app. Please see description on top of create-app.js file content if needed
  • If you can't reproduce the bug on it, provide us as much info as possible about your project

Environment

  • react-native-code-push version: 8.0.0
  • react-native version: 0.71.6
  • iOS/Android/Windows version: iOS 16
  • Does this reproduce on a debug build or release build? yes. it is release build.
  • Does this reproduce on a simulator, or only on a physical device? physical device!

(The more info the faster we will be able to address it!)

kr-yeon avatar Jun 27 '23 11:06 kr-yeon

[super. bridge reload]; Occurs when running code

kr-yeon avatar Jun 27 '23 12:06 kr-yeon

I have this same issue. I've found that the CodePush gets applied most of the time, but requires the user to re-open the app after it crashes. Happens more on Android than iOS for me, but still occasionally on iOS.

sudokatsu avatar Jul 21 '23 01:07 sudokatsu

I use react-native-code-push version: 8.0.2. I have the same issue, iOS happens more than Android. Is it because Code push currently only supports 0.71 and not yet 0.71.6?

peytonwupeixin avatar Aug 01 '23 04:08 peytonwupeixin

I use react-native-code-push version: 8.0.2. I have the same issue, iOS happens more than Android. Is it because Code push currently only supports 0.71 and not yet 0.71.6?

I am currently using rn 0.71.11 I updated once but still have the same problem

kr-yeon avatar Aug 03 '23 06:08 kr-yeon

I have exactly the same problem. at first i suspected reanimated, but after patching it, i still get the bug.

Only in "release", according to sentry tracking, it's a RAM problem:

WatchdogTermination: The OS watchdog terminated your app, possibly because it overused RAM.

I try to replace code-push with react-native-restart and I have the same issue, also reported by other here

I use react-native v0.71.1 reanimated patch for react-native-reanimated 3.1.0 =>

diff --git a/node_modules/react-native-reanimated/ios/LayoutReanimation/REAAnimationsManager.m b/node_modules/react-native-reanimated/ios/LayoutReanimation/REAAnimationsManager.m
index 365ae4f..6290823 100644
--- a/node_modules/react-native-reanimated/ios/LayoutReanimation/REAAnimationsManager.m
+++ b/node_modules/react-native-reanimated/ios/LayoutReanimation/REAAnimationsManager.m
@@ -396,7 +396,7 @@ BOOL REANodeFind(id<RCTComponent> view, int (^block)(id<RCTComponent>))
     return NO;
   }
 
-  BOOL hasExitAnimation = _hasAnimationForTag(view.reactTag, EXITING) || [_exitingViews objectForKey:view.reactTag];
+  BOOL hasExitAnimation = [self hasAnimationForTag:view.reactTag type:EXITING] || [_exitingViews objectForKey:view.reactTag];
   BOOL hasAnimatedChildren = NO;
   shouldRemoveSubviewsWithoutAnimations = shouldRemoveSubviewsWithoutAnimations && !hasExitAnimation;
   NSMutableArray *toBeRemoved = [[NSMutableArray alloc] init];
@@ -521,7 +521,7 @@ BOOL REANodeFind(id<RCTComponent> view, int (^block)(id<RCTComponent>))
 {
   LayoutAnimationType type = before == nil ? ENTERING : LAYOUT;
   NSNumber *viewTag = view.reactTag;
-  if (_hasAnimationForTag(viewTag, type)) {
+  if ([self hasAnimationForTag:viewTag type:type]) {
     REASnapshot *after = [[REASnapshot alloc] init:view];
     if (before == nil) {
       [self onViewCreate:view after:after];
@@ -533,7 +533,7 @@ BOOL REANodeFind(id<RCTComponent> view, int (^block)(id<RCTComponent>))
     [self setNewProps:before.values forView:view];
   }
 
-  if (_hasAnimationForTag(viewTag, SHARED_ELEMENT_TRANSITION)) {
+  if ([self hasAnimationForTag:viewTag type:SHARED_ELEMENT_TRANSITION]) {
     if (type == ENTERING) {
       [_sharedTransitionManager notifyAboutNewView:view];
     } else {
diff --git a/node_modules/react-native-reanimated/src/reanimated2/mappers.ts b/node_modules/react-native-reanimated/src/reanimated2/mappers.ts
index 4e66106..bc8712f 100644
--- a/node_modules/react-native-reanimated/src/reanimated2/mappers.ts
+++ b/node_modules/react-native-reanimated/src/reanimated2/mappers.ts
@@ -80,8 +80,11 @@ export function createMapperRegistry() {
   }
 
   function mapperRun() {
-    processingMappers = true;
     runRequested = false;
+    if (processingMappers) {
+      return;
+    }
+    processingMappers = true;
     if (mappers.size !== sortedMappers.length) {
       updateMappersOrder();
     }

ludwig-pro avatar Aug 09 '23 06:08 ludwig-pro

BTW I use Xcode_14.3.1.app to build the app

ludwig-pro avatar Aug 09 '23 12:08 ludwig-pro

@kr-yeon Does this crash happen through your local XCode with a release build?

anthlasserre avatar Aug 18 '23 15:08 anthlasserre

yeah

2023년 8월 19일 (토) 오전 12:21, Anthony LASSERRE @.***>님이 작성:

@kr-yeon https://github.com/kr-yeon Does this crash happen through your local XCode with a release build?

— Reply to this email directly, view it on GitHub https://github.com/microsoft/react-native-code-push/issues/2539#issuecomment-1684074767, or unsubscribe https://github.com/notifications/unsubscribe-auth/APRSJAEBTSIXME33J2VZGQTXV6B7LANCNFSM6AAAAAAZVO4QFY . You are receiving this because you were mentioned.Message ID: @.***>

kr-yeon avatar Aug 18 '23 15:08 kr-yeon

@kr-yeon Which MacOS version are you using ?

anthlasserre avatar Aug 18 '23 15:08 anthlasserre

Ventura 13.4 XCodeVersion is 14.3

2023년 8월 19일 (토) 오전 12:25, Anthony LASSERRE @.***>님이 작성:

@kr-yeon https://github.com/kr-yeon Which MacOS version are you using ?

— Reply to this email directly, view it on GitHub https://github.com/microsoft/react-native-code-push/issues/2539#issuecomment-1684079383, or unsubscribe https://github.com/notifications/unsubscribe-auth/APRSJADGZWVDMQV6GEGHFO3XV6CNNANCNFSM6AAAAAAZVO4QFY . You are receiving this because you were mentioned.Message ID: @.***>

kr-yeon avatar Aug 18 '23 15:08 kr-yeon

Should we consider react-native-code-push as deprecated?

ludwig-pro avatar Jan 18 '24 17:01 ludwig-pro

In fact, I excluded CodePush from the project. I don't know if I'm stupid, but I couldn't find the answer.

kr-yeon avatar Jan 18 '24 17:01 kr-yeon

I face the issue on Android , but work on iOS. Anyone face it on Android too?

iita71737 avatar Jan 20 '24 14:01 iita71737

I'm also experiencing that issue only on Android. I thought it might be a problem with the built bundle's asset path, but I removed Codepush first.

2024년 1월 20일 (토) 오후 11:54, DanLin @.***>님이 작성:

I face the issue on Android , but work on iOS. Anyone face it on Android too?

— Reply to this email directly, view it on GitHub https://github.com/microsoft/react-native-code-push/issues/2539#issuecomment-1902119799, or unsubscribe https://github.com/notifications/unsubscribe-auth/APRSJABFPLDEDE2KE32E3PDYPPLDHAVCNFSM6AAAAAAZVO4QF2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSGEYTSNZZHE . You are receiving this because you were mentioned.Message ID: @.***>

kr-yeon avatar Jan 20 '24 14:01 kr-yeon

Hi everyone! Could you please confirm what this issue still persist on latest version (8.2.1)?

MikhailSuendukov avatar Mar 04 '24 16:03 MikhailSuendukov

Any solutions, I am facing with iOS on release app. It crashes after restart

krunal-cmyk avatar Mar 15 '24 19:03 krunal-cmyk

The best solution is to drop codepush and use expo

ludwig-pro avatar Mar 16 '24 14:03 ludwig-pro

Im facing this same issue with expo-updates as well.

  • "react-native-reanimated": "3.6.2",
  • "react-native": "0.73.4",
  • "expo": "~50.0.11",
  • "expo-updates": "~0.24.11",

vlimag avatar Mar 28 '24 13:03 vlimag

any changes for this?

Logan-FE avatar Aug 05 '24 13:08 Logan-FE

Hi @Logan-FE thank you for reaching out. Does this issue still reproduce on latest 8.3.1 version?

DordeDimitrijev avatar Aug 06 '24 08:08 DordeDimitrijev

Im facing this same issue with expo-updates as well.

  • "react-native-reanimated": "3.6.2",
  • "react-native": "0.73.4",
  • "expo": "~50.0.11",
  • "expo-updates": "~0.24.11",

@vlimag vlimag you found any alternative or solution with this?

nihal-37-37 avatar Aug 22 '24 21:08 nihal-37-37

@DordeDimitrijev I'm facing same problem, distribution is fine but to effect on android application

"react-native-code-push": "^8.3.1",
 "react-native": "0.73.4",

nihal-37-37 avatar Aug 22 '24 21:08 nihal-37-37

@nihal-37-37 , are you using react-native-reanimated in direct or transitive dependencies? Could you share your crash log?

DmitriyKirakosyan avatar Aug 27 '24 08:08 DmitriyKirakosyan