mrousavy / react-native-vision-camera

📸 A powerful, high-performance React Native Camera library.
https://react-native-vision-camera.com
MIT License
6.72k stars 1k forks source link

🐛App crashed after scanning a qrcode #2189

Closed sunnystarh closed 5 months ago

sunnystarh commented 6 months ago

What's happening?

I have a crash after scanning the QR code. I haven't found the reason yet. I have released the relevant code and logs. I hope someone can answer it.

Reproduceable Code

const onAuth = async () => {
    const grantedStatus = await Camera.requestCameraPermission();
    if (grantedStatus === 'granted') {
      setHasCameraPermit(true);
    } else {
      setHasCameraPermit(false);
    }
  };
  useEffect(() => {
    onAuth();
  }, []);

  const codeScanner = useCodeScanner({
    codeTypes: ['qr'],
    onCodeScanned: codeData => {
      if (codeData[0].value) {
        verificationCodeData.current = codeData[0].value;
        if (source === 'fromScanIcon') {
          scanCodeFromScanIcon();
        } else if (source === 'fromBindButton') {
          scanCodeFromBindButton();
        }
      }
    },
  });

      {device != null && HasCameraPermit (
        <Camera
          photo={false}
          video={false}
          isActive={isFocused}
          device={device}
          codeScanner={codeScanner}
          style={StyleSheet.absoluteFill}
          torch={TorchMode}
        />
      )}

Relevant log output

--------- beginning of crash
2023-11-21 11:34:14.044 18948-22275 libc                    com.scan                          A  Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x77c20bc0f7 in tid 22275 (pool-10-thread-), pid 18948 (com.scan)
2023-11-21 11:34:14.078 18948-22278 BufferQueueProducer     com.scan                          E  [ImageReader-1280x720f23m2-18948-18](id:4a040000001e,api:4,p:1554,c:18948) queueBuffer: BufferQueue has been abandoned
2023-11-21 11:34:14.086 18948-22368 BufferQueueProducer     com.scan                          E  [ImageReader-1280x720f23m2-18948-18](id:4a040000001e,api:4,p:1554,c:18948) queueBuffer: BufferQueue has been abandoned
2023-11-21 11:34:14.117 18948-22368 BufferQueueProducer     com.scan                          E  [ImageReader-1280x720f23m2-18948-18](id:4a040000001e,api:4,p:1554,c:18948) queueBuffer: BufferQueue has been abandoned
2023-11-21 11:34:14.185 18948-18961 BufferQueueProducer     com.scan                          E  [ImageReader-1280x720f23m2-18948-18](id:4a040000001e,api:4,p:1554,c:18948) queueBuffer: BufferQueue has been abandoned
2023-11-21 11:34:14.189 18948-22278 BufferQueueProducer     com.scan                          E  [ImageReader-1280x720f23m2-18948-18](id:4a040000001e,api:4,p:1554,c:18948) queueBuffer: BufferQueue has been abandoned
2023-11-21 11:34:14.216 18948-22278 BufferQueueProducer     com.scan                          E  [ImageReader-1280x720f23m2-18948-18](id:4a040000001e,api:4,p:1554,c:18948) queueBuffer: BufferQueue has been abandoned
---------------------------- PROCESS STARTED (24847) for package com.scan ----------------------------
2023-11-21 11:34:14.249 18948-22278 BufferQueueProducer     com.scan                          E  [ImageReader-1280x720f23m2-18948-18](id:4a040000001e,api:4,p:1554,c:18948) queueBuffer: BufferQueue has been abandoned
2023-11-21 11:34:14.284 18948-22278 BufferQueueProducer     com.scan                          E  [ImageReader-1280x720f23m2-18948-18](id:4a040000001e,api:4,p:1554,c:18948) queueBuffer: BufferQueue has been abandoned
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A  Cmdline: com.scan
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A  pid: 18948, tid: 22275, name: pool-10-thread-  >>> com.scan <<<
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #00 pc 00000000000ed660  /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/lib/arm64/libbarhopper_v3.so (BuildId: cf64ac3d5cfd71b04d3bc4112d678e48)
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #01 pc 00000000000d03c8  /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/lib/arm64/libbarhopper_v3.so (BuildId: cf64ac3d5cfd71b04d3bc4112d678e48)
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #02 pc 00000000000ca240  /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/lib/arm64/libbarhopper_v3.so (BuildId: cf64ac3d5cfd71b04d3bc4112d678e48)
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #03 pc 00000000000c9f64  /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/lib/arm64/libbarhopper_v3.so (BuildId: cf64ac3d5cfd71b04d3bc4112d678e48)
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #04 pc 00000000000ca4f0  /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/lib/arm64/libbarhopper_v3.so (BuildId: cf64ac3d5cfd71b04d3bc4112d678e48)
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #05 pc 00000000000c8aa4  /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/lib/arm64/libbarhopper_v3.so (BuildId: cf64ac3d5cfd71b04d3bc4112d678e48)
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #06 pc 00000000000c8b44  /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/lib/arm64/libbarhopper_v3.so (Java_com_google_android_libraries_barhopper_BarhopperV3_recognizeBufferNative+84) (BuildId: cf64ac3d5cfd71b04d3bc4112d678e48)
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #14 pc 00000000001e890c  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #20 pc 0000000000295758  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #26 pc 000000000029585a  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #32 pc 00000000001ac93c  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #38 pc 00000000001ac12a  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #47 pc 0000000000187c8a  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #53 pc 00000000001a9f2e  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #59 pc 0000000000299036  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #65 pc 00000000002983bc  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #71 pc 0000000000298388  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #77 pc 000000000029ba2a  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #83 pc 000000000029bf20  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #89 pc 0000000000290362  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #95 pc 0000000000294f24  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #101 pc 00000000002950f4  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #107 pc 000000000029009a  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #110 pc 000000000029003c  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
2023-11-21 11:34:14.531 24845-24845 DEBUG                   pid-24845                            A        #115 pc 0000000000294e0c  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
2023-11-21 11:34:14.532 24845-24845 DEBUG                   pid-24845                            A        #126 pc 0000000000290068  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
2023-11-21 11:34:14.532 24845-24845 DEBUG                   pid-24845                            A        #129 pc 0000000000294d90  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~Pua-MPb3_YSekKggq0wYvw==/com.scan-GEIEq0XRBLMCfIwCAOPiMw==/base.apk!classes6.dex]
---------------------------- PROCESS ENDED (18948) for package com.scan ----------------------------
2023-11-21 11:34:14.683  3202-3600  DollieAdapterService    pid-3202                             E  notifyActivityState pkg:com.scan/com.scan.MainActivity state:19 fg:false mUid:10304
---------------------------- PROCESS ENDED (24847) for package com.scan ----------------------------

Camera Device

{"hardwareLevel": "full", "hasFlash": true, "hasTorch": true, "id": "0", "isMultiCam": false, "maxZoom": 8, "minZoom": 1, "name": "BACK (0)", "neutralZoom": 1, "physicalDevices": ["wide-angle-camera"], "position": "back", "sensorOrientation": "landscape-right", "supportsFocus": true, "supportsLowLightBoost": true, "supportsRawCapture": true}

Device

honor 70

VisionCamera Version

v3.6.4

Can you reproduce this issue in the VisionCamera Example app?

Yes, I can reproduce the same issue in the Example app here

Additional information

yasirlateef commented 6 months ago

+1

In my case, the app only crashes after the first QR scan. Once I restart the app, it proceeds to scan QR codes without any crash. I just came across this issue yesterday. I'll definitely share any findings under this thread.

apadev666 commented 6 months ago
apadev666 commented 6 months ago

@mrousavy please take a look at this

mrousavy commented 6 months ago

@mrousavy please take a look at this

@apadev666 why?

apadev666 commented 6 months ago

@manuelbieh any ideas why its happening? as I understand there are many users with this same problem, I tried to downgrade version of package but nothing helped. Can you help ?

yasirlateef commented 6 months ago

@apadev666 this could happen for a number of reasons. Firstly, it could happen if you don't configure your camera properly. Try removing all the props except for the required ones and try adding them one-by-one to see what breaks.

yasirlateef commented 6 months ago

There is no apparent bug related to the scanner functionality per-se.

apadev666 commented 6 months ago

I don't have any prop just standard initialization used from docs

apadev666 commented 6 months ago
<Camera
      photo
      device={device}
      isActive={isActive}
      codeScanner={codeScanner}
      style={[styles.absoluteFill]}
      torch={isTorchEnabled ? 'on' : 'off'}
    />

    here is code
apadev666 commented 6 months ago

it can crash for the first time but also after for example 10 attempts

interstates21 commented 6 months ago

+1

sunnystarh commented 6 months ago

I looked up issue 2090 and someone answered that changing react-native-vison-camera to version 3.5.1 works fine. So I tried lowering the version. Fortunately, I scanned the qrcode from afternoon to now, the app will not crash when scanning the qrcode.((I tried upgrading to v3.6.6 and v3.6.8 yesterday, and also tried downgrading to v3.6.0, but there was always a crash)

rodgomesc commented 6 months ago

@sunnystarh it's possible to update your log with more details before Fatal signal ?, there's some vision-camera logs that can help understand what's happening

rodgomesc commented 6 months ago

can you guys try those steps and lmk if works

this seems to be related to mlkit itself

mlkit/issues/714 mlkit/issues/598

apadev666 commented 6 months ago

@rodgomesc can you tell me please what is the latest version?

yasirlateef commented 6 months ago

@sunnystarh I can confirm downgrading to v.3.5.1 resolves this issue for now.

apadev666 commented 6 months ago

@yasirlateef @sunnystarh @rodgomesc for me event downgrade is not working((

apadev666 commented 6 months ago

@rodgomesc now Im using 23.44.14 version of google play service

yasirlateef commented 6 months ago

@yasirlateef @sunnystarh @rodgomesc for me event downgrade is not working((

If it were related to the package, downgrading would make a difference for you as well.

apadev666 commented 6 months ago

@yasirlateef it can be after some period, can you please try to scan barcode 10-15 times?

apadev666 commented 6 months ago

@rodgomesc I have tried also clean cache method as you mentioned, but the same crash(

rodgomesc commented 6 months ago

hey @apadev666 please stop spamming this is not a chat, try to write more sentences in same message

rodgomesc commented 6 months ago

@yasirlateef @sunnystarh @rodgomesc for me event downgrade is not working((

are you sure? you answered this on the same minute that yasirlateef did yoy tried that version before?

apadev666 commented 6 months ago

W W0000 00:00:1700572096.722037 12915 abi_method_util.h:33] not supported: TfLiteInterpreterGetTensor: TF Lite in Google Play services has stable ABI version 1.11.0 which is less than the required version 1.13.0. 2023-11-21 17:08:16.726 12211-12211 CameraSession com.gingy I Adding 4032 x 3024 Photo Output in Format #256... 2023-11-21 17:08:16.726 12211-12915 libc com.gingy A Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x6e1f79325b in tid 12915 (pool-13-thread-), pid 12211 (com.gingy) 2023-11-21 17:08:16.750 12211-12233 BufferQueueProducer com.gingy E ImageReader-1280x720f23m2-12211-30 queueBuffer: BufferQueue has been abandoned 2023-11-21 17:08:16.754 12211-12710 BufferQueueProducer com.gingy E ImageReader-1280x720f23m2-12211-30 dequeueBuffer: BufferQueue has been abandoned 2023-11-21 17:08:16.754 12211-12211 CameraSession com.gingy I Adding 1280 x 720 CodeScanner Output in Format #35... 2023-11-21 17:08:16.757 12211-12211 CreateCaptureSession com.gingy I Camera 0: Creating Capture Session #1017... Hardware Level: 3} | Outputs: [android.hardware.camera2.params.OutputConfiguration@355ade1d, android.hardware.camera2.params.OutputConfiguration@5fdb62cc] 2023-11-21 17:08:16.757 12211-12211 CreateCaptureSession com.gingy I Using new API (>=28) 2023-11-21 17:08:16.776 12211-12233 BufferQueueProducer com.gingy E ImageReader-1280x720f23m2-12211-30 queueBuffer: BufferQueue has been abandoned 2023-11-21 17:08:17.342 12211-13360 BpBinder com.gingy I onLastStrongRef automatically unlinking death recipients: 2023-11-21 17:08:17.345 12211-12598 CreateCaptureSession com.gingy I Camera 0: Capture Session #1017 configured! 2023-11-21 17:08:17.345 12211-12211 CameraSession com.gingy I Successfully configured Session with 2 outputs for Camera #0! 2023-11-21 17:08:17.345 12211-12598 CreateCaptureSession com.gingy I Camera 0: Capture Session #1016 closed! 2023-11-21 17:08:17.345 12211-12211 CameraSession com.gingy W Preview Output is null, aborting... 2023-11-21 17:08:17.345 12211-12211 CameraSession com.gingy I Successfully updated CameraSession Configuration! isActive: true 2023-11-21 17:08:17.347 12211-12211 CameraView com.gingy I Updating CameraSession... 2023-11-21 17:08:17.348 12211-12598 CameraSession com.gingy I Updating CameraSession Configuration... 2023-11-21 17:08:17.348 12211-12598 CameraSession com.gingy I Successfully updated CameraSession Configuration! isActive: false 2023-11-21 17:08:17.375 12211-12211 Choreographer com.gingy I Skipped 38 frames! The application may be doing too much work on its main thread. 2023-11-21 17:08:17.530 12211-12211 PreviewView com.gingy I Creating PreviewView... 2023-11-21 17:08:17.531 12211-12211 PreviewView com.gingy I PreviewView onMeasure(0, 0) 2023-11-21 17:08:17.531 12211-12211 PreviewView com.gingy D coverSize :: 1920x1080 (0.5625), 0x0 (NaN) 2023-11-21 17:08:17.531 12211-12211 PreviewView com.gingy D Fitted dimensions set: 0x0 2023-11-21 17:08:17.541 12211-12211 PreviewView com.gingy I Resizing PreviewView to 1920 x 1080... 2023-11-21 17:08:17.542 12211-12211 CameraView com.gingy I Updating CameraSession... 2023-11-21 17:08:17.542 12211-12598 CameraSession com.gingy I Updating CameraSession Configuration... 2023-11-21 17:08:17.542 12211-12598 CameraSession com.gingy I Configuring Camera #0... 2023-11-21 17:08:17.542 12211-12598 CameraManager com.gingy I Camera 0: Opening... 2023-11-21 17:08:17.545 1331-28017 CameraService pid-1331 I CameraService::connect call (PID -1 "com.gingy", camera ID 0) and Camera API version 2 2023-11-21 17:08:17.608 12211-12211 unknown:Na...chyManager com.gingy E Unable to update properties for view tag 2363 com.facebook.react.uimanager.IllegalViewOperationException: ViewManager for tag 2363 could not be found.

                                                                                                    at com.facebook.react.uimanager.NativeViewHierarchyManager.resolveViewManager(NativeViewHierarchyManager.java:111)
                                                                                                    at com.facebook.react.uimanager.NativeViewHierarchyManager.updateProperties(NativeViewHierarchyManager.java:138)
                                                                                                    at com.facebook.react.uimanager.UIImplementation.synchronouslyUpdateViewOnUIThread(UIImplementation.java:290)
                                                                                                    at com.swmansion.reanimated.NodesManager.updateProps(NodesManager.java:372)
                                                                                                    at com.swmansion.reanimated.nativeProxy.NativeProxyCommon.updateProps(NativeProxyCommon.java:102)
                                                                                                    at com.swmansion.reanimated.AndroidUIScheduler.triggerUI(Native Method)
                                                                                                    at com.swmansion.reanimated.AndroidUIScheduler$1.run(AndroidUIScheduler.java:24)
                                                                                                    at com.swmansion.reanimated.AndroidUIScheduler$2.runGuarded(AndroidUIScheduler.java:43)
                                                                                                    at com.facebook.react.bridge.GuardedRunnable.run(GuardedRunnable.java:30)
                                                                                                    at android.os.Handler.handleCallback(Handler.java:938)
                                                                                                    at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                    at android.os.Looper.loopOnce(Looper.java:201)
                                                                                                    at android.os.Looper.loop(Looper.java:288)
                                                                                                    at android.app.ActivityThread.main(ActivityThread.java:7842)
                                                                                                    at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                                                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

2023-11-21 17:08:17.626 12211-12211 CameraView com.gingy I Updating CameraSession... 2023-11-21 17:08:17.628 12211-12211 PreviewView com.gingy I PreviewView onMeasure(1080, 2039) 2023-11-21 17:08:17.629 12211-12211 PreviewView com.gingy D coverSize :: 1920x1080 (0.5625), 1080x2039 (0.5296714075527219) 2023-11-21 17:08:17.629 12211-12211 PreviewView com.gingy D Fitted dimensions set: 1147x2039 2023-11-21 17:08:17.645 12211-12211 CameraSession com.gingy I PreviewView Surface created! Surface(name=null)/@0x719384d 2023-11-21 17:08:17.645 12211-12211 CameraSession com.gingy I Setting Preview Output... 2023-11-21 17:08:17.646 12211-12211 CameraSession com.gingy I PreviewView Surface updated! Surface(name=null)/@0x719384d 1920 x 1080 2023-11-21 17:08:17.682 13338-13338 DEBUG pid-13338 A Cmdline: com.gingy 2023-11-21 17:08:17.682 13338-13338 DEBUG pid-13338 A pid: 12211, tid: 12915, name: pool-13-thread- >>> com.gingy <<< 2023-11-21 17:08:17.727 12211-13360 BpBinder com.gingy I onLastStrongRef automatically unlinking death recipients: 2023-11-21 17:08:17.730 1331-28017 Camera2ClientBase pid-1331 I Camera 0: Opened. Client: com.gingy (PID 12211, UID 11285) 2023-11-21 17:08:17.731 2171-13376 ActivityTaskManager pid-2171 W Force finishing activity com.gingy/.MainActivity 2023-11-21 17:08:17.731 12211-12321 CameraDevices com.gingy I Camera #0: Available! 2023-11-21 17:08:17.737 12211-12321 CameraDevices com.gingy I Camera #0: Unavailable! 2023-11-21 17:08:17.823 2171-7950 WindowManager pid-2171 I WIN DEATH: Window{5b530be u0 com.gingy/com.gingy.MainActivity} 2023-11-21 17:08:17.823 2171-2303 ConnectivityService pid-2171 D releasing NetworkRequest [ REQUEST id=11392, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VCN_MANAGED Uid: 11285 RequestorUid: 11285 RequestorPkg: com.gingy UnderlyingNetworks: Null] ] (release request) 2023-11-21 17:08:17.823 1331-28017 Camera2ClientBase pid-1331 I Closed Camera 0. Client was: com.gingy (PID 12211, UID 11285) 2023-11-21 17:08:17.823 1331-5342 Camera2ClientBase pid-1331 I Closed Camera 0. Client was: com.gingy (PID 12211, UID 11285) 2023-11-21 17:08:17.823 2171-7950 InputManager-JNI pid-2171 W Input channel object '5b530be com.gingy/com.gingy.MainActivity (client)' was disposed without first being removed with the input manager! 2023-11-21 17:08:17.824 1331-28017 Camera2ClientBase pid-1331 I Closed Camera 0. Client was: com.gingy (PID 12211, UID 11285) 2023-11-21 17:08:17.824 1331-5342 Camera2ClientBase pid-1331 I Closed Camera 0. Client was: com.gingy (PID 12211, UID 11285) 2023-11-21 17:08:17.824 1331-5342 Camera2ClientBase pid-1331 I Closed Camera 0. Client was: com.gingy (PID 12211, UID 11285) 2023-11-21 17:08:17.824 2171-3773 ActivityManager pid-2171 I Process com.gingy (pid 12211) has died: prcp TOP 2023-11-21 17:08:17.829 1331-2385 Camera2ClientBase pid-1331 I Closed Camera 0. Client was: com.gingy (PID 12211, UID 11285) 2023-11-21 17:08:18.234 2171-2217 ActivityTaskManager pid-2171 W Activity top resumed state loss timeout for ActivityRecord{3491e0 u0 com.gingy/.MainActivity t-1 f}}

here is logcat report @rodgomesc

PS sorry), yes I've tried many different versions also but its not working

yasirlateef commented 6 months ago

@apadev666 You logs indicate no errors thrown from VisionCamera itself. The only exception I can see in your logs is:

 E Unable to update properties for view tag 2363
com.facebook.react.uimanager.IllegalViewOperationException: ViewManager for tag 2363 could not be found.

It shows that the crash is coming from something related to your JSX/Styles. I would say you're trying to use style properties which are not allowed. It's exactly why downgrading won't do any good for you because this thread isn't relevant to your issue.

apadev666 commented 6 months ago

@yasirlateef can it be that I'm using Camera inside bottom sheet? here is render of this component !!device && ( <BottomSheetModal ref={bottomSheetModalRef} snapPoints={[WINDOW_HEIGHT]} handleStyle={GlobalStyles.hide} onDismiss={() => setIsScannerVisible(false)}> <Camera photo device={device} isActive={isActive} codeScanner={codeScanner} style={[styles.absoluteFill]} torch={isTorchEnabled ? 'on' : 'off'} /> <Pressable hitSlop={hitSlop} style={styles.closeContainer(insets?.top)} onPress={() => bottomSheetModalRef.current?.dismiss?.()}>

    </Pressable>
    {!!isActive && (
      <View style={styles.fillCenter}>
        <AppIcon
          width={350}
          height={250}
          icon="barcodeArea"
          fill={Colors.transparent}
        />
      </View>
    )}
    <TouchableOpacity
      style={styles.lightIconContainer}
      onPress={() => setIsTorchEnabled(prevState => !prevState)}>
      <AppIcon
        width={44}
        height={44}
        fill={Colors.transparent}
        icon={isTorchEnabled ? 'lightOn' : 'lightOff'}
      />
    </TouchableOpacity>
  </BottomSheetModal>

also here is other log that I'm getting

Cmdline: com.gingy 2023-11-21 17:32:21.910 15030-15030 DEBUG pid-15030 A pid: 13850, tid: 15003, name: pool-13-thread- >>> com.gingy <<< 2023-11-21 17:32:21.910 15030-15030 DEBUG pid-15030 A #42 pc 00000000001ec59c [anon:dalvik-classes17.dex extracted in memory from /data/app/~~jOCFGdxj5wkTo72tf5GlNw==/com.gingy-7vuK7DAnJ-PXXgw8ow40Pw==/base.apk!classes17.dex] 2023-11-21 17:32:21.910 15030-15030 DEBUG pid-15030 A #47 pc 000000000020e804 [anon:dalvik-classes17.dex extracted in memory from /data/app/~~jOCFGdxj5wkTo72tf5GlNw==/com.gingy-7vuK7DAnJ-PXXgw8ow40Pw==/base.apk!classes17.dex] 2023-11-21 17:32:21.910 15030-15030 DEBUG pid-15030 A #52 pc 00000000003657f0 [anon:dalvik-classes17.dex extracted in memory from /data/app/~~jOCFGdxj5wkTo72tf5GlNw==/com.gingy-7vuK7DAnJ-PXXgw8ow40Pw==/base.apk!classes17.dex] 2023-11-21 17:32:21.910 15030-15030 DEBUG pid-15030 A #57 pc 0000000000364c34 [anon:dalvik-classes17.dex extracted in memory from /data/app/~~jOCFGdxj5wkTo72tf5GlNw==/com.gingy-7vuK7DAnJ-PXXgw8ow40Pw==/base.apk!classes17.dex] 2023-11-21 17:32:21.910 15030-15030 DEBUG pid-15030 A #62 pc 0000000000364c14 [anon:dalvik-classes17.dex extracted in memory from /data/app/~~jOCFGdxj5wkTo72tf5GlNw==/com.gingy-7vuK7DAnJ-PXXgw8ow40Pw==/base.apk!classes17.dex] 2023-11-21 17:32:21.910 15030-15030 DEBUG pid-15030 A #67 pc 000000000036827c [anon:dalvik-classes17.dex extracted in memory from /data/app/~~jOCFGdxj5wkTo72tf5GlNw==/com.gingy-7vuK7DAnJ-PXXgw8ow40Pw==/base.apk!classes17.dex] 2023-11-21 17:32:21.910 15030-15030 DEBUG pid-15030 A #72 pc 0000000000368780 [anon:dalvik-classes17.dex extracted in memory from /data/app/~~jOCFGdxj5wkTo72tf5GlNw==/com.gingy-7vuK7DAnJ-PXXgw8ow40Pw==/base.apk!classes17.dex] 2023-11-21 17:32:21.910 15030-15030 DEBUG pid-15030 A #77 pc 000000000035e068 [anon:dalvik-classes17.dex extracted in memory from /data/app/~~jOCFGdxj5wkTo72tf5GlNw==/com.gingy-7vuK7DAnJ-PXXgw8ow40Pw==/base.apk!classes17.dex] 2023-11-21 17:32:21.910 15030-15030 DEBUG pid-15030 A #82 pc 0000000000362c58 [anon:dalvik-classes17.dex extracted in memory from /data/app/~~jOCFGdxj5wkTo72tf5GlNw==/com.gingy-7vuK7DAnJ-PXXgw8ow40Pw==/base.apk!classes17.dex] 2023-11-21 17:32:21.910 15030-15030 DEBUG pid-15030 A #87 pc 0000000000362e28 [anon:dalvik-classes17.dex extracted in memory from /data/app/~~jOCFGdxj5wkTo72tf5GlNw==/com.gingy-7vuK7DAnJ-PXXgw8ow40Pw==/base.apk!classes17.dex] 2023-11-21 17:32:21.910 15030-15030 DEBUG pid-15030 A #92 pc 000000000035ddd0 [anon:dalvik-classes17.dex extracted in memory from /data/app/~~jOCFGdxj5wkTo72tf5GlNw==/com.gingy-7vuK7DAnJ-PXXgw8ow40Pw==/base.apk!classes17.dex] 2023-11-21 17:32:21.910 15030-15030 DEBUG pid-15030 A #97 pc 000000000035dd7c [anon:dalvik-classes17.dex extracted in memory from /data/app/~~jOCFGdxj5wkTo72tf5GlNw==/com.gingy-7vuK7DAnJ-PXXgw8ow40Pw==/base.apk!classes17.dex] 2023-11-21 17:32:21.910 15030-15030 DEBUG pid-15030 A #102 pc 0000000000362b50 [anon:dalvik-classes17.dex extracted in memory from /data/app/~~jOCFGdxj5wkTo72tf5GlNw==/com.gingy-7vuK7DAnJ-PXXgw8ow40Pw==/base.apk!classes17.dex] 2023-11-21 17:32:21.911 15030-15030 DEBUG pid-15030 A #117 pc 000000000035dda4 [anon:dalvik-classes17.dex extracted in memory from /data/app/~~jOCFGdxj5wkTo72tf5GlNw==/com.gingy-7vuK7DAnJ-PXXgw8ow40Pw==/base.apk!classes17.dex] 2023-11-21 17:32:21.911 15030-15030 DEBUG pid-15030 A #122 pc 0000000000362ad4 [anon:dalvik-classes17.dex extracted in memory from /data/app/~~jOCFGdxj5wkTo72tf5GlNw==/com.gingy-7vuK7DAnJ-PXXg

rodgomesc commented 6 months ago

can you guys please test if this change solves the issue for you? @yasirlateef @apadev666

apadev666 commented 6 months ago

@rodgomesc do I need to remove node modules and after package json update call yarn install?

after this useCameraPermission and other hooks cant be found

rodgomesc commented 6 months ago

updated my previous post with a step by step

Note: even with typescript complaining about not found react-native this is just a typescript thing, please ignore and run the app

yasirlateef commented 6 months ago

@rodgomesc Unfortunately, it doesn't solve the issue. After about 4 QR scans, the app crashes. I'll attach my logcat output below:

2023-11-21 20:05:58.108 23489-23543 OpenGLRenderer          com.kiosk                 E  Unable to match the desired swap behavior.
2023-11-21 20:05:58.128 23489-23543 OpenGLRenderer          com.kiosk                 E  Unable to match the desired swap behavior.
2023-11-21 20:05:58.186 23489-23543 OpenGLRenderer          com.kiosk                 E  Unable to match the desired swap behavior.
2023-11-21 20:06:00.157 23489-23583 chromium                com.kiosk                 E  [1121/200600.156809:ERROR:variations_seed_loader.cc(69)] Failed to open file for reading. Errno: 2
2023-11-21 20:06:03.221 23489-23571 CameraExte...agerGlobal com.kiosk                 E  Timed out while initializing proxy service!
2023-11-21 20:06:08.024 23489-23505 BufferQueueProducer     com.kiosk                 E  [ImageReader-1280x720f23m2-23489-1](id:5bc100000005,api:4,p:1483,c:23489) queueBuffer: BufferQueue has been abandoned
2023-11-21 20:06:08.042 23489-23505 BufferQueueProducer     com.kiosk                 E  [ImageReader-1280x720f23m2-23489-1](id:5bc100000005,api:4,p:1483,c:23489) dequeueBuffer: BufferQueue has been abandoned
2023-11-21 20:06:08.053 23489-23503 BufferQueueProducer     com.kiosk                 E  [ImageReader-1280x720f23m2-23489-1](id:5bc100000005,api:4,p:1483,c:23489) queueBuffer: BufferQueue has been abandoned
2023-11-21 20:06:12.365 23489-23505 BufferQueueProducer     com.kiosk                 E  [ImageReader-1280x720f23m2-23489-4](id:5bc100000009,api:4,p:1483,c:23489) queueBuffer: BufferQueue has been abandoned
2023-11-21 20:06:12.365 23489-23505 BufferQueueProducer     com.kiosk                 E  [ImageReader-1280x720f23m2-23489-4](id:5bc100000009,api:4,p:1483,c:23489) dequeueBuffer: BufferQueue has been abandoned
2023-11-21 20:06:12.551 23489-23725 libc                    com.kiosk                 A  Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x7a80978193 in tid 23725 (pool-14-thread-), pid 23489 (com.kiosk)
rodgomesc commented 6 months ago

i'll try to find some time today to debug this more closely

apadev666 commented 6 months ago

@rodgomesc Im not able to install( path was not found so all imports are broken ![Uploading Screenshot 2023-11-21 at 20.54.38.png…]()

apadev666 commented 6 months ago

@rodgomesc I have tested many ways I have removed Camera component from bottom sheet, and event after 1000 tries its opening and closing ok I have tried to add Camera componentand when some QR code or barcode is visible its crashing after some attempts, hope this will help you

PS I have tried also with simple View without bottom sheet , but nothing its crashing

rodgomesc commented 6 months ago

that's so weird. devs in this other pr that seems to be related to this same issue said that solved for them https://github.com/mrousavy/react-native-vision-camera/issues/2116

i'll wait for more people testing this, can you reproduce this on the example app @apadev666 ?

apadev666 commented 6 months ago

@rodgomesc maybe it can fix, but the whole problem is that I can't install it, so after install all imports are broken and cant import, so I don't know why

Also I want to understand do I need worklets core? or some frame proccessors? I just need to scan barcodes even QR I don't need

animaonline commented 6 months ago

The logcat is being spammed with this whenever the Camera component is rendered. TF Lite in Google Play services has stable ABI version 1.11.0 which is less than the required version 1.13.0.

animaonline commented 6 months ago

@mrousavy please take a look at this

@apadev666 why?

@mrousavy Wow, that's the best response from a repo owner I've ever seen, (given the fact, that the library is broken) hands down, man.

mrousavy commented 6 months ago

@mrousavy Wow, that's the best response from a repo owner I've ever seen, hands down, man.

I'm sorry, @animaonline did you pay me for my availability and support?

I can't reply to every issue and take a look at every bug you guys find in your apps that make money for you. If you want me to fix a bug for your app, then pay me.

I personally maintain this library in my free time and work on stuff that I personally need for my apps, see for example this cool PR: https://github.com/mrousavy/react-native-vision-camera/pull/2173 which I just recently worked on and published for free for everyone to use. If I don't need something in my apps, I would purely work for you, which I don't do for free.

I don't want this to come across as rude, I'm not trying to be rude here - I'm just saying that I can't find the time for every single issue - if you want something prioritized consider sponsoring me on GitHub, then ping me with the issue and I'll try to find the time as soon as I can. That's how this works.

animaonline commented 6 months ago

@mrousavy wow, just wow man. If you have this kind of attitude, then why do open-source anyway? You're trying not to come off as rude, but you are. I'd rather stay the hell away from a library like this and advice others to follow my example.

mrousavy commented 6 months ago

@mrousavy wow, just wow man. If you have this kind of attitude, then why do open-source anyway? You're trying not to come off as rude, but you are. I'd rather stay the hell away from a library like this and advice others to follow my example.

Lol, ah so you're expecting me to spend multiple hours fixing this bug for your app, entirely for free?

I'd rather stay the hell away from a library like this

Yep please do, thanks mate 👍

apadev666 commented 6 months ago

@animaonline thank you for your response @rodgomesc @mrousavy can you tell me do I need to update ML kit or so?

estiventhneira commented 6 months ago

+1

Hector-Chong commented 6 months ago

Version: 3.6.8

It occurred to me as well. I tried to debug this, and it seems to be a race condition.

The issue is because of the function below. When I change runBlocking to launch(Dispatchers.Main) to make it run on the main thread, it works.

com.mrousavy.camera.core.CameraSession#destroyPreviewOutputSync

    private fun destroyPreviewOutputSync() {
        Log.i(TAG, "Destroying Preview Output...")
        runBlocking {
            Log.d("DEBUG_CAMERA", "difference: 1")
            configure { config ->
                config.preview = CameraConfiguration.Output.Disabled.create()
            }
            Log.d("DEBUG_CAMERA", "difference: 4")
        }
    }
import kotlinx.coroutines.Dispatchers

    private fun destroyPreviewOutputSync() {
        Log.i(TAG, "Destroying Preview Output...")
        launch(Dispatchers.Main) {
            Log.d("DEBUG_CAMERA", "difference: 1")
            configure { config ->
                config.preview = CameraConfiguration.Output.Disabled.create()
            }
            Log.d("DEBUG_CAMERA", "difference: 4")
        }
    }
alexrififi commented 6 months ago

@Hector-Chong fail on build:

Unresolved reference: Dispatchers

Hector-Chong commented 6 months ago

Dispatchers

You should import Dispatchers by yourself.

import kotlinx.coroutines.Dispatchers

alexrififi commented 6 months ago

@Hector-Chong Your fix works! Big thanks! ❤️

WitchMad commented 6 months ago

Still happening here :/ using same version 3.6.8 logcat:

11-24 14:01:52.758  2219  2947 I CreateCaptureSession: Camera 0: Capture Session #1014 configured!
11-24 14:01:52.758  1125  3679 I qomx_image_core: OMX_Init:101] Complete 3
11-24 14:01:52.763  2219  2219 I CameraSession: Successfully configured Session with 2 outputs for Camera #0!
11-24 14:01:52.763  2219  2219 I CameraSession: Successfully updated CameraSession Configuration! isActive: false
11-24 14:01:52.763  2219  2219 D DEBUG_CAMERA: difference: 4
11-24 14:01:52.770  2219  2947 I CreateCaptureSession: Camera 0: Capture Session #1013 closed!
11-24 14:01:52.773  1125  3679 I qomx_image_core: OMX_GetHandle:243] get instance pts is 0xe50c9700
11-24 14:01:52.773  1125  3679 D qomx_image_core: OMX_GetHandle:261] handle = 0xe50c9704 Instanceindex = 0,comp_idx 2 g_ptr 0xe7fc9b30
11-24 14:01:52.773  1125  3679 I mm-still: omx_component_set_callbacks: Bad Parameter 0xe50c9704 0x0 0x0 0x0 0x0
11-24 14:01:52.773  1125  3679 I qomx_image_core: OMX_GetHandle:267] Success
11-24 14:01:52.912  1131  1276 I chatty  : uid=1000(system) HwBinder:1131_1 identical 8 lines
11-24 14:01:52.936 31488 31488 D DeviceStatisticsService: chargerType=2 batteryLevel=37 totalBatteryCapacity=4173800
11-24 14:01:52.936 31488 31488 D DeviceInfoHidlClient: isPowerInfoNeverSent()=true
11-24 14:01:52.937 28305 28411 D CmdCenter: - SquareBase: sPrevBatStatus: 2, status: 2
11-24 14:01:52.937 28305 28411 D CmdCenter: - SquareBase: sPrevBatteryPercent: 37 newPercent: 37
11-24 14:01:52.937 28305 28411 D CmdCenter: - SquareBase: sPrevPlugType: 2 plugType: 2
11-24 14:01:53.363  1131  1276 I chatty  : uid=1000(system) HwBinder:1131_1 identical 26 lines
11-24 14:01:53.394 15890 15922 W TimedProcessReaper: Memory state is: 125
11-24 14:01:53.404 12833 10255 W Nearby  : [MBleClient] Ignore outdated onLost runnable from cycle : 1948, current cycle : 3006 [CONTEXT service_id=49 ]
11-24 14:01:53.446  3002  6659 D IpClient/wlan0: addressUpdated: 2804:14d:5494:82bf:246c:7aff:fedd:2896/64 on wlan0 flags 0x00000100 scope 0
11-24 14:01:53.446  3002  6659 D IpClient/wlan0: addressUpdated: 2804:14d:5494:82bf:49b7:3a65:69ce:4c65/64 on wlan0 flags 0x00000001 scope 0
11-24 14:01:53.487 12833 10255 W Nearby  : [MBleClient] Ignore outdated onLost runnable from cycle : 1949, current cycle : 3006 [CONTEXT service_id=49 ]
11-24 14:01:54.563  1131  1276 I chatty  : uid=1000(system) HwBinder:1131_1 identical 64 lines
11-24 14:01:54.590  1137  1163 I android.hardware.thermal@2.0-service.qti: uevent triggered for sensor: msm_therm
11-24 14:01:54.944  2219  3089 F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x7bdaeee7b0 in tid 3089 (pool-22-thread-), pid 2219
mrousavy commented 6 months ago

Hey all - does https://github.com/mrousavy/react-native-vision-camera/pull/2204 fix your issue?

mrousavy commented 6 months ago

Please change this locally and test it.

alexrififi commented 6 months ago

Hey all - does #2204 fix your issue?

@mrousavy Hello! I tried this patch, but it didn't solve the problem. But this helped