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

Android app crash when accessing CodePush

Open huitsing opened this issue 10 years ago • 11 comments

We have an issue on Android where, after uploading a photo via react-native-image-picker, we'd get a crash: E/Vold(3586): Failed to find mounted volume for /storage/extSdCard/Android/data/com.zeemee.zeemee_android.Staging/cache/

We noticed right before the crash, the app was attempting a codepush operation. We commented out codepush, and the crashes no longer exist.

What is super crazy about it is that, after the first crash, you can never launch the app again - it'd crash in exactly the same way.

07-28 19:42:30.012: D/ReactNative(27166): [CodePush] Loading JS bundle from "/data/data/com.zeemee.zeemee_android.Staging/files/CodePush/<bunch of characters>/CodePush/index.android.bundle"
07-28 19:42:30.017: E/Vold(3586): Failed to find mounted volume for /storage/extSdCard/Android/data/com.zeemee.zeemee_android.Staging/cache/
07-28 19:42:30.017: W/ContextImpl(27166): Failed to ensure directory: /storage/extSdCard/Android/data/com.zeemee.zeemee_android.Staging/cache
07-28 19:42:30.432: E/Vold(3586): Failed to find mounted volume for /storage/extSdCard/Android/data/com.zeemee.zeemee_android.Staging/cache/
07-28 19:42:30.437: W/ContextImpl(27166): Failed to ensure directory: /storage/extSdCard/Android/data/com.zeemee.zeemee_android.Staging/cache

/storage/extSdCard is empty on the device.

Thanks!

huitsing avatar Jul 29 '16 02:07 huitsing

Hi @huitsing, do you have a stack trace? The ones you pasted looks like just debug logs.

geof90 avatar Jul 29 '16 16:07 geof90

This only happens on a release build unfortunately, so we don't get much context.

huitsing avatar Jul 29 '16 16:07 huitsing

Could you share a code snippet on how you are using the image picker (options, etc)? I'm trying to set up a repro.

geof90 avatar Jul 29 '16 20:07 geof90

let opts = {
  title: 'Choose a Photo', // specify null or empty string to remove the title
  cancelButtonTitle: 'Cancel',
  takePhotoButtonTitle: 'Take Photo', // specify null or empty string to remove this button
  // specify null or empty string to remove this button
  chooseFromLibraryButtonTitle: 'Choose Photo from Library',
  maxHeight: 900,
  maxWidth: 900,
  quality: 1,
  cameraType: 'back', // 'front' or 'back'
  mediaType: 'photo', // 'photo' or 'video'
  allowsEditing: true, // Built in functionality to resize/reposition the image after selection
  // photos only - disables the base64 `data` field from being generated
  // (greatly improves performance on large photos)
  noData: false,
  storageOptions: {
    skipBackup: true,
    path: 'uploads',
  },
};

ImagePickerManager.showImagePicker(opts, (response) => {
  if (response.didCancel) {
    // handle user cancel case.
  } else if (response.error) {
    // handle error case.
  } else if (response.customButton) {
    // Handle custom button response.
  } else {
    // Handle photo upload.
  }
});

pthrasher avatar Jul 29 '16 20:07 pthrasher

I can't get a repro to work from just launching the image picker after a codepush update is installed.

You said the crash only happens after the photo is uploaded? What exactly happens in the upload step, it just sends the image data to a server? What is triggering the read to the SD card?

Could you have accidentally CodePush-ed an update to production after adding a new react native plugin, which isn't bundled in the binary of your production apps, thereby causing a crash since the JS code that was pushed out isn't compatible to the binary?

geof90 avatar Jul 29 '16 21:07 geof90

@huitsing, did you still need help with this issue?

richardhuaaa avatar Aug 10 '16 19:08 richardhuaaa

Hi @silhouettes - we ended up shipping without CodePush on Android for this release to avoid the crashing, but it's in our near-term backlog to reevaluate. Hopefully we can give you a much cleaner, more direct answer soon on this.

huitsing avatar Aug 10 '16 19:08 huitsing

Thanks, looking forward to getting to the bottom of this!

richardhuaaa avatar Aug 10 '16 19:08 richardhuaaa

Hi @huitsing, just a friendly ping! Were you able to repro the crash?

richardhuaaa avatar Aug 26 '16 18:08 richardhuaaa

Hi @silhouettes - thanks for the ping! We have just finished testing this (within the past hour) and it's working great! No crashes.

We can't really prove it, but there is a descent chance that we were in a bad state on our deployed JS bundle's compatibility with the underlying native code in our dev environment when we were experiencing problems. From your end, I'd assume that this is a non-issue. I will open a new issue if we run into any other problems.

huitsing avatar Aug 26 '16 19:08 huitsing

Thanks @huitsing, I'm glad it's working now :)

richardhuaaa avatar Aug 26 '16 20:08 richardhuaaa