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

Support Hermes engine #2455

Closed
ferrannp opened this issue Jul 12, 2019 · 138 comments
Closed

Support Hermes engine #2455

ferrannp opened this issue Jul 12, 2019 · 138 comments

Comments

@ferrannp
Copy link

ferrannp commented Jul 12, 2019

Goals

Make Hermes engine to work with Realm. Hermes comes from react-native 0.60.2 and significantly improves app performance on Android.

Steps to Reproduce

Following https://facebook.github.io/react-native/docs/hermes. if enableHermes: true, you will get the following:

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: librealmreact.so caused by: dlopen failed: library "libjsc.so" not found
        at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:738)
        at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:591)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:529)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:484)
        at io.realm.react.RealmReactModule.<clinit>(RealmReactModule.java:56)
        at io.realm.react.RealmReactPackage.createNativeModules(RealmReactPackage.java:31)

With enableHermes: false, everything works as expected.

Version of Realm and Tooling

  • Realm JS SDK Version: 2.28.1
  • React Native: 0.60.3
@cbstauss
Copy link

I'm having the same issue. I'm wondering if there is something looking for "libjsc.so" that can't find it because hermes replaces "libjsc.so" with "libhermes.so". I've been looking through the SoLoader documentation and the Realm documentation to see if I can find anything.

@fealebenpae
Copy link
Member

realm-js uses JavaScriptCore APIs directly on React Native to implement its JS API so right now it cannot run on Hermes. We're planning on migrating to the new API in the coming months.

@ferrannp
Copy link
Author

Yeah I was pretty sure this was not an easy change. Glad to hear it is planned to happen @fealebenpae. Thank you!

@paschaldev
Copy link

+1

Spent over 48hours debugging this issue. When I disabled hermes, it started working.

@dominicsavb
Copy link

can't wait to implement realm with hermes...

@matinzd
Copy link

matinzd commented Aug 6, 2019

We got stuck migrating project to hermes :((

@raphaeleidus
Copy link

@fealebenpae firstly, thank you for all the hard work creating this amazing software.
Do you have any rough idea as to when Hermes support might arrive?

I have an app that is stuck in a difficult predicament, the latest JSCore engine has a very high crash rate on certain devices, we can't rollback to earlier RN as it would drop 64bit support, and we can't move to Hermes as we store most of our data in Realm.

We are exploring some dire options at the moment and it would really help us to know if a Realm version might arrive in the next 2 weeks or if we are definitely going to have to wait until October or later.

Again thank you for the hard work. I would love to be able to submit a PR with this functionality, unfortunately this area is totally out of my depth.

@fealebenpae
Copy link
Member

Unfortunately we won’t be able to add support for the new Hermes APIs in the next couple of weeks. Because we need to swap out a large part of our C++ codebase to do that it’s likely it’ll take our team months to pull this off.

@gochsner
Copy link

Would Hermes support help at all with this issue the chrome debugging issue? That's been a thorn in our side. #491

@ferrannp
Copy link
Author

ferrannp commented Aug 16, 2019

@raphaeleidus you do not need to downgrade RN. You can use the latest RN with Realm. Just disable Hermes for now. Realm is fully compatible with RN 64 bits.

@raphaeleidus
Copy link

@ferrannp RN is not my problem it is the JSC in 0.59.10 (not hermes). For 64bit support on android we had to upgrade to 0.59.10 but the JSCore at that version has a high crash rate. I am not running Hermes at all but the people experiencing this issue: facebook/react-native#25494 and trying to resolve or mitigate it have suggested that moving to Hermes would resolve the issue. I cannot move to Hermes though because I am using Realm. This is the problem. Can't move forward to Hermes because of Realm and can't move back to only 32 bit support because of Google. It is a difficult situation and nobody's fault on any side but I and many others are caught in the middle.

@paschaldev
Copy link

I had a similar issue @raphaeleidus. Unrelated, but what solved mine were

  • Unlinking realm and installing the latest stable (2.29.2)
  • Then I disabled hermes in my gradle
  • I re-linked realm
  • I enabled Proguard
  • Then I added this to my proguard rules -keep class io.realm.react.**

After that I stopped getting any issue. I'm using the latest version of React Native (0.60.5). App works fine

@raphaeleidus

This comment has been minimized.

@paschaldev
Copy link

No... Realm with Hermes gives the JSC error whatever... We'll have to wait unfortunately for Realm before we can use Hermes.

@mattijsf
Copy link

@fealebenpae You mentioned that it will take "months to pull this off". Can you tell whether or not this is something that gets attention in the coming months? In other words, is it planned?

We would like to make use of realm-js and disabling Hermes would be acceptable for now but it will be good to know whether or not support for Hermes can be expected.

@cristianoccazinsp
Copy link

Also curious about the roadmap for Hermes. Would it be easier to patch Hermes so it can provide some compatibility to w/e Realm needs?

@bmunkholm
Copy link
Contributor

@mattijsf It is something I expect us to prioritize in Q4 (this year), although we haven't done that planning just yet, but will in the coming weeks.

@cristianoccazinsp
Copy link

cristianoccazinsp commented Aug 22, 2019

Has anyone tested Realm with JS v8 on Android?
https://github.com/Kudo/react-native-v8

Perhaps it's a good alternative.

@raphaeleidus
Copy link

@cristianoccazinsp yeah, I have, it is the same problem. Realm very specifically requires the jscore JS engine and doesn't work with other engines

@cristianoccazinsp
Copy link

Bummer! I was reading about the high crash rate of JSCore on Android and started to look at alternatives, but looks like Realm is a blocker for any JS alternative.

@mattijsf
Copy link

mattijsf commented Aug 22, 2019

@bmunkholm Obviously we hope it gets picked up soon. Thanks for the update 👍

@tatiesmars
Copy link

I suggest using this build script for the moment:

@cristianoccazinsp
Copy link

cristianoccazinsp commented Aug 28, 2019 via email

@HSReact
Copy link

HSReact commented Apr 23, 2021

Cool thanks will check out for sure

@HSReact
Copy link

HSReact commented Apr 23, 2021

Hermes on iOS made the app start ~40% faster than JSC.

https://callstack.com/blog/hermes-performance-on-ios/

@8BallBomBom
Copy link

@belal-mazlom Correct me if i'm wrong but i don't think Realm is based on SQLite.
SQLite is in some respects a nice alternative but not an ideal solution to be honest.

@DaveLomber
Copy link

Realm is NOT based on top of SQLite.

As an alternative - there is https://github.com/Nozbe/WatermelonDB which is based on SQLite AFAIK and supports Hermes

@flikQ
Copy link

flikQ commented Apr 26, 2021

@8BallBomBom we've stripped out Realm as we've not really had a choice for this. I've also had to recommend fellow devs to not use Realm if they want to gain the benefits of Hermes.

what did you pick as an alternative to realm? Just curious as we would need to evaluate as a backup strategy

We just stripped it out and didn't replace, our use case was for it to store template data (paths to images, names etc) that rarely changed in the API to cut down on repeat API calls.

Removing ha ironically improved app performance, altho increased the number of API calls, the trade off has been worth is given the capability of our API.

@HSReact
Copy link

HSReact commented Apr 28, 2021

0749BFEC-E0EC-4D00-85C1-4E8BE4CA74F4

@HSReact
Copy link

HSReact commented Apr 28, 2021

Hermes keeps getting better...

@ghost
Copy link

ghost commented Apr 28, 2021

It is two years still didn't add the support Yay

@flikQ
Copy link

flikQ commented Apr 28, 2021

Their direction is not aligned with 'our' kind of users. I can only suggest you replace or simply strip out Realm as we have.

@tedi
Copy link

tedi commented May 3, 2021

Realm is NOT based on top of SQLite.

As an alternative - there is https://github.com/Nozbe/WatermelonDB which is based on SQLite AFAIK and supports Hermes

This is unfortunately the route that we've had to take. We're having to tear out each call one by one.

@belal-mazlom
Copy link

@8BallBomBom Yes, I was wrong, it's not based on SQLite, my thought built on a wrong old comment!
SQLite is good enough for my use, but in general it will depends on your situation.
My usage to RealmDb was a bit small, like caching some APIs content, and credentials related tokens.

In my position I got three options to switch for:
1 - Wait until Realm team upgrade it to support Hermes.
2 - Use native versions, Realm Objective‑C / Realm Java and create a wrapper for my used calls that I need.
3 - Just remove it and used AsyncStorage or other DB alternatives like WatermelonDB ...

@sintylapse
Copy link

@belal-mazlom so if you have native versions of Realm, you can use Hermes? That sounds like a good solution. What are disadvantages here?

@cristianoccazinsp
Copy link

I guess the native versions would just use a wrapper through the bridge/regular RN modules. The issue with that, is that queries would become slower.

On the other hand, for "simple usage", I think it's a massive win. Queries are now async (due to the bridge), and there's 0 C++ code causing random crashes and messing up other code stack traces. Plus Hermes, of course.

What does the Hermes team think of that alternative? Could that be a temporary option until the C++ code for Hermes is implemented? Like a "Lite" or "Slow" version of Realm that only uses native modules.

@Mooli88
Copy link

Mooli88 commented May 5, 2021

@cristianoccazinsp if you ever gonna create such a wrapper please share it with us, so we could build on top of it 🙏🏼

@cristianoccazinsp
Copy link

I'm not even sure if that would be possible, just following up on @belal-mazlom idea. The Realm team can probably provide some insight whether or not it would be feasible to do it.

@somebody32
Copy link

somebody32 commented May 5, 2021

Queries are now async (due to the bridge)

keeping in mind that this could be a major problem for write transactions and break consistency if not handled on the userland

@sintylapse
Copy link

sintylapse commented May 5, 2021

@ianpward that would be great if someone from Realm team would confirm if this is a workable idea (Use native versions, Realm Objective‑C / Realm Java and create a wrapper for calls). This is at least sounds great for those, who want to migrate from Realm with saving users data

@HSReact
Copy link

HSReact commented May 14, 2021

@ianpward Hello Ian, Could you please give the community an update about the likely rollout of Hermes Support by the Realm-Mongo team. This will help us in planning our UI updates/releases. Many thanks

@ianpward
Copy link

Engineering is still writing the scope of work on what it would take to build the integration. Rest assured we are building Hermes support. Once the scope has been written and approved I will share an estimate with the community. I expect this scoping process to take another couple weeks.

@HSReact
Copy link

HSReact commented May 16, 2021

Thank you Ian, we look forward to hearing from you soon.

@edritech93
Copy link

need support hermes engine

@ianpward
Copy link

Hey All, Product for Realm here - Thank you for you patience. The Javascript team has put together an initial proposal to build Hermes support and we are currently underway with the implementation - we are hoping to deliver this integration before the end of the year. I am going to lock this thread so that my update does not get buried by any subsequent posts so that any new users who come across this issue will be able to see our plan but if we hit any unforeseen snags I will be sure to update here. If you have any questions, comments, or concerns please feel free to reach out to me at [email protected] - thank you for your interest and support in this free and open-source project we are driven by delighting our community of users.

@realm realm locked as too heated and limited conversation to collaborators May 29, 2021
@realm realm unlocked this conversation May 29, 2021
@realm realm locked as resolved and limited conversation to collaborators May 29, 2021
@ianpward
Copy link

You can follow our progress on this issue by following this latest PR here:
#3792

@kneth
Copy link
Contributor

kneth commented Sep 2, 2021

We have released our first version supporting Hermes (only for iOS). Please take a look at #3940.

@sync-by-unito sync-by-unito bot closed this as completed Jan 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.