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

[ios] Crash after reloading app when using with other jsi libs #190

Open
ronickg opened this issue Sep 19, 2023 · 13 comments
Open

[ios] Crash after reloading app when using with other jsi libs #190

ronickg opened this issue Sep 19, 2023 · 13 comments

Comments

@ronickg
Copy link

ronickg commented Sep 19, 2023

I've noticed a problem when using react-native-quick-crypto with other libraries that also use jsi and the TypeArray class in c++. It only seems to be a problem on ios. Launching the app works fine, but once you refresh it instanlty crashes. One also has to call some function which is provied by the react-native-quick-crypto library. The libray works fine on its own without crashes. But as soon as I add something like react-native-blob-jsi-helper or rreact-native-random-values-jsi-helper it will cause the crashing. One doesnt have to add any function from the other libraries, just add them as a package. I've provided a repo to make it easy to reproduce. (https://github.com/BubbleTrouble14/crash). To test just add or remove the "react-native-random-values-jsi-helper" package.

error.log

@grenos
Copy link

grenos commented Oct 19, 2023

We're seeing the same issue. Here is the log if it could help.
mglqc.txt

@kyunkakata
Copy link

Same issue. What should we do?

@ronickg
Copy link
Author

ronickg commented Oct 20, 2023

It only crashes in development so, i just used android instead for most of the time, or just disabled the other lib causing it to crash and filled it with dummy data for the time being.

@kyunkakata
Copy link

kyunkakata commented Oct 20, 2023

My application suffers crashes from Production build if import this library. Can you show me how to fix it?
I am using React Native version 0.66.5 without enable Hermes. @BubbleTrouble14

@kyunkakata
Copy link

On Android, everything is normal.

@kyunkakata
Copy link

We are using many libs using JSI like react-native-mmkv, react-native-keys, react-native-random-values-jsi-helper, ...etc. So I cannot disable other libs.

@ronickg
Copy link
Author

ronickg commented Oct 20, 2023

I see :/ I already asked in the discord,he said he may know a way to fix it. But think he's been very bust with the vision camera.

@arneson
Copy link

arneson commented Sep 18, 2024

Hi!
Did any of you guys manage to get this working with other jsis? @BubbleTrouble14

@ronickg
Copy link
Author

ronickg commented Sep 18, 2024

@arneson I actually don't remember sadly, but soon react-native-quick-crypto will be using nitrolmodules as far as I know, which will probably fix the problem.

@Rag0n
Copy link

Rag0n commented Oct 18, 2024

Hey @boorad, since you're the most active maintainer, do you have any plans to fix this crash? Looks like a blocker for using RNQC.

@boorad
Copy link
Collaborator

boorad commented Oct 18, 2024

If you can boil it down to a version that used to work, some ideas as to why it doesn't now (in the code), and some failing tests that pinpoint the issue, I may be able to take a look. I have lost the time to do exploratory fixes nowadays, and I'd rather concentrate on getting the entire library over to Nitro Modules.

@sriharsha-y
Copy link

I was thinking, what I was asking here https://github.com/margelo/react-native-quick-crypto/issues might also be related in some way to this issue ?

@boorad
Copy link
Collaborator

boorad commented Dec 6, 2024

I saw this in the wild, and created a "fix" for it in #540. The problem with the fix is that it doesn't properly clean up the props. So if you're going to reuse the HostObject a lot, there may be crashes when you try to access the old entries from a new Runtime.

The problem may be that the JSI Runtime has been destroyed, but the HostObject still has references to its JSI Values / memory. The permanent solution is to move to Nitro and 1.0+ versions of this library. Nitro puts a "smart" pointer on JSI Values to safely store them longer. I don't think it makes sense to backport that bit of code to this version. I'd rather press forward and get 1.0 out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants