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

Open
ferrannp opened this issue Jul 12, 2019 · 56 comments

Comments

@ferrannp
Copy link

@ferrannp 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

This comment has been minimized.

Copy link

@cbstauss cbstauss commented Jul 17, 2019

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

This comment has been minimized.

Copy link
Contributor

@fealebenpae fealebenpae commented Jul 17, 2019

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

This comment has been minimized.

Copy link
Author

@ferrannp ferrannp commented Jul 18, 2019

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

@paschaldev

This comment has been minimized.

Copy link

@paschaldev paschaldev commented Jul 21, 2019

+1

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

@dominicsavb

This comment has been minimized.

Copy link

@dominicsavb dominicsavb commented Jul 30, 2019

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

@matinzd

This comment has been minimized.

Copy link

@matinzd matinzd commented Aug 6, 2019

We got stuck migrating project to hermes :((

@raphaeleidus

This comment has been minimized.

Copy link

@raphaeleidus raphaeleidus commented Aug 16, 2019

@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

This comment has been minimized.

Copy link
Contributor

@fealebenpae fealebenpae commented Aug 16, 2019

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

This comment has been minimized.

Copy link

@gochsner gochsner commented Aug 16, 2019

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

@ferrannp

This comment has been minimized.

Copy link
Author

@ferrannp 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

This comment has been minimized.

Copy link

@raphaeleidus raphaeleidus commented Aug 16, 2019

@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

This comment has been minimized.

Copy link

@paschaldev paschaldev commented Aug 16, 2019

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 was marked as resolved.

Copy link

@raphaeleidus raphaeleidus commented Aug 16, 2019

@paschaldev were you able to reenable hermes after that?

@paschaldev

This comment has been minimized.

Copy link

@paschaldev paschaldev commented Aug 16, 2019

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

@mattijsf

This comment has been minimized.

Copy link

@mattijsf mattijsf commented Aug 19, 2019

@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

This comment has been minimized.

Copy link

@cristianoccazinsp cristianoccazinsp commented Aug 22, 2019

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

This comment has been minimized.

Copy link
Contributor

@bmunkholm bmunkholm commented Aug 22, 2019

@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

This comment has been minimized.

Copy link

@cristianoccazinsp 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

This comment has been minimized.

Copy link

@raphaeleidus raphaeleidus commented Aug 22, 2019

@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

This comment has been minimized.

Copy link

@cristianoccazinsp cristianoccazinsp commented Aug 22, 2019

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

This comment has been minimized.

Copy link

@mattijsf mattijsf commented Aug 22, 2019

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

@tatiesmars

This comment has been minimized.

Copy link

@tatiesmars tatiesmars commented Aug 28, 2019

I suggest using this build script for the moment:

@cristianoccazinsp

This comment has been minimized.

Copy link

@cristianoccazinsp cristianoccazinsp commented Aug 28, 2019

@ceyhun-akyol

This comment has been minimized.

Copy link

@ceyhun-akyol ceyhun-akyol commented Sep 20, 2019

+1

@mzobe

This comment has been minimized.

Copy link

@mzobe mzobe commented Sep 20, 2019

My work around to work with Hermes and Realm was to implement a native module to use a JAVA version for Realm in Android.

@sfmedion

This comment has been minimized.

Copy link

@sfmedion sfmedion commented Sep 20, 2019

My work around to work with Hermes and Realm was to implement a native module to use a JAVA version for Realm in Android.

Would you care to share this implementation?

@otuchatindonesia

This comment has been minimized.

Copy link

@otuchatindonesia otuchatindonesia commented Sep 23, 2019

+1 please do it !, i waiting, and i hope can boost perform react native well

@weslley39

This comment has been minimized.

Copy link

@weslley39 weslley39 commented Sep 27, 2019

+1 please do it !

@tatiesmars

This comment has been minimized.

Copy link

@tatiesmars tatiesmars commented Sep 30, 2019

@tatiesmars Were you able to use that? I'm curious since RN 59 already uses an updated JSC and it contained crashes fixed only by using Hermes or react-native-v8, which is what we cannot do at the moment when using Realm.

@The0racle So far our app is using this version of JSC on android with RN 60 and realm, work like good for us.

@cristianoccazinsp

This comment has been minimized.

Copy link

@cristianoccazinsp cristianoccazinsp commented Sep 30, 2019

@tatiesmars Were you able to use that? I'm curious since RN 59 already uses an updated JSC and it contained crashes fixed only by using Hermes or react-native-v8, which is what we cannot do at the moment when using Realm.

@The0racle So far our app is using this version of JSC on android with RN 60 and realm, work like good for us.

Is there any real advantage of using that version of JSC over RN's one? There also seems to be a few "big" issues still open (react-native-community/jsc-android-buildscripts#84 and react-native-community/jsc-android-buildscripts#82) which I wonder if they would actually make things worse.

Update: Correct me if I'm wrong, but RN >= 59 already uses the latest JSC for Android.

@RenanSanguinete

This comment has been minimized.

Copy link

@RenanSanguinete RenanSanguinete commented Sep 30, 2019

@tatiesmars Were you able to use that? I'm curious since RN 59 already uses an updated JSC and it contained crashes fixed only by using Hermes or react-native-v8, which is what we cannot do at the moment when using Realm.

@The0racle So far our app is using this version of JSC on android with RN 60 and realm, work like good for us.

The app build with this version works, but it also crashes on several devices. That's the bigger issue here. Add to that Hermes or V8 improves the apps performance as well.

@The0racle

This comment has been minimized.

Copy link

@The0racle The0racle commented Sep 30, 2019

My work around to work with Hermes and Realm was to implement a native module to use a JAVA version for Realm in Android.

Could you share what you did?

@ParhamZare

This comment has been minimized.

Copy link

@ParhamZare ParhamZare commented Oct 2, 2019

+1

3 similar comments
@dominicsavb

This comment has been minimized.

Copy link

@dominicsavb dominicsavb commented Oct 3, 2019

+1

@seydaTaskin

This comment has been minimized.

Copy link

@seydaTaskin seydaTaskin commented Oct 9, 2019

+1

@chmiiller

This comment has been minimized.

Copy link

@chmiiller chmiiller commented Oct 10, 2019

+1

@ItsNoHax

This comment has been minimized.

Copy link

@ItsNoHax ItsNoHax commented Oct 15, 2019

@ferrannp Maybe you could update the issue to support other JS engines. I specifically am looking into implementing react-native-v8 instead of Hermes as we prioritize performance/memory usage over start up speed.

@RenanSanguinete

This comment has been minimized.

Copy link

@RenanSanguinete RenanSanguinete commented Oct 21, 2019

So @kneth you guys a working on it?

@Rob-Dre

This comment has been minimized.

Copy link

@Rob-Dre Rob-Dre commented Oct 25, 2019

@fealebenpae could you maybe publish some rough timeline? Will it take another couple of month?

My project is stuck until this is fixed. :(

@bmunkholm

This comment has been minimized.

Copy link
Contributor

@bmunkholm bmunkholm commented Oct 25, 2019

@RenanSanguinete @Rob-Dre We haven't started on this yet. Until we do it's hard to share a timeline. We hope to identify resources during this year.

@sergii-invoicesimple

This comment has been minimized.

Copy link

@sergii-invoicesimple sergii-invoicesimple commented Oct 29, 2019

+1

1 similar comment
@wslcsok

This comment has been minimized.

Copy link

@wslcsok wslcsok commented Nov 1, 2019

+1

@bmunkholm

This comment has been minimized.

Copy link
Contributor

@bmunkholm bmunkholm commented Nov 1, 2019

Here, and in general, please add your +1 at the top description. This helps show a summary of how popular an issue is, whereas a comment sends a lot of notifications to many people :-)

@luisneto98

This comment has been minimized.

Copy link

@luisneto98 luisneto98 commented Nov 9, 2019

+1

@afeichuanqi

This comment has been minimized.

Copy link

@afeichuanqi afeichuanqi commented Nov 12, 2019

+1111111111111

@aniciom aniciom referenced this issue Nov 17, 2019
@eugenepla

This comment has been minimized.

Copy link

@eugenepla eugenepla commented Nov 18, 2019

++++ 1

@sampsonjoliver

This comment has been minimized.

Copy link

@sampsonjoliver sampsonjoliver commented Nov 18, 2019

Seriously folks, this is how you get issues closed, so people with meaningful contributions can't speak. Just stop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.