Skip to content

[Android] - v3.9.1 Crash on component unmount when frame processor is running🐛  #2657

@ldstein

Description

@ldstein

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions