-
Notifications
You must be signed in to change notification settings - Fork 39
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
SIGSEGV Error on production/compiled app when using Worklets.createContext
#173
Comments
can you pls attach adb logcat logs? |
@rodgomesc sure, here is a full logcat:
I don't think this crash is related to my package because with my context trick it works really fine. Another thing: This error only happens when using And yes, I already added |
@rodgomesc, Hi, Is there any hope that this issue will be resolved?) Thanks |
@nonam4 Please add a test to the unit tests in React-native-worklets-core and submit a PR that shows the error. This makes it a lot more easy for us to fix the issue - I know it takes some time for you to make these tests, but then we'll share the workload, the error can be fixed faster, and we'll all be happy 🥳 |
Exactly as Christian said - please add a reproduction to the example app here. We already have a test that runs a function in a context, which itself calls another function in another context - so this should be the same as a |
So it works fine when Reanimated is installed? Maybe Reanimated's babel plugin does some optimizations that we can't handle? |
yes, worklets-core and vision-camera works fine with Reanimated on default context. On a created context it crash. This crash happens on Android and IOS only on production/compiled app (in dev mode it works fine). |
Worklets.createContext
It fails on dev mode for me on iOS as well. On the iOS it seems to process few frames initially, and then it simply stops calling to the frame processor itself. It is as if the frame processor worklet was cleared by some other process. I am afraid that test would pass since it is just one call. The underlying issue seems to be occurring after several continuous calls. |
Again, please create a reproduction here in the Worklets repo. Then we can take a look. |
I'm trying to reproduce this issue on tests without success. Maybe this issue only happens with vision-camera installed. I'll keep testing here. |
I believe the example app for the tests do not have a dependency on reanimated. Hence it will always pass. |
I think my test is very close to what VC's
But it's not crashing. I also installed |
After playing around with the VC on android and iOS, here is the behaviors I noticed. Using a similar code mentioned on the reproducible code section in OP.
After looking at VC code, I noticed that the "VisionCamera" context is created on module load...there is a difference in iOS and Android. iOS _workletContext This would imply that this context is not source mapped in babel since it lives outside of Javascript. I am assuming there is some sort of optimization within react-native-worklets-core or reanimated, that is cleaning up the mappings/contexts which breaks the "VisionCamera" context. To further investigate, I tried I was able to resolve all issues by doing The main issue lies in how vision camera is integrating with worklets outside of Javascript. So writing tests for this repo will be pointless unless VC is integrated in the example. This test probably should live in VC repo instead. Unfortunately I do not have anymore time to spare to attempt a fix, I am working full-time. I am using RNVC for a production app that I am rewriting from kotlin to react native for multiplatform capability (@mrousavy and team thank you for these awesome libraries, was able to complete a 1 month deadline in 1 week). For my use case I can slide with using Potential fixes:
|
@nmajumder12 on my face-detector package I solved this problem casting frame to About crashing, yes, using This makes me think (@mrousavy can you please answer me this?): Why do we neet to create a new separeted context when default context seems to work (even on a low-end device) without any issues and without fps drop? |
It is better to stay away from |
@mrousavy Does these solutions I mentioned here make sense? I believe the issue is that the worklets nested inside the Potential fixes:
|
I'm not sure if I follow, babel only transpiles functions that are marked with the |
@mrousavy @hannojg Wouldn't this cause issues if invoked multiple times with the same string name. In turn maybe some deduplication mechanism needs to be added. Also is there a clean up? If not, it might also cause memory problems.
E.g.
|
This problem is related to this issue.
If I try to use
runAsync
method (wich usesWorklets.createContext
method) my app crash while running compiled apk or running it in expo production mode (npx expo run:android -d --variant release
).In dev mode the app don't crash and everything works really fine.
With any version before
1.0.0-beta.3
(and also after a lot of tests) I came to the conclusion that the app don't crash and everything works fine (this was also my workaround to get my vision-camera's face-detector plugin working) if I create my context this way:But after
1.0.0-beta.3
I can't do this workaround anymore as now we must callcreateRunAsync
from a created context and this makes the app crash.I'm currently using worklets core
1.1.1
version with vision camera4.0.1
and this problem is still happening.Here's a very simple reproducible code:
Thanks for any help.
The text was updated successfully, but these errors were encountered: