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
Comments
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. 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 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. 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. Versions: "react": "17.0.2", "react-native": "^0.66.4", "react-native-reanimated": "2.5.0", "react-native-vision-camera": "^2.13.0", |
#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? |
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: #1674 (comment) If the issue cannot be reproduced with that version/PR anymore, then hoorayy, I fixed 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: #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
The text was updated successfully, but these errors were encountered: