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

[Android] copyDirectoryContents crash caused by a null sourceDirectoryPath when a new version released #906

Closed
pinqy520 opened this issue Jun 27, 2017 · 11 comments
Assignees
Labels

Comments

@pinqy520
Copy link

pinqy520 commented Jun 27, 2017

Description

java.lang.RuntimeException: An error occurred while executing doInBackground()
	at android.os.AsyncTask$3.done(AsyncTask.java:309)
	at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
	at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
	at java.util.concurrent.FutureTask.run(FutureTask.java:242)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
	at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'char[] java.lang.String.toCharArray()' on a null object reference
	at java.io.File.fixSlashes(File.java:183)
	at java.io.File.<init>(File.java:130)
	at com.microsoft.codepush.react.FileUtils.copyDirectoryContents(FileUtils.java:19)
	at com.microsoft.codepush.react.CodePushUpdateUtils.copyNecessaryFilesFromCurrentPackage(CodePushUpdateUtils.java:71)
	at com.microsoft.codepush.react.CodePushUpdateManager.downloadPackage(CodePushUpdateManager.java:226)
	at com.microsoft.codepush.react.CodePushNativeModule$3.doInBackground(CodePushNativeModule.java:211)
	at com.microsoft.codepush.react.CodePushNativeModule$3.doInBackground(CodePushNativeModule.java:205)
	at android.os.AsyncTask$2.call(AsyncTask.java:295)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)

Reproduction

i generated an app version 0.0.14, and it crashed every time after i release a new jsbundle. so i had to roll it back. then i try to generate a new 0.0.14 apk with nothing changed, and it does not crash any more after i release the jsbundle again.

Additional Information

  • react-native-code-push version: 2.1.0-beta
  • react-native version: 0.45
  • iOS/Android/Windows version: Android
  • Does this reproduce on a debug build or release build? release
  • Does this reproduce on a simulator, or only on a physical device? all
@pinqy520 pinqy520 changed the title copyDirectoryContents crash caused by a null sourceDirectoryPath when a new version released [Android] copyDirectoryContents crash caused by a null sourceDirectoryPath when a new version released Jun 27, 2017
@sergey-akhalkov
Copy link
Contributor

Hi @pinqy520, thanks for reaching us. Please note, that react-native-code-push version: 2.1.0-beta is not compatible with RN 0.45 - please take a look at details here #878
Also the issue you have provided looks very similar to this one #795 and I believe it has been fixed here #870.
Could you please provide me the command you are using to release new CodePush updates? Also it would be very helpful if you could provide me with exact repro steps so I would be able to reproduce the issue using fresh RN app.

@sergey-akhalkov sergey-akhalkov self-assigned this Jun 27, 2017
@pinqy520
Copy link
Author

pinqy520 commented Jun 27, 2017

@sergey-akhalkov thanks for reply~! this issue is not the same with #795 , #795 is because that the param directoryPath of function deleteDirectoryAtPath is null, and in this issue it is because of the function copyDirectoryContents. i don't know why the param sourceDirectoryPath is null. i can open a pr that simply check if sourceDirectoryPath is null, but i don't think it can fixes this problem.

the command line i release new Code Push update is

code-push promote faceparty-android Staging Production

and it works fine in a 'Staging' deployment APK. i think it is nothing to do with this issue.

actually, i really don't know how to reproduce this, because i don't know how the Code Push works. i
just generated a APK and give it to users. i release a code push update, then all users opened the app after that are crashed. i have to rollback this update, and regenerating a new APK fixed that.

@sergey-akhalkov
Copy link
Contributor

@pinqy520, thanks for the clarification, I've just tried to reproduce the issue but with no luck, so could you please provide me with full deployment history both for Staging and Production? (code-push deployment history <appName> <deploymentName>)

@pinqy520
Copy link
Author

ok...
image
image
and thank you for your great work very much~! @sergey-akhalkov

@sergey-akhalkov
Copy link
Contributor

Hi @pinqy520, got it, thanks for the outputs. I believe the issue has place due CodePush Service diffing issue that has been fixed recently - #892
Due to I'm not able to reproduce the issue you have - I would recommend you to release new 0.0.14 binary version of the app and create new deployment instead of Staging to test your updates and promote to Production - something like "Staging2" or so.

Please let me know if you have any questions or considerations.

@pinqy520
Copy link
Author

thx~!

@pinqy520
Copy link
Author

pinqy520 commented Jul 2, 2017

@sergey-akhalkov hi, i just upgrade to 3.0.0-beta, and it still crash even though i regenerate a new apk and in the 'Staging'. seems it is similar to issue #910

@sergey-akhalkov
Copy link
Contributor

Hi @pinqy520, got it, please take a look at my response here

@rj12info
Copy link

rj12info commented Jul 3, 2017

****Got this crash after putting
codePush.getCurrentPackage()

and manifest

and package.json
"react-native-code-push": "^3.0.0-beta",****

at java.lang.Thread.run(Thread.java:818)
E/AndroidRuntime(20157): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'char[] java.lang.String.toCharArray()' on a null object reference
E/AndroidRuntime(20157): at java.io.File.fixSlashes(File.java:185)
E/AndroidRuntime(20157): at java.io.File.(File.java:134)
E/AndroidRuntime(20157): at com.microsoft.codepush.react.FileUtils.copyDirectoryContents(FileUtils.java:19)
E/AndroidRuntime(20157): at com.microsoft.codepush.react.CodePushUpdateUtils.copyNecessaryFilesFromCurrentPackage(CodePushUpdateUtils.java:71)
E/AndroidRuntime(20157): at com.microsoft.codepush.react.CodePushUpdateManager.downloadPackage(CodePushUpdateManager.java:226)
E/AndroidRuntime(20157): at com.microsoft.codepush.react.CodePushNativeModule$3.doInBackground(CodePushNativeModule.java:230)
E/AndroidRuntime(20157): at com.microsoft.codepush.react.CodePushNativeModule$3.doInBackground(CodePushNativeModule.java:224)
E/AndroidRuntime(20157): at android.os.AsyncTask$2.call(AsyncTask.java:292)
E/AndroidRuntime(20157): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E/AndroidRuntime(20157): ... 3 more

@max-mironov
Copy link
Contributor

Hey @rj12info, thank you for sharing this. Is it possible for you track code-push.getCurrentPackage output for us as it is described here? This would really help us a lot in investigating the issue.

@pinqy520
Copy link
Author

pinqy520 commented Jul 3, 2017

@max-mironov .Hi, it returns null, i just commented here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants