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

🐛 With Hermes on, If the component is updated too many times using the frame processor, the application will crash. #997

Closed
3 of 4 tasks
HyopeR opened this issue Apr 15, 2022 · 9 comments · Fixed by #1466
Labels
🐛 bug Something isn't working

Comments

@HyopeR
Copy link

HyopeR commented Apr 15, 2022

What were you trying to do?

Hello, I was using frame processors for text recognition with camera and barcode reading with camera. I update my components based on the results of the frame processor. I use the runOnJS and useState methods for this. There is no problem in updating the components. But frame processors throw an exception when I continue this process too much.

This only happens when I try to update components with frame processor results. If I don't update the components, no exception is thrown.

PS: #613 I took a look at the thread here. However, I could not see any details for the component update.

This issue causes the app to crash. adb logcat *:E I detected the error.

Versions:

"react": "17.0.2",
"react-native": "0.66.4",
"react-native-reanimated": "^2.5.0",
"react-native-vision-camera": "2.13.2",

Reproduceable Code

import React, {useState} from 'react';
import {StyleSheet, View} from 'react-native';
import {
  Camera,
  useCameraDevices,
  useFrameProcessor,
} from 'react-native-vision-camera';
import {scanOCR} from 'vision-camera-ocr';
import {runOnJS} from 'react-native-reanimated';
import {useIsForeground} from './src/utils/hooks';
import {useIsFocused} from '@react-navigation/native';

const CodeCamera = React.forwardRef(({...props}, ref) => {
  const devices = useCameraDevices('wide-angle-camera');
  const isActive = useIsForeground();
  const isFocused = useIsFocused();

  const device = devices.back;
  const [code, setCode] = useState('');

  const textRecognize = data => {
    const isNotEmpty = data && data?.result?.text !== '';
    isNotEmpty && setCode(data.result.text);
  };

  const frameProcessor = useFrameProcessor(
    frame => {
      'worklet';
      let text = scanOCR(frame);
      runOnJS(textRecognize)(text);
    },
    [textRecognize],
  );
  return (
    <View style={styles.wrapper}>
      {device && isFocused && (
        <Camera
          ref={ref}
          style={styles.camera}
          device={device}
          isActive={isActive}
          frameProcessor={frameProcessor}
          frameProcessorFps={5}
          preset={'vga-640x480'}
          {...props}
        />
      )}
    </View>
  );
});

const styles = StyleSheet.create({
  wrapper: {
    flex: 1,
    position: 'relative',
  },
  camera: {
    flex: 1,
    ...StyleSheet.absoluteFill,
  },
});

What happened instead?

Fatal signal 11 (SIGSEGV), code 1, fault addr 0x770000000b in tid 16954 (pool-18-thread-) crashes with error.

Relevant log output

04-15 19:21:59.538 16763 16954 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x770000000b in tid 16954 (pool-18-thread-)
04-15 19:21:59.728  2559  2559 E audit   : type=1400 audit(1650039719.723:1018): avc:  denied  { search } for  pid=17734 comm="crash_dump64" name="com.google.android.gms" dev="dm-0" ino=204 scontext=u:r:crash_dump:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 SEPF_SM-A520F_8.0.0_0010 audit_filtered
04-15 19:21:59.729  2559  2559 E audit   : type=1300 audit(1650039719.723:1018): arch=c00000b7 syscall=56 success=no exit=-13 a0=ffffff9c a1=734aa30060 a2=0 a3=0 items=0 ppid=1 pid=17734 auid=4294967295 uid=10332 gid=10332 euid=10332 suid=10332 fsuid=10332 egid=10332 sgid=10332 fsgid=10332 tty=(none) ses=4294967295 comm="crash_dump64" exe="/system/bin/crash_dump64" subj=u:r:crash_dump:s0:c512,c768 key=(null)
04-15 19:21:59.729  2559  2559 E audit   : type=1327 audit(1650039719.723:1018): proctitle=63726173685F64756D703634003136393534003137373332
04-15 19:21:59.729  2559  2559 E audit   : type=1400 audit(1650039719.723:1019): avc:  denied  { search } for  pid=17734 comm="crash_dump64" name="com.google.android.gms" dev="dm-0" ino=204 scontext=u:r:crash_dump:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 SEPF_SM-A520F_8.0.0_0010 audit_filtered
04-15 19:21:59.729  2559  2559 E audit   : type=1300 audit(1650039719.723:1019): arch=c00000b7 syscall=56 success=no exit=-13 a0=ffffff9c a1=734aa8a070 a2=0 a3=0 items=0 ppid=1 pid=17734 auid=4294967295 uid=10332 gid=10332 euid=10332 suid=10332 fsuid=10332 egid=10332 sgid=10332 fsgid=10332 tty=(none) ses=4294967295 comm="crash_dump64" exe="/system/bin/crash_dump64" subj=u:r:crash_dump:s0:c512,c768 key=(null)
04-15 19:21:59.729  2559  2559 E audit   : type=1327 audit(1650039719.723:1019): proctitle=63726173685F64756D703634003136393534003137373332
04-15 19:21:59.743  2559  2559 E audit   : type=1400 audit(1650039719.733:1020): avc:  denied  { search } for  pid=17734 comm="crash_dump64" name="com.google.android.gms" dev="dm-0" ino=204 scontext=u:r:crash_dump:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 SEPF_SM-A520F_8.0.0_0010 audit_filtered
04-15 19:21:59.743  2559  2559 E audit   : type=1300 audit(1650039719.733:1020): arch=c00000b7 syscall=56 success=no exit=-13 a0=ffffff9c a1=734aa8a5b0 a2=0 a3=0 items=0 ppid=1 pid=17734 auid=4294967295 uid=10332 gid=10332 euid=10332 suid=10332 fsuid=10332 egid=10332 sgid=10332 fsgid=10332 tty=(none) ses=4294967295 comm="crash_dump64" exe="/system/bin/crash_dump64" subj=u:r:crash_dump:s0:c512,c768 key=(null)
04-15 19:21:59.743  2559  2559 E audit   : type=1327 audit(1650039719.733:1020): proctitle=63726173685F64756D703634003136393534003137373332
04-15 19:21:59.744  2559  2559 E audit   : type=1400 audit(1650039719.733:1021): avc:  denied  { search } for  pid=17734 comm="crash_dump64" name="com.google.android.gms" dev="dm-0" ino=204 scontext=u:r:crash_dump:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 SEPF_SM-A520F_8.0.0_0010 audit_filtered
04-15 19:21:59.744  2559  2559 E audit   : type=1300 audit(1650039719.733:1021): arch=c00000b7 syscall=56 success=no exit=-13 a0=ffffff9c a1=734aa31020 a2=0 a3=0 items=0 ppid=1 pid=17734 auid=4294967295 uid=10332 gid=10332 euid=10332 suid=10332 fsuid=10332 egid=10332 sgid=10332 fsgid=10332 tty=(none) ses=4294967295 comm="crash_dump64" exe="/system/bin/crash_dump64" subj=u:r:crash_dump:s0:c512,c768 key=(null)
04-15 19:21:59.744  2559  2559 E audit   : type=1327 audit(1650039719.733:1021): proctitle=63726173685F64756D703634003136393534003137373332
04-15 19:21:59.807 17734 17734 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***04-15 19:21:59.807 17734 17734 F DEBUG   : Build fingerprint: ''
04-15 19:21:59.807 17734 17734 F DEBUG   : Revision: '8'
04-15 19:21:59.808 17734 17734 F DEBUG   : ABI: 'arm64'
04-15 19:21:59.808 17734 17734 F DEBUG   : pid: 16763, tid: 16954, name: pool-18-thread-  >>> com.exampleapp <<<
04-15 19:21:59.808 17734 17734 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x770000000b
04-15 19:21:59.808 17734 17734 F DEBUG   :     x0   000000770000000b  x1   fffc00000000029a  x2   000000000000029a  x3   000000778b4d79d8
04-15 19:21:59.808 17734 17734 F DEBUG   :     x4   000000778b4d79ea  x5   000000778b3be8fe  x6   0000000000000066  x7   0000000000000075
04-15 19:21:59.808 17734 17734 F DEBUG   :     x8   0000007700000013  x9   000000777c834fe0  x10  4073600000000000  x11  0000000000000600
04-15 19:21:59.808 17734 17734 F DEBUG   :     x12  0000000000000001  x13  000000777c834d18  x14  00000000000007ff  x15  0000000007000000
04-15 19:21:59.808 17734 17734 F DEBUG   :     x16  000000778edb3838  x17  00000077b5c297c0  x18  0000000013305788  x19  000000778f2aaa80
04-15 19:21:59.808 17734 17734 F DEBUG   :     x20  000000778f2af5d8  x21  000000777c834e88  x22  00000077771c4c60  x23  000000778f2aaa80
04-15 19:21:59.808 17734 17734 F DEBUG   :     x24  000000777c834f48  x25  0000000000000000  x26  0000000000000000  x27  000000777c834f30
04-15 19:21:59.809 17734 17734 F DEBUG   :     x28  000000778f2aaa90  x29  000000777c834e00  x30  000000778eb45f3c
04-15 19:21:59.809 17734 17734 F DEBUG   :     sp   000000777c834df0  pc   000000778eb45fa4  pstate 0000000080000000
04-15 19:21:59.890 17734 17734 F DEBUG   :
  04-15 19:21:59.890 17734 17734 F DEBUG   : backtrace:
  04-15 19:21:59.890 17734 17734 F DEBUG   :     #00 pc 0000000000051fa4  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.890 17734 17734 F DEBUG   :     #01 pc 000000000006d640  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.890 17734 17734 F DEBUG   :     #02 pc 000000000007022c  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.890 17734 17734 F DEBUG   :     #03 pc 0000000000028024  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.891 17734 17734 F DEBUG   :     #04 pc 000000000007ea48  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libVisionCamera.so (_ZN8facebook3jsi6Object16setPropertyValueERNS0_7RuntimeERKNS0_6StringERKNS0_5ValueE+56)
04-15 19:21:59.891 17734 17734 F DEBUG   :     #05 pc 000000000007e968  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libVisionCamera.so (_ZN8facebook3jsi6Object11setPropertyIRNS0_5ValueEEEvRNS0_7RuntimeERKNS0_6StringEOT_+120)
04-15 19:21:59.891 17734 17734 F DEBUG   :     #06 pc 0000000000072630  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libVisionCamera.so (_ZN8facebook3jsi6Object11setPropertyIRNS0_5ValueEEEvRNS0_7RuntimeEPKcOT_+104)
04-15 19:21:59.891 17734 17734 F DEBUG   :     #07 pc 000000000006f6d0  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libVisionCamera.so (_ZN6vision16JSIJNIConversion26convertJNIObjectToJSIValueERN8facebook3jsi7RuntimeERKNS1_3jni16basic_strong_refIP8_jobjectNS5_23LocalReferenceAllocatorEEE+2316)
04-15 19:21:59.891 17734 17734 F DEBUG   :     #08 pc 000000000006f354  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libVisionCamera.so (_ZN6vision16JSIJNIConversion26convertJNIObjectToJSIValueERN8facebook3jsi7RuntimeERKNS1_3jni16basic_strong_refIP8_jobjectNS5_23LocalReferenceAllocatorEEE+1424)
04-15 19:21:59.891 17734 17734 F DEBUG   :     #09 pc 000000000006f500  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libVisionCamera.so (_ZN6vision16JSIJNIConversion26convertJNIObjectToJSIValueERN8facebook3jsi7RuntimeERKNS1_3jni16basic_strong_refIP8_jobjectNS5_23LocalReferenceAllocatorEEE+1852)
04-15 19:21:59.891 17734 17734 F DEBUG   :     #10 pc 0000000000092b08  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libVisionCamera.so
04-15 19:21:59.891 17734 17734 F DEBUG   :     #11 pc 0000000000092944  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libVisionCamera.so
04-15 19:21:59.891 17734 17734 F DEBUG   :     #12 pc 0000000000092888  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libVisionCamera.so
04-15 19:21:59.891 17734 17734 F DEBUG   :     #13 pc 00000000000927e8  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libVisionCamera.so
04-15 19:21:59.891 17734 17734 F DEBUG   :     #14 pc 00000000000916e0  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libVisionCamera.so
04-15 19:21:59.891 17734 17734 F DEBUG   :     #15 pc 0000000000031de4  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.891 17734 17734 F DEBUG   :     #16 pc 000000000003a730  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.891 17734 17734 F DEBUG   :     #17 pc 0000000000054d50  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.891 17734 17734 F DEBUG   :     #18 pc 000000000005dd90  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.891 17734 17734 F DEBUG   :     #19 pc 0000000000055f8c  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.891 17734 17734 F DEBUG   :     #20 pc 000000000003aa1c  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.891 17734 17734 F DEBUG   :     #21 pc 000000000002946c  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.891 17734 17734 F DEBUG   :     #22 pc 00000000000e5acc  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libreanimated.so (_ZNK8facebook3jsi8Function4callERNS0_7RuntimeEPKNS0_5ValueEm+104)
04-15 19:21:59.891 17734 17734 F DEBUG   :     #23 pc 0000000000105218  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libreanimated.so
04-15 19:21:59.891 17734 17734 F DEBUG   :     #24 pc 0000000000104fec  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libreanimated.so
04-15 19:21:59.891 17734 17734 F DEBUG   :     #25 pc 0000000000104f30  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libreanimated.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #26 pc 0000000000104e90  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libreanimated.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #27 pc 0000000000103d44  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libreanimated.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #28 pc 0000000000031de4  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #29 pc 000000000003a730  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #30 pc 0000000000054d50  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #31 pc 000000000005dd90  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #32 pc 0000000000055f8c  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #33 pc 000000000003aa1c  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #34 pc 000000000002946c  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #35 pc 00000000000e5acc  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libreanimated.so (_ZNK8facebook3jsi8Function4callERNS0_7RuntimeEPKNS0_5ValueEm+104)
04-15 19:21:59.892 17734 17734 F DEBUG   :     #36 pc 0000000000105218  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libreanimated.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #37 pc 0000000000104fec  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libreanimated.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #38 pc 0000000000104f30  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libreanimated.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #39 pc 0000000000104e90  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libreanimated.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #40 pc 0000000000103d44  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libreanimated.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #41 pc 0000000000031de4  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #42 pc 000000000003a730  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #43 pc 0000000000054d50  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #44 pc 000000000005dd90  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #45 pc 0000000000055f8c  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #46 pc 000000000003aa1c  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #47 pc 000000000002946c  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.892 17734 17734 F DEBUG   :     #48 pc 00000000000f5c7c  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libreanimated.so (_ZNK8facebook3jsi8Function12callWithThisERNS0_7RuntimeERKNS0_6ObjectEPKNS0_5ValueEm+120)
04-15 19:21:59.893 17734 17734 F DEBUG   :     #49 pc 0000000000105174  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libreanimated.so
04-15 19:21:59.893 17734 17734 F DEBUG   :     #50 pc 0000000000104fec  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libreanimated.so
04-15 19:21:59.893 17734 17734 F DEBUG   :     #51 pc 0000000000104f30  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libreanimated.so
04-15 19:21:59.893 17734 17734 F DEBUG   :     #52 pc 0000000000104e90  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libreanimated.so
04-15 19:21:59.893 17734 17734 F DEBUG   :     #53 pc 0000000000103d44  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libreanimated.so
04-15 19:21:59.893 17734 17734 F DEBUG   :     #54 pc 0000000000031de4  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.893 17734 17734 F DEBUG   :     #55 pc 000000000003a730  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.893 17734 17734 F DEBUG   :     #56 pc 000000000002946c  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libhermes.so
04-15 19:21:59.893 17734 17734 F DEBUG   :     #57 pc 00000000000a178c  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libVisionCamera.so (_ZNK8facebook3jsi8Function12callWithThisERNS0_7RuntimeERKNS0_6ObjectEPKNS0_5ValueEm+120)
04-15 19:21:59.893 17734 17734 F DEBUG   :     #58 pc 00000000000a16bc  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libVisionCamera.so (_ZNK8facebook3jsi8Function12callWithThisERNS0_7RuntimeERKNS0_6ObjectESt16initializer_listINS0_5ValueEE+128)
04-15 19:21:59.893 17734 17734 F DEBUG   :     #59 pc 00000000000a0588  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libVisionCamera.so (_ZNK8facebook3jsi8Function12callWithThisIJNS0_6ObjectEEEENS0_5ValueERNS0_7RuntimeERKS3_DpOT_+160)
04-15 19:21:59.893 17734 17734 F DEBUG   :     #60 pc 000000000008d5a8  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libVisionCamera.so
04-15 19:21:59.893 17734 17734 F DEBUG   :     #61 pc 000000000008d4b8  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libVisionCamera.so
04-15 19:21:59.893 17734 17734 F DEBUG   :     #62 pc 000000000008d434  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libVisionCamera.so
04-15 19:21:59.893 17734 17734 F DEBUG   :     #63 pc 000000000008d3e8  /data/app/com.exampleapp-0C7mb4r_hGjGCvxf4RcJ-A==/lib/arm64/libVisionCamera.so
04-15 19:22:04.248  2559  2559 E audit   : type=1400 audit(1650039724.243:1022): avc:  denied  { search } for  pid=17734 comm="crash_dump64" name="com.google.android.gms" dev="dm-0" ino=204 scontext=u:r:crash_dump:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 SEPF_SM-A520F_8.0.0_0010 audit_filtered
04-15 19:22:04.248  2559  2559 E audit   : type=1300 audit(1650039724.243:1022): arch=c00000b7 syscall=56 success=no exit=-13 a0=ffffff9c a1=734aa30060 a2=0 a3=0 items=0 ppid=1 pid=17734 auid=4294967295 uid=10332 gid=10332 euid=10332 suid=10332 fsuid=10332 egid=10332 sgid=10332 fsgid=10332 tty=(none) ses=4294967295 comm="crash_dump64" exe="/system/bin/crash_dump64" subj=u:r:crash_dump:s0:c512,c768 key=(null)
04-15 19:22:04.248  2559  2559 E audit   : type=1327 audit(1650039724.243:1022): proctitle=63726173685F64756D703634003136393534003137373332
04-15 19:22:04.288  2580 16952 E ExynosCamera3: [CAM_ID(0)][]-[m_monitorThreadFunc] (8069) (0)
04-15 19:22:04.288  2580 16952 E ExynosCamera3: [CAM_ID(0)][]-[m_monitorThreadFunc] (8071) ERROR_DQ_BLOCKED) ; ERROR_DQ_BLOCKED_COUNT =20
04-15 19:22:04.488  2605  2605 E /system/bin/tombstoned: Tombstone written to: /data/tombstones//tombstone_06
04-15 19:22:04.497  2580 16933 E Camera3-OutputStream: getBufferLockedCommon: Stream 1: Can't dequeue next output buffer: Connection timed out (-110)
04-15 19:22:04.497  2580 16933 E Camera3-Device: RequestThread: Can't get output buffer, skipping request: Connection timed out (-110)
04-15 19:22:04.498  2559  2559 E audit   : type=1701 audit(1650039724.493:1023): auid=4294967295 uid=10332 gid=10332 ses=4294967295 subj=u:r:untrusted_app:s0:c512,c768 pid=16954 comm="pool-18-thread-" exe="/system/bin/app_process64" sig=11

Device

Android 8, Android 10

VisionCamera Version

2.13.2

Additional information

@HyopeR HyopeR added the 🐛 bug Something isn't working label Apr 15, 2022
@HyopeR
Copy link
Author

HyopeR commented Apr 15, 2022

Also, when a component is updated with frame processors, the following error is constantly printed in the console. This error is not printed when the component is not updated.

PS: I think they are related to each other. That's why I stated that too.
PS2: I think this error is caused by the following pull request that came with the 2.13.1 update; #928

04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions: Unhandled SoftException
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions: com.facebook.react.bridge.AssertionException: Expected to run on UI thread!
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at com.facebook.react.bridge.SoftAssertions.assertCondition(SoftAssertions.java:37)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at com.facebook.react.bridge.UiThreadUtil.assertOnUiThread(UiThreadUtil.java:26)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at com.facebook.react.uimanager.UIManagerModule.resolveView(UIManagerModule.java:960)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at com.mrousavy.camera.frameprocessor.FrameProcessorRuntimeManager.findCameraViewById(FrameProcessorRuntimeManager.kt:65)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at android.os.Handler.handleCallback(Handler.java:789)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at android.os.Handler.dispatchMessage(Handler.java:98)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at android.os.Looper.loop(Looper.java:164)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at java.lang.Thread.run(Thread.java:764)

@HyopeR
Copy link
Author

HyopeR commented Apr 16, 2022

After further research I had a look at this software-mansion/react-native-reanimated#3011 problem. I discovered that the problem might be on the react-native-reanimated side. I updated my project's dependencies.

Versions

"react": "17.0.2",
"react-native": "^0.68.1",
"react-native-reanimated": "2.7.0",
"react-native-vision-camera": "^2.13.2",

But it didn't help me to get rid of this recurring error in log with all these updates. com.facebook.react.uimanager.UIManagerModule.resolveView(UIManagerModule.java:960)

04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions: Unhandled SoftException
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions: com.facebook.react.bridge.AssertionException: Expected to run on UI thread!
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at com.facebook.react.bridge.SoftAssertions.assertCondition(SoftAssertions.java:37)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at com.facebook.react.bridge.UiThreadUtil.assertOnUiThread(UiThreadUtil.java:26)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at com.facebook.react.uimanager.UIManagerModule.resolveView(UIManagerModule.java:960)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at com.mrousavy.camera.frameprocessor.FrameProcessorRuntimeManager.findCameraViewById(FrameProcessorRuntimeManager.kt:65)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at android.os.Handler.handleCallback(Handler.java:789)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at android.os.Handler.dispatchMessage(Handler.java:98)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at android.os.Looper.loop(Looper.java:164)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
04-15 19:32:55.497 18815 19469 E unknown:SoftAssertions:        at java.lang.Thread.run(Thread.java:764)

@HyopeR
Copy link
Author

HyopeR commented Apr 16, 2022

If anyone has the same problem as me, they can do this as a workaround . I don't get any errors after these adjustments. And the application works successfully without crashing.

1- If hermes is active, turn it off. android/app/build.gradle hermes disable.
2- Downgraded the vision-camera version. "react-native-vision-camera": "2.13.0".

Versions:

"react": "17.0.2",
"react-native": "^0.66.4",
"react-native-reanimated": "2.5.0",
"react-native-vision-camera": "^2.13.0",

@HyopeR HyopeR changed the title 🐛 If the component is updated too many times using the frame processor, the application will crash. 🐛 With Hermes on, If the component is updated too many times using the frame processor, the application will crash. Apr 17, 2022
@HyopeR
Copy link
Author

HyopeR commented Apr 18, 2022

#350 It could be an extension of the topic discussed here. However, the current version of the react-native-reanimated package does not prevent crashes.

@mrousavy
Copy link
Owner

Looks like #928 is related. I'll try to find a fix when migrating VisionCamera to Fabric.

@HyopeR
Copy link
Author

HyopeR commented Apr 19, 2022

I don't think the crashing issue is caused by version 2.13.1. Because I tried many times using react-native-vision-camera version 2.13.0 and react-native-reanimated 2.3.0-beta.2, 2.3.0, 2.5.0 and 2.7.0. However, in all my attempts, when I tried to update the component using the frame processor, the application crashed. If Hermes is turned off, there is no problem. Do you think it will be possible to update components using the frame processor with Hermes turned on in future versions?

@tcank
Copy link

tcank commented May 9, 2022

Hi everyone. We have the same issue, with hermes enabled and using:

"react-native-vision-camera": "2.13.1",
"react-native-reanimated": "2.7.0",

Is not an option to us to disable hermes. We only have registries of the issue occurring on Android platforms. I attach some callstacks of users that ends with the SIGSEGV segfault. You can watch that the callstack in this cases are always different. The most of they have a call to vision::VisionCameraScheduler::triggerUI but also we found a case without it and it is the one with a call to vision::JSIJNIConversion::convertJNIObjectToJSIValue. Maybe, this one is a different issue.

If we can provide more info about our app setup or the error itself, let me know. We are available for any specific debug or test to collect more info and get some fix.

Thanks!

Case 1 Case 2 Case 3 Case 4
image image image image

@quangphuctq2000
Copy link

I think the reason is camera is capturing frame by real time, too many useFrameProcessor callback => crash. Perhaps open camera only we need to reduce crash times 🤔

@mrousavy
Copy link
Owner

Hey! I've rewritten the entire Android codebase of VisionCamera from CameraX to Camera2 in the efforts of ✨ VisionCamera V3.

I just now completed the Camera2 rewrite and I believe the core structure is running, but there might be some edge cases to iron out. Can you try and test the PR #1674 for me to see if you can still reproduce this issue here?

Here's an instruction on how you can test that: #1674 (comment)

If the issue cannot be reproduced with that version/PR anymore, then hoorayy, I fixed it! 🎉
Otherwise please let me know and I'll keep this issue open to keep track of it.

Thank you!

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

Successfully merging a pull request may close this issue.

4 participants