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] - v3.9.1 Crash on component unmount when frame processor is running🐛 #2657

Closed
4 of 5 tasks
ldstein opened this issue Mar 18, 2024 · 5 comments
Closed
4 of 5 tasks
Labels
🐛 bug Something isn't working

Comments

@ldstein
Copy link

ldstein commented Mar 18, 2024

What's happening?

I'm in the process of upgrading an App from RNVC v3.4.0.

The app implements a custom Frame Processor plugin using MLKit for barcode scanning. Nothing advanced - just some QR code detection plus boundary co-ordinates used for overlay drawing.

Upgrading RNVC to v3.9.1 introduced an intermittent crash when either:

  • The frame processor prop is toggled between a fn and null value.
  • The camera component is unmounted

To demonstrate the crash, I have added a minimal Barcode frame processor to the Example App:
https://github.com/ldstein/react-native-vision-camera/tree/crash-test

There is a new icon (Green bug icon) which toggles rendering the Camera component. Continuously tapping the bug icon will eventually lead to a crash.

Appreciate any pointers if the issue is with my frame processor implementation. Has been stable in RNVC 3.40, but that was many moons ago.
https://github.com/ldstein/react-native-vision-camera/blob/crash-test/package/example/android/app/src/main/java/com/mrousavy/camera/example/ExampleQRScannerPlugin.java

Reproduceable Code

https://github.com/ldstein/react-native-vision-camera/tree/crash-test

Relevant log output

rnvc-v3.9.1-crash-log.txt

024-03-19 11:18:31.541 31489-31718 BufferQueueProducer     com.mrousavy.camera.example          E  [ImageReader-1920x960f23m3-31489-3](id:7b0100000005,api:4,p:1184,c:31489) cancelBuffer: BufferQueue has been abandoned
2024-03-19 11:18:31.608 31719-31719 DEBUG                   pid-31719                            A  pid: 31489, tid: 31615, name: pool-5-thread-4  >>> com.mrousavy.camera.example <<<
2024-03-19 11:18:31.810 31719-31719 DEBUG                   pid-31719                            A        #00 pc 00000000000ed660  /data/app/~~KwUq6gEJOyEx36jK5wtBvg==/com.mrousavy.camera.example-VIHMv8k5RqKcu1RFfsWOUQ==/base.apk!libbarhopper_v3.so (offset 0x6ed000) (BuildId: cf64ac3d5cfd71b04d3bc4112d678e48)
2024-03-19 11:18:31.810 31719-31719 DEBUG                   pid-31719                            A        #01 pc 00000000000d03c8  /data/app/~~KwUq6gEJOyEx36jK5wtBvg==/com.mrousavy.camera.example-VIHMv8k5RqKcu1RFfsWOUQ==/base.apk!libbarhopper_v3.so (offset 0x6ed000) (BuildId: cf64ac3d5cfd71b04d3bc4112d678e48)
2024-03-19 11:18:31.810 31719-31719 DEBUG                   pid-31719                            A        #02 pc 00000000000ca240  /data/app/~~KwUq6gEJOyEx36jK5wtBvg==/com.mrousavy.camera.example-VIHMv8k5RqKcu1RFfsWOUQ==/base.apk!libbarhopper_v3.so (offset 0x6ed000) (BuildId: cf64ac3d5cfd71b04d3bc4112d678e48)
2024-03-19 11:18:31.810 31719-31719 DEBUG                   pid-31719                            A        #03 pc 00000000000c9f64  /data/app/~~KwUq6gEJOyEx36jK5wtBvg==/com.mrousavy.camera.example-VIHMv8k5RqKcu1RFfsWOUQ==/base.apk!libbarhopper_v3.so (offset 0x6ed000) (BuildId: cf64ac3d5cfd71b04d3bc4112d678e48)
2024-03-19 11:18:31.810 31719-31719 DEBUG                   pid-31719                            A        #04 pc 00000000000ca4f0  /data/app/~~KwUq6gEJOyEx36jK5wtBvg==/com.mrousavy.camera.example-VIHMv8k5RqKcu1RFfsWOUQ==/base.apk!libbarhopper_v3.so (offset 0x6ed000) (BuildId: cf64ac3d5cfd71b04d3bc4112d678e48)
2024-03-19 11:18:31.811 31719-31719 DEBUG                   pid-31719                            A        #05 pc 00000000000c8aa4  /data/app/~~KwUq6gEJOyEx36jK5wtBvg==/com.mrousavy.camera.example-VIHMv8k5RqKcu1RFfsWOUQ==/base.apk!libbarhopper_v3.so (offset 0x6ed000) (BuildId: cf64ac3d5cfd71b04d3bc4112d678e48)
2024-03-19 11:18:31.811 31719-31719 DEBUG                   pid-31719                            A        #06 pc 00000000000c8b44  /data/app/~~KwUq6gEJOyEx36jK5wtBvg==/com.mrousavy.camera.example-VIHMv8k5RqKcu1RFfsWOUQ==/base.apk!libbarhopper_v3.so (offset 0x6ed000) (Java_com_google_android_libraries_barhopper_BarhopperV3_recognizeBufferNative+84) (BuildId: cf64ac3d5cfd71b04d3bc4112d678e48)
2024-03-19 11:18:31.811 31719-31719 DEBUG                   pid-31719                            A        #24 pc 00000000000f53f4  [anon:dalvik-classes17.dex extracted in memory from /data/app/~~KwUq6gEJOyEx36jK5wtBvg==/com.mrousavy.camera.example-VIHMv8k5RqKcu1RFfsWOUQ==/base.apk!classes17.dex] (com.google.mlkit.vision.barcode.internal.zzk.run+4)
2024-03-19 11:18:31.811 31719-31719 DEBUG                   pid-31719                            A        #27 pc 00000000000f8a6e  [anon:dalvik-classes17.dex extracted in memory from /data/app/~~KwUq6gEJOyEx36jK5wtBvg==/com.mrousavy.camera.example-VIHMv8k5RqKcu1RFfsWOUQ==/base.apk!classes17.dex] (com.google.mlkit.vision.common.internal.MobileVisionBase.zza+22)
2024-03-19 11:18:31.811 31719-31719 DEBUG                   pid-31719                            A        #30 pc 00000000000f8f64  [anon:dalvik-classes17.dex extracted in memory from /data/app/~~KwUq6gEJOyEx36jK5wtBvg==/com.mrousavy.camera.example-VIHMv8k5RqKcu1RFfsWOUQ==/base.apk!classes17.dex] (com.google.mlkit.vision.common.internal.zza.call+8)
2024-03-19 11:18:31.811 31719-31719 DEBUG                   pid-31719                            A        #33 pc 00000000000ed3fa  [anon:dalvik-classes17.dex extracted in memory from /data/app/~~KwUq6gEJOyEx36jK5wtBvg==/com.mrousavy.camera.example-VIHMv8k5RqKcu1RFfsWOUQ==/base.apk!classes17.dex] (com.google.mlkit.common.sdkinternal.ModelResource.zza+74)
2024-03-19 11:18:31.811 31719-31719 DEBUG                   pid-31719                            A        #36 pc 00000000000f1fb4  [anon:dalvik-classes17.dex extracted in memory from /data/app/~~KwUq6gEJOyEx36jK5wtBvg==/com.mrousavy.camera.example-VIHMv8k5RqKcu1RFfsWOUQ==/base.apk!classes17.dex] (com.google.mlkit.common.sdkinternal.zzn.run+20)
2024-03-19 11:18:31.811 31719-31719 DEBUG                   pid-31719                            A        #49 pc 00000000000f1e9c  [anon:dalvik-classes17.dex extracted in memory from /data/app/~~KwUq6gEJOyEx36jK5wtBvg==/com.mrousavy.camera.example-VIHMv8k5RqKcu1RFfsWOUQ==/base.apk!classes17.dex] (com.google.mlkit.common.sdkinternal.zzk.run+4)
2024-03-19 11:18:31.811 31719-31719 DEBUG                   pid-31719                            A        #58 pc 00000000000ed100  [anon:dalvik-classes17.dex extracted in memory from /data/app/~~KwUq6gEJOyEx36jK5wtBvg==/com.mrousavy.camera.example-VIHMv8k5RqKcu1RFfsWOUQ==/base.apk!classes17.dex] (com.google.mlkit.common.sdkinternal.MlKitThreadPool.zzd+20)
2024-03-19 11:18:31.811 31719-31719 DEBUG                   pid-31719                            A        #61 pc 00000000000f1e20  [anon:dalvik-classes17.dex extracted in memory from /data/app/~~KwUq6gEJOyEx36jK5wtBvg==/com.mrousavy.camera.example-VIHMv8k5RqKcu1RFfsWOUQ==/base.apk!classes17.dex] (com.google.mlkit.common.sdkinternal.zzi.run+4)

Camera Device

{
  "formats": [],
  "sensorOrientation": "landscape-left",
  "hardwareLevel": "full",
  "maxZoom": 7,
  "minZoom": 1,
  "maxExposure": 24,
  "supportsLowLightBoost": false,
  "neutralZoom": 1,
  "physicalDevices": [
    "wide-angle-camera"
  ],
  "supportsFocus": true,
  "supportsRawCapture": true,
  "isMultiCam": false,
  "minFocusDistance": 10,
  "minExposure": -24,
  "name": "BACK (0)",
  "hasFlash": true,
  "hasTorch": true,
  "position": "back",
  "id": "0"
}

Device

Pixel 3, Pixel 3 XL

VisionCamera Version

3.9.1

Can you reproduce this issue in the VisionCamera Example app?

Yes

Additional information

@ldstein ldstein added the 🐛 bug Something isn't working label Mar 18, 2024
@mrousavy
Copy link
Owner

Hey! I just released a new V4 beta (v4.0.0-beta.7) where I fixed a bunch of issues! 💪🚀 Can you test that and see if that fixes the issue for you? 😅

yarn add react-native-vision-camera@beta

You might need to increase the compileSdk to the newest Android SDK (34) if you are behind.

@jimsideout
Copy link

@mrousavy this appears to be resolved in the beta. Thank you!

@ldstein
Copy link
Author

ldstein commented Mar 19, 2024

Hi @mrousavy

Still seeing a crash in v4.0.0-beta.7 when Camera component is unmounted and frame processor is running.

But it no longer crashes in v4.0.0-beta.8! Camera component unmount also appears faster/smooter (back to v3.5.1 speed).

Thanks!

@mrousavy
Copy link
Owner

Thanks guys, great to hear that V4 now works perfectly! If you appreciate my work, please consider 💖 sponsoring me on GitHub 💖 so I can keep maintaining this library, fixing bugs and building new features! :)

@mrousavy
Copy link
Owner

Hey - I think this issue has been fixed in VisionCamera 4.0.0. 🥳

Please try V4 and let me know if you still experience this issue;

  • if not, please consider 💖 sponsoring me on GitHub 💖 to support the development of VisionCamera and thank me for my time spent on fixing bugs and building new features.
  • if you still see this issue, please comment and we can re-open this. But please update your native logs with the native (Xcode/Android Studio) logs from running VisionCamera V4 so I can investigate this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants