NullPointerException in FileUtils.copyDirectoryContents
Steps to Reproduce
- Call CodePush.checkForUpdate()
- Call update.download()
Expected Behavior
Update downloads successfully.
Actual Behavior
java.lang.NullPointerException: Attempt to get length of null array
at com.microsoft.codepush.react.FileUtils.copyDirectoryContents(FileUtils.java:25)
at com.microsoft.codepush.react.CodePushUpdateManager.downloadPackage(CodePushUpdateManager.java:233)
at com.microsoft.codepush.react.CodePushNativeModule$3.doInBackground(CodePushNativeModule.java:216)
at com.microsoft.codepush.react.CodePushNativeModule$3.doInBackground(CodePushNativeModule.java:210)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Environment
Captured by Sentry in production.
- react-native-code-push version: 2.0.6
- react-native version: 0.59.5
- iOS/Android/Windows version: Android 9, Android 8.1.0
- Does this reproduce on a debug build or release build? Release
One device that repeatedly triggered the crash had low disk space. This could be related.
Seems there's a missing exists() check here which causes the crash, but the missing source directory indicates a deeper problem.
https://github.com/microsoft/react-native-code-push/blob/3144c916018fab077231e88d8718ad3a1cb0a7d8/android/app/src/main/java/com/microsoft/codepush/react/FileUtils.java#L19
Hey @maxhawkins, Thanks for reporting!
One device that repeatedly triggered the crash had low disk space. This could be related.
Could you please clarify what device is it? Just in case.
react-native-code-push version: 2.0.6
Sorry, could you double-check that?
Seems there's a missing exists() check here which causes the crash, but the missing source directory indicates a deeper problem.
Sound reasonable. We'll try to reproduce the problem and see if it's caused by missing source directory or something else.
Crashlytics is seeing this:
- HUAWEI P smart 2019 -- 50%
- Mate 20 Pro --36%
@yuri-kulikov Again it's all Android devices, in #1505 you mention "these Huawei devices may have an unusual memory configuration", is there anything we can do here?
@maxhawkins Hello and sorry for the delay.
Unfortunately, I could not reproduce this issue, could you clarify whether you continue to encounter it?
Hi @maxhawkins
Unfortunately, I'm going to close this issue for now as I haven't heard from you in a while. Please feel free to reopen this issue if you have questions.
Seeing this issue in vivo, oppo, samsung, xiaomi. using 8.1.0 version.
Facing the same issue on multiple android devices.
We have now in the last few days seen this error on 3 different Android devices: Oppo A54, Moto G22 & Galaxy Tab A7. Was there any resolution to the issue?
Facing same issue from last couple of days
Is the problem solved? or my fault?
Anyone still facing this issue on the latest version of react-native-code-push? If so, please share your crash logs.
Reopen #2760