Closed HyopeR closed 1 year ago
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; https://github.com/mrousavy/react-native-vision-camera/pull/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)
After further research I had a look at this https://github.com/software-mansion/react-native-reanimated/issues/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)
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",
https://github.com/mrousavy/react-native-vision-camera/issues/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.
Looks like #928 is related. I'll try to find a fix when migrating VisionCamera to Fabric.
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?
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 |
---|---|---|---|
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 🤔
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: https://github.com/mrousavy/react-native-vision-camera/pull/1674#issuecomment-1684104217
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!
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: https://github.com/mrousavy/react-native-vision-camera/issues/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:
Reproduceable Code
What happened instead?
Fatal signal 11 (SIGSEGV), code 1, fault addr 0x770000000b in tid 16954 (pool-18-thread-) crashes with error.
Relevant log output
Device
Android 8, Android 10
VisionCamera Version
2.13.2
Additional information