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

Crash while restarting app after downloading new bundle

Open thotegowda opened this issue 9 years ago • 5 comments

App downloads updated bundle from server. But when tries to restart the app, it crashes. With lot of Sync already in progress. and Loading bundle on resume messages.

ReactNativeJS: [CodePush] Downloading package.
ReactNativeJS: [CodePush] Installing update.
ReactNativeJS: [CodePush] Restarting app
ReactNative: [CodePush] Loading bundle on resume
ReactNativeJS: [CodePush] Sync already in progress.
ReactNative: [CodePush] Loading bundle on resume
ReactNativeJS: [CodePush] Sync already in progress.
ReactNative: [CodePush] Loading bundle on resume
...
<Continues for few seconds>

crash log says

com.facebook.react.uimanager.IllegalViewOperationException: Trying to add unknown view tag: 4040

Update is complete as expected, when app is ran after crash.

Any pointers to debug this issue?

thotegowda avatar May 18 '17 13:05 thotegowda

Hi @thotegowda, thanks for reaching us, could you please take a look at https://github.com/Microsoft/react-native-code-push/issues/841 and verify if you have the same issue as there or not?

sergey-akhalkov avatar May 18 '17 15:05 sergey-akhalkov

Thanks @sergey-akhalkov for quick response. Its the same issue, but the work-around mentioned in the thread, i.e. dex-guard configuration, is not working.

Its happening even in the debug build, where dex-guard is disabled.

thotegowda avatar May 19 '17 19:05 thotegowda

@thotegowda, got it, thanks for the clarification. I've not seen such kind of issue before, so could you please create new issue in react-native-code-push repo and fill as much info as possible? Also could you please try to reproduce the issue using our sample app/try to debug existing one from this point or share with us source code (minimal version of the app where the issue reproduces) if available?

Please let me know if you have any questions.

sergey-akhalkov avatar May 22 '17 11:05 sergey-akhalkov

Hey @sergey-akhalkov, spent some time looking in to what is happening. CodePushNativeModule.java looks in two ways to resolve ReactInstanceManager instance. (1) method getReactNativeHost() of ReactApplication (2) mReactInstanceManager member in ReactActivity or its derived.

In our case it was failing because we had a static instance of ReactNativeHost (our's is a brownfield application and also have our own reasons for keeping it as a static instance). For time being, I have fixed this issue by deriving Application class with ReactApplication and return static instance of the ReactNativeHost.

I think, we need a better approach for fetching ReactInstanceManager instance. Seen few discussions and PRs around this in react-native-code-push. So closing the issue.

Thank you

thotegowda avatar May 24 '17 15:05 thotegowda

Hey @thotegowda, got it, thanks for the clarification, please let us know if you see any issues or have any questions.

sergey-akhalkov avatar May 25 '17 10:05 sergey-akhalkov