rodgomesc / vision-camera-face-detector

VisionCamera Frame Processor Plugin to detect faces using MLKit Vision Face Detector
MIT License
89 stars 65 forks source link

Android - App crashes with Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR) #37

Open fleuverouge opened 1 year ago

fleuverouge commented 1 year ago

Greetings,

I'm facing the mentioned issue with:

        frame => {
            'worklet';
            const scannedFaces = scanFaces(frame);
            runOnJS(setFaces)(scannedFaces);
        },
        [setFaces],
    );

The face detection runs nearly 1 minute then the app crashes (the app managed to draw the bounding rects on the screen a few times before crashing).

The app won't crash if:

Here's logcat:

2023-01-06 16:55:07.893 31430-32609 FaceDetectorV2Jni       com.test.cameraapp              V  detectFacesImageByteBuffer.end()
2023-01-06 16:55:07.893 31430-32609 FaceDetectorV2Jni       com.test.cameraapp                V  detectFacesImageByteBufferMultiPlanes.start()
2023-01-06 16:55:07.930 31430-32609 FaceDetectorV2Jni       com.test.cameraapp                V  detectFacesImageByteBuffer.end()
2023-01-06 16:55:08.003 31430-31766 VisionCamera            com.test.cameraapp                I  Setting new Frame Processor...
2023-01-06 16:55:08.003 31430-31766 VisionCamera            com.test.cameraapp                I  Setting new Frame Processor...
2023-01-06 16:55:08.003 31430-31766 FrameProcessorRuntime   com.test.cameraapp                D  Finding view 2427...
2023-01-06 16:55:08.004 31430-31766 unknown:SoftAssertions  com.test.cameraapp                E  Unhandled SoftException
                                                                                                    com.facebook.react.bridge.AssertionException: Expected to run on UI thread!
                                                                                                        at com.facebook.react.bridge.SoftAssertions.assertCondition(SoftAssertions.java:37)
                                                                                                        at com.facebook.react.bridge.UiThreadUtil.assertOnUiThread(UiThreadUtil.java:32)
                                                                                                        at com.facebook.react.uimanager.UIManagerModule.resolveView(UIManagerModule.java:948)
                                                                                                        at com.mrousavy.camera.frameprocessor.FrameProcessorRuntimeManager.findCameraViewById(FrameProcessorRuntimeManager.kt:65)
                                                                                                        at com.facebook.jni.NativeRunnable.run(Native Method)
                                                                                                        at android.os.Handler.handleCallback(Handler.java:883)
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:100)
                                                                                                        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
                                                                                                        at android.os.Looper.loop(Looper.java:237)
                                                                                                        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
                                                                                                        at java.lang.Thread.run(Thread.java:919)
2023-01-06 16:55:08.004 31430-31766 FrameProcessorRuntime   com.test.cameraapp                D  Found view 2427!
2023-01-06 16:55:08.004 31430-31766 VisionCamera            com.test.cameraapp                I  Found CameraView!
2023-01-06 16:55:08.004 31430-31766 VisionCamera            com.test.cameraapp                I  Adapting Shareable value from function (conversion to worklet)...
2023-01-06 16:55:08.005 31430-31766 VisionCamera            com.test.cameraapp                I  Successfully created worklet!
2023-01-06 16:55:08.005 31430-32595 .cameraapp          com.test.cameraapp               W  0xebadde09 skipped times: 0
2023-01-06 16:55:08.006 31430-31779 .cameraapp         com.test.cameraapp                W  0xebadde09 skipped times: 0
2023-01-06 16:55:08.183 31430-32595 .cameraapp          com.test.cameraapp                W  0xebadde09 skipped times: 0
2023-01-06 16:55:08.183 31430-32595 libc                   com.test.cameraapp                A  Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x7b1fa8f9d4 in tid 32595 (pool-50-thread-), pid 31430 (.cameraapp)
2023-01-06 16:55:08.235 31430-31779 .cameraapp          com.test.cameraapp               W  0xebadde09 skipped times: 0

Any gists to solve this problem is welcome.

Regards,