realm-js icon indicating copy to clipboard operation
realm-js copied to clipboard

Feedback on Hermes support

Open kneth opened this issue 2 years ago • 89 comments

We are working hard on getting Hermes supported by Realm JavaScript, and we are releasing a series of pre-releases to test our progress.

We encourage you to try out the pre-release in your development environment (don't use it in production yet). Create a new issue with your observations, including details about iOS version, other JavaScript libraries. Please use the Hermes issue template.

We appreciate your feedback, but we cannot guarantee if and when we respond to your comment.

Current state

  • Version: v11.0.0-rc.1 (or v11.0.0-rc.0 if you're using a React Native version between 0.66.0 and 0.68.2)
  • Both iOS and Android are supported
  • Required React Native version is 0.69.0 or above 👈 this is very important, since JSI is not ABI stable and your app will simply crash if the version isn't correct. Use v11.0.0-rc.0 for older versions of React Native).
  • 0 of 276 tests are failing

Installation

We are keeping the pre-releases under the tag hermes, and you can install the latest pre-release using the following command:

npm install realm@hermes

For a more comprehensive list of TODOs, please see our PR and the source code for TODO comments.

kneth avatar Sep 02 '21 08:09 kneth

Great news thank you!!

HSReact avatar Sep 02 '21 09:09 HSReact

Wonderful news but as most of my development is mainly focused on Android... the waiting game continues. Will jump in to test once that arrives 👍🏻

8BallBomBom avatar Sep 02 '21 09:09 8BallBomBom

I'm also more interested on the Android side as non-hermes for iOS is quite fast and stable, but Android is the one that's slow and buggy. However, great progress, I will be giving it a try as well on my free time.

What is the roadmap for Android? Does it need an entire new implementation as well, or is it the same code base with some tweaks?

cristianoccazinsp avatar Sep 02 '21 13:09 cristianoccazinsp

What is the roadmap for Android? Does it need an entire new implementation as well, or is it the same code base with some tweaks?

We fully understand the need to get this out on Android ASAP too and we're full-throttling into that now 🚀 The only reason we're pre-releasing for iOS and not Android at this moment is because we've hit less road-blocks in our implementation on iOS.

To be more detailed: We have a couple of outstanding issues in the way we bootstrap the module and the ability to catch exceptions natively on Android that we have to solve for a release to be usable. The good news is that majority of the code is shared between iOS and Android and we mainly need to solve issues in code and build-scripts for the part that bootstraps our .so library on Android.

kraenhansen avatar Sep 02 '21 13:09 kraenhansen

Great news, thank you for all your hard work. We will be testing this in our next dev cycle and report back.

tedi avatar Sep 02 '21 16:09 tedi

Great news!!!

moonpang avatar Sep 03 '21 01:09 moonpang

I created a new application and installed it but it doesn't open the application, some Flipper log

Screen Shot 2021-09-04 at 01 29 55

Screen Shot 2021-09-04 at 01 29 32

Screen Shot 2021-09-04 at 01 18 07

Screen Shot 2021-09-04 at 01 12 29

Process: realmHermes [16230] Path: /Users/USER/Library/Developer/CoreSimulator/Devices/A0FFE31C-C19D-4CAC-917B-010B6CE3F4A2/data/Containers/Bundle/Application/732FAEC5-5CE9-4101-B41A-59C0DC19BF48/realmHermes.app/realmHermes Identifier: realmHermes Version: 1.0 (1) Code Type: X86-64 (Native) Parent Process: launchd_sim [11811] Responsible: SimulatorTrampoline [7116] User ID: 501

Date/Time: 2021-09-04 01:10:10.191 -0300 OS Version: macOS 11.5.2 (20G95) Report Version: 12 Anonymous UUID: 1E47EC22-9B28-370B-4B8C-FC36E91171B3

Time Awake Since Boot: 5600 seconds

System Integrity Protection: disabled

Crashed Thread: 12 com.facebook.react.JavaScript

Exception Type: EXC_BAD_INSTRUCTION (SIGILL) Exception Codes: 0x0000000000000001, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Illegal instruction: 4 Termination Reason: Namespace SIGNAL, Code 0x4 Terminating Process: exc handler [16230]

Application Specific Information: CoreSimulator 757.5 - Device: iPhone 8 (A0FFE31C-C19D-4CAC-917B-010B6CE3F4A2) - Runtime: iOS 14.5 (18E182) - DeviceType: iPhone 8

Thread 0:: Dispatch queue: com.apple.main-thread 0 com.apple.CoreFoundation 0x00007fff2038b171 __CFRunLoopRun + 2789 1 com.apple.CoreFoundation 0x00007fff2038a1a7 CFRunLoopRunSpecific + 567 2 com.apple.GraphicsServices 0x00007fff2b874d85 GSEventRunModal + 139 3 com.apple.UIKitCore 0x00007fff246c14df -[UIApplication _run] + 912 4 com.apple.UIKitCore 0x00007fff246c639c UIApplicationMain + 101 5 org.reactjs.native.example.realmHermes 0x000000010ed664d0 main + 112 (main.m:7) 6 libdyld.dylib 0x00007fff2025abbd start + 1

EXC_BAD_INSTRUCTION

EXC_BAD_INSTRUCTION

Process: realmHermes [21541] Path: /Users/USER/Library/Developer/CoreSimulator/Devices/D5A0AFC6-F590-4E42-8B9D-867AD36CB43A/data/Containers/Bundle/Application/6AF8443A-4B97-4CCE-86AC-9F90A66740CA/realmHermes.app/realmHermes Identifier: realmHermes Version: 1.0 (1) Code Type: X86-64 (Native) Parent Process: launchd_sim [18331] Responsible: SimulatorTrampoline [7116] User ID: 501

Date/Time: 2021-09-04 01:27:10.133 -0300 OS Version: macOS 11.5.2 (20G95) Report Version: 12 Anonymous UUID: 1E47EC22-9B28-370B-4B8C-FC36E91171B3

Time Awake Since Boot: 6600 seconds

System Integrity Protection: disabled

Crashed Thread: 12 com.facebook.react.JavaScript

Exception Type: EXC_BAD_INSTRUCTION (SIGILL) Exception Codes: 0x0000000000000001, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Illegal instruction: 4 Termination Reason: Namespace SIGNAL, Code 0x4 Terminating Process: exc handler [21541]

Application Specific Information: CoreSimulator 757.5 - Device: iPhone 12 (D5A0AFC6-F590-4E42-8B9D-867AD36CB43A) - Runtime: iOS 14.5 (18E182) - DeviceType: iPhone 12

Thread 0:: Dispatch queue: com.apple.main-thread 0 com.apple.CFNetwork 0x00007fff237203e4 0x7fff2353f000 + 1971172 1 com.apple.CoreFoundation 0x00007fff20392513 _CFRelease + 244 2 com.apple.CFNetwork 0x00007fff235ed2a9 0x7fff2353f000 + 713385 3 libobjc.A.dylib 0x00007fff20178c42 object_cxxDestructFromClass(objc_object*, objc_class*) + 83 4 libobjc.A.dylib 0x00007fff2018abee objc_destructInstance + 64 5 libobjc.A.dylib 0x00007fff20190d88 -[NSObject dealloc] + 21 6 com.apple.CFNetwork 0x00007fff236fff51 0x7fff2353f000 + 1838929 7 libobjc.A.dylib 0x00007fff20191604 objc_object::sidetable_release(bool, bool) + 174 8 com.apple.CFNetwork 0x00007fff237017c5 0x7fff2353f000 + 1845189 9 libobjc.A.dylib 0x00007fff20191604 objc_object::sidetable_release(bool, bool) + 174 10 com.apple.CFNetwork 0x00007fff2377bddb 0x7fff2353f000 + 2346459 11 com.apple.CFNetwork 0x00007fff23556f4f 0x7fff2353f000 + 98127 12 libobjc.A.dylib 0x00007fff20191604 objc_object::sidetable_release(bool, bool) + 174 13 libobjc.A.dylib 0x00007fff20192dc7 AutoreleasePoolPage::releaseUntil(objc_object**) + 175 14 libobjc.A.dylib 0x00007fff20192cb6 objc_autoreleasePoolPop + 185 15 com.apple.CoreFoundation 0x00007fff20432036 _CFAutoreleasePoolPop + 22 16 com.apple.CoreFoundation 0x00007fff2038fd5c __CFRunLoopPerCalloutARPEnd + 41 17 com.apple.CoreFoundation 0x00007fff2038b1a2 __CFRunLoopRun + 2838 18 com.apple.CoreFoundation 0x00007fff2038a1a7 CFRunLoopRunSpecific + 567 19 com.apple.GraphicsServices 0x00007fff2b874d85 GSEventRunModal + 139 20 com.apple.UIKitCore 0x00007fff246c14df -[UIApplication _run] + 912 21 com.apple.UIKitCore 0x00007fff246c639c UIApplicationMain + 101 22 org.reactjs.native.example.realmHermes 0x0000000109f3e4d0 main + 112 (main.m:7) 23 libdyld.dylib 0x00007fff2025abbd start + 1

joaodematejr avatar Sep 04 '21 04:09 joaodematejr

@joaodematejr thanks a lot for taking this for a spin! Can I get you to move this to a new issue? GitHub comments are really bad at threaded conversations ...

kraenhansen avatar Sep 04 '21 06:09 kraenhansen

@kneth Does this require a specific version of RN? I'd like to give this a try with one of our apps but that's still on 0.63.4, is that up-to-date enough?

liamjones avatar Sep 06 '21 10:09 liamjones

@liamjones Our tests are using 0.64.2, and you might have to bump to 0.64 for it to work.

kneth avatar Sep 06 '21 10:09 kneth

We just pre-released realm at v10.20.0-alpha.1 with support for Hermes running on Android too! 🎉

Please note that React Native must be at version 0.66.0-rc.3 or later .. this is very important, since JSI is not ABI stable and your app will simply crash if the version isn't correct. Also hot reloading of app is working on iOS only (Android will be coming soon).

As an experiment, we're trying out the GitHub release discussion feature: So if you have any experiences (good or bad) with this pre-release, please share them over at https://github.com/realm/realm-js/discussions/3978

kraenhansen avatar Sep 22 '21 09:09 kraenhansen

We've released a new version of Realm JS with support for the Hermes engine: Realm JS v10.20.0-alpha.2. This fix the crash when reloading the app on Android.

Please take it for a spin and provide any feedback or issues you might have using the Hermes issue template:

npm install realm@hermes

kraenhansen avatar Nov 29 '21 13:11 kraenhansen

@kraenhansen Tested this extensively with a pool of users in one of my apps. No issues reported so far!

salembaira avatar Dec 11 '21 14:12 salembaira

Awesome news

HSReact avatar Dec 11 '21 14:12 HSReact

@Baira thank you so much for doing that! This helps us build confidence in the release, which moves us one step closer to releasing this on our "latest" branch.

kraenhansen avatar Dec 11 '21 18:12 kraenhansen

Where can I find currently known issues?

Is it possible to test only for Android with this version? Which one is more stable, Android or iOS?

cristianoccazinsp avatar Dec 16 '21 18:12 cristianoccazinsp

@kraenhansen I will be testing 10.20.0-alpha.2 on Android with Hermes over the next few days to about ~50 users.

I will also be testing 10.20.0-alpha.2 on iOS, but without Hermes (as it doesn't support INTL yet and polyfills are terrible), do you know if this Realm version without Hermes may be problematic? I've noticed you got rid of GCDWebServer dependency, so I'm afraid this version may have issues if not using Hermes.

cristianoccazinsp avatar Dec 17 '21 14:12 cristianoccazinsp

FPS drop significantly when app is offline the issue resolved in 10.10.1 but same issue happened in 10.20.0-alpha.2 Hermes. I think the changes still not merged in this Hermes branch

Related Issue: https://github.com/realm/realm-js/issues/3882

rajpootathar avatar Dec 27 '21 07:12 rajpootathar

We have a release pending from our Hermes branch, which will pull in the latest improvements from master. It'll land first thing in the new year.

kraenhansen avatar Dec 27 '21 08:12 kraenhansen

We have a release pending from our Hermes branch, which will pull in the latest improvements from master. It'll land first thing in the new year.

I almost cried when I heard this. Thanks to all the developers for your efforts. I had this problem when I was a little kid, and now I'm a happy old man.

YaoHuiJi avatar Jan 02 '22 16:01 YaoHuiJi

We're proud to announce that we've just released Realm JS v10.20.0-beta.0 - the latest in the series of releases with support for the Hermes engine. With this release all our tests are now passing and we're even more confident in our approach.

See issues with the hermes label for outstanding issue that we'll tackle next. We would love to know more about your perceived runtime performance of this releases compared to your use-case requirements and experience from past releases. If you decide to take it for a spin, please report any bugs using the hermes issue template and tell us about your general experience via this discussion on GitHub.

Thanks for your patience and all your encouragement throughout this transition towards Hermes as the default engine for React Native!

kraenhansen avatar Jan 06 '22 16:01 kraenhansen

@kraenhansen that's great to hear! Migration to Hermes is going to take us a bit of work due to other dependencies as well - does the beta still support the JSC as well so we can upgrade Realm first and then look at turning on Hermes afterwards?

liamjones avatar Jan 07 '22 09:01 liamjones

@liamjones ~~Yes, the beta still supports JSC. You can use the HERMES_ENABLED environment variable to enable/disable JSI (Hermes). See here for example.~~

Edit: Whoops, the above is not correct, sorry. That only applies with building our test apps. However, since we are targeting JSI in general, and not just Hermes, you can switch backends in your own apps (see reactnative.dev). You can, however use the code linked above as inspiration to switch your own app's configuration.

fronck avatar Jan 07 '22 10:01 fronck

Fantastic news. I had just hit a conflict with react-native-reanimated (edit: v2), which seems to require Hermes, so this was perfect timing.

I switched this version in from 10.6.1 and have had no problems so far, but will report back if I find anything. Thank you for all the hard work!

elliottkember avatar Jan 08 '22 21:01 elliottkember

Fantastic news. I had just hit a conflict with react-native-reanimated, which seems to require Hermes, so this was perfect timing.

I switched this version in from 10.6.1 and have had no problems so far, but will report back if I find anything. Thank you for all the hard work!

Thanks for sharing and do let us know how this goes, we are also using reanimated…though I believe it is reanimated 2 (which has far superior performance) which requires Hermes.

Either way we are happy to switch after hearing your success stories, do keep posting…

HSReact avatar Jan 09 '22 05:01 HSReact

I tried Realm JS v10.20.0-beta.0, but I met a terrible problem, sometimes I reopen my app, all data is missing, but when I check the default.realm file, all data is still in the file. It seems like sometimes my app don't read the Documents/default.realm file, but create a new db file in some place, because I can still create and update data when I found all data lost.

YaoHuiJi avatar Jan 09 '22 10:01 YaoHuiJi

I met a terrible problem

@YaoHuiJi please create an issue with the relevant information allowing us to reproduce and eventually solve any bug there might be.

kraenhansen avatar Jan 09 '22 10:01 kraenhansen

I met a terrible problem

@YaoHuiJi please create an issue with the relevant information allowing us to reproduce and eventually solve any bug there might be.

Ok, because I tried it the day before yesterday, and now it has rolled back. I will try it again sometime in a few days.

YaoHuiJi avatar Jan 09 '22 11:01 YaoHuiJi

I tried Realm JS v10.20.0-beta.0, but I met a terrible problem, sometimes I reopen my app, all data is missing, but when I check the default.realm file, all data is still in the file. It seems like sometimes my app don't read the Documents/default.realm file, but create a new db file in some place, because I can still create and update data when I found all data lost.

Have you been able to reproduce it? Is it iOS or Android? Keep in mind iOS stores your data in a new absolute location with every new app update, so if for some reason there's an absolute path stored somewhere, it will be lost when you try to read it again.

cristianoccazinsp avatar Jan 12 '22 00:01 cristianoccazinsp

I tried Realm JS v10.20.0-beta.0, but I met a terrible problem, sometimes I reopen my app, all data is missing, but when I check the default.realm file, all data is still in the file. It seems like sometimes my app don't read the Documents/default.realm file, but create a new db file in some place, because I can still create and update data when I found all data lost.

Have you been able to reproduce it? Is it iOS or Android? Keep in mind iOS stores your data in a new absolute location with every new app update, so if for some reason there's an absolute path stored somewhere, it will be lost when you try to read it again.

Yes, I can reproduce it, but It only happened in the release version(iOS, real device, not attached to Xcode), debug version works well. what I found is weird...

  1. Use Xcode to run my app(release) on my phone, everything works well
  2. Click 'Stop' in XCode to detach the app process
  3. Reopen the app by tapping the app icon on iPhone
  4. All data "disappeared", but I can still create new data records in my App
  5. If I repeat step 1, all data shows up again. Then repeat steps 2, 3, all data disappeared again.

When I check data in Documents/default.realm, all data exists, including the old data and the new data, the app didn't create another realm data file(as I guessed before), just the same one. It seems my app can write data but read nothing, there is no crash, just no data can be read and showed up. It only happened on the release version without Xcode attached, so I don't know how to debug it further...

hi @kraenhansen , I don't know if it's enough to create an issue, because I don't know how to get more information.

packages related: "react-native": "0.66.0", "realm": "10.20.0-beta.0", "redux": "^4.1.1", "react-redux": "^7.2.4",

YaoHuiJi avatar Jan 12 '22 06:01 YaoHuiJi