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

NullPointerException in FileUtils.copyDirectoryContents

Open maxhawkins opened this issue 7 years ago • 14 comments

Steps to Reproduce

  1. Call CodePush.checkForUpdate()
  2. 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.

maxhawkins avatar May 10 '19 16:05 maxhawkins

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

maxhawkins avatar May 10 '19 16:05 maxhawkins

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.

yuri-kulikov avatar May 13 '19 14:05 yuri-kulikov

Double-checked. It's actually

[email protected]

I saw this error on a Pixel 2 and a Moto G

maxhawkins avatar May 13 '19 15:05 maxhawkins

Crashlytics is seeing this:

  • HUAWEI P smart 2019 -- 50%
  • Mate 20 Pro --36%

henrymoulton avatar Aug 27 '19 11:08 henrymoulton

@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?

henrymoulton avatar Aug 27 '19 11:08 henrymoulton

@maxhawkins Hello and sorry for the delay.

Unfortunately, I could not reproduce this issue, could you clarify whether you continue to encounter it?

andreidubov avatar Jul 14 '20 14:07 andreidubov

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.

andreidubov avatar Jul 22 '20 12:07 andreidubov

Seeing this issue in vivo, oppo, samsung, xiaomi. using 8.1.0 version.

premhowli avatar Sep 18 '23 05:09 premhowli

Facing the same issue on multiple android devices.

HimanshuNarang avatar Jan 28 '24 10:01 HimanshuNarang

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?

DesHenaghen avatar Jan 29 '24 08:01 DesHenaghen

Facing same issue from last couple of days

himanshuzeptonow avatar Jan 29 '24 09:01 himanshuzeptonow

Is the problem solved? or my fault?

Piousangel avatar Mar 26 '24 08:03 Piousangel

Anyone still facing this issue on the latest version of react-native-code-push? If so, please share your crash logs.

DmitriyKirakosyan avatar Jun 11 '24 05:06 DmitriyKirakosyan

Reopen #2760

miridih-chyoon avatar Sep 18 '24 23:09 miridih-chyoon