Closed liamjones closed 2 years ago
Oh, and I assume the conflict happens because of the low-level way both modules bind themselves into the JSC?
Here is the android crash report for the above issue
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'HUAWEI/POT-LX1TEEA/HWPOT-H:10/HUAWEIPOT-L21T/10.0.0.177C431:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2021-07-08 09:36:53+0100
pid: 17233, tid: 18658, name: mqt_js >>> com.app <<<
uid: 10185
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
x0 0000000000000000 x1 00000000000048e2 x2 0000000000000006 x3 0000007b229b9640
x4 79747265706f7270 x5 79747265706f7270 x6 79747265706f7270 x7 656d614e79747265
x8 00000000000000f0 x9 9fdb7e7eb6f30c4f x10 0000000000000001 x11 0000000000000000
x12 fffffff0fffffbdf x13 00000000fc9eb851 x14 00000000fc9eb851 x15 0000007b10dbb770
x16 0000007c232f2908 x17 0000007c232d21c0 x18 0000000000000000 x19 0000000000004351
x20 00000000000048e2 x21 00000000ffffffff x22 0000007ae1698000 x23 0000000000000000
x24 0e00007b25ed5570 x25 ffff000000000002 x26 0000007acfa16af8 x27 0000007b29c96e84
x28 0000007af1ae3b40 x29 0000007b229b96e0
sp 0000007b229b9620 lr 0000007c23287040 pc 0000007c2328706c
backtrace:
#00 pc 000000000006f06c /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: dd7a905195762d00f4b732c4fa25226a)
#01 pc 000000000013c904 /data/app/com.app==/lib/arm64/libjsc.so (WTFCrashWithInfo(int, char const*, char const*, int)+24)
#02 pc 00000000004f594c /data/app/com.app==/lib/arm64/libjsc.so!libjsc.so (offset 0x142000) (JSC::JSCell::getPrototype(JSC::JSObject*, JSC::ExecState*)+28)
#03 pc 0000000000561a38 /data/app/com.app==/lib/arm64/libjsc.so!libjsc.so (offset 0x142000) (JSC::JSObject::hasPropertyGeneric(JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot::InternalMethodType) const+1928)
#04 pc 0000000000144a40 /data/app/com.app==/lib/arm64/libjsc.so!libjsc.so (offset 0x142000) (JSObjectSetProperty+116)
#05 pc 00000000001bbe8c /data/app/com.app==/lib/arm64/librealm.so (BuildId: 99b9a2ee3a5ba6d8268e595b1bc0edc39477e7f3)
#06 pc 00000000001bb3cc /data/app/com.app==/lib/arm64/librealm.so (BuildId: 99b9a2ee3a5ba6d8268e595b1bc0edc39477e7f3)
#07 pc 00000000001bab4c /data/app/com.app==/lib/arm64/librealm.so (BuildId: 99b9a2ee3a5ba6d8268e595b1bc0edc39477e7f3)
#08 pc 00000000001c04b8 /data/app/com.app==/lib/arm64/librealm.so (BuildId: 99b9a2ee3a5ba6d8268e595b1bc0edc39477e7f3)
#09 pc 00000000001cdb0c /data/app/com.app==/lib/arm64/librealm.so (BuildId: 99b9a2ee3a5ba6d8268e595b1bc0edc39477e7f3)
#10 pc 00000000001cd8c8 /data/app/com.app==/lib/arm64/librealm.so (BuildId: 99b9a2ee3a5ba6d8268e595b1bc0edc39477e7f3)
#11 pc 00000000001caa34 /data/app/com.app==/lib/arm64/librealm.so (BuildId: 99b9a2ee3a5ba6d8268e595b1bc0edc39477e7f3)
#12 pc 0000000000138524 /data/app/com.app==/lib/arm64/libjsc.so (JSC::JSCallbackObject<JSC::JSDestructibleObject>::getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&)+332)
#13 pc 0000000000138b6c /data/app/com.app==/lib/arm64/libjsc.so (JSC::JSCallbackObject<JSC::JSDestructibleObject>::getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned int, JSC::PropertySlot&)+96)
#14 pc 00000000003544c0 /data/app/com.app==/lib/arm64/libjsc.so!libjsc.so (offset 0x142000) (llint_slow_path_get_by_val+1080)
#15 pc 0000000000340ba0 /data/app/com.app==/lib/arm64/libjsc.so!libjsc.so (offset 0x142000)
Thank you for cross-posting. We will have to investigate it further to understand the interaction between JavaScriptCore and the two libraries is.
I have the same issue, downgrading to Reanimated v1 works for me.
Oh! Yes, v1 works here too. It's only an issue with v2 (which we're trying to upgrade to for the new API).
The problem is hermes. Reanimated v2 needs enableHermes: true. However realm is not compatible with hermes yet.
@wanderson-ra If you read the opening post you'll see that JSC is supported since Reanimated 2.2.0
Hi @kneth, any news on this one yet?
We're starting on the implementation of something which would be a lot simpler in reanimated v2 due to the new API but we're having to stick to v1 for now due to this conflict with Realm.
FYI, I've retested with the latest versions of both projects (Realm 10.6.1 and Reanimated 2.2.0) but, unsurprisingly, it still happens. Interestingly the behaviour seems somewhat variable? Possibly a race between the two modules hooking into the JSC?
If I use the minimal repro off of the reanimated ticket (https://github.com/limpbrains/reanimated-2-playground) it doesn't always crash when I hit the 'write to realm' button. Sometimes it crashes the app (seems more likely if I tap the button as soon as it's available, rather than waiting) but when it does 'work' I've seen varying output from the console.log statement:
[Tue Aug 10 2021 18:08:34.961] LOG created two tasks: &
...
[Tue Aug 10 2021 18:09:01.886] LOG created two tasks: Wrapper & Wrapper
...
[Tue Aug 10 2021 18:09:26.881] LOG created two tasks: undefined & undefined
Also, if there's anything extra we can provide to help (tombstones, etc) let us know.
Same having this problem with realm + reanimated v2 which is a major problem as reanimated v2 looks like a requirement for some camera packages i need
https://github.com/software-mansion/react-native-reanimated/issues/1424
Same here. iOS works. Android writes result in empty objects.
r.write(() => {
var anObject = myRealm.create('SomeModel', {
id: 1,
// other variables
})
console.log(anObject, anObject.id) // => {} undefined
})
Hermes is disabled of course.
"realm": "^10.8.0",
"react-native": "^0.65.1",
"react-native-reanimated": "^2.3.0-beta.2",
Downgrading react-native-reanimated
to v1 helped as mentioned above.
Same problem, we have to use reanimated v2 to for other dependencies, and it's urgent for us to find a solution to use both together. Looking forward to hear more
this problem doesn't seem to be solved.
Anyone who is eager to have this issue fixed, please try the latest betas of 10.20 with hermes support. In my experiments, it was working out of the box
Anyone who is eager to have this issue fixed, please try the latest betas of 10.20 with hermes support. In my experiments, it was working out of the box
Hi @somebody32 , I still crash ios app on testflight
@hungnv2010 then please attach some reproducible example, because the original issue was about data loss or crash on reload. Looks like you have something different here
@hungnv2010 we're not aware of any crashes happening with Realm JS 10.20.0-beta.1 and the Reanimated library. So as @somebody32 says, please create a new issue with a reproduction, this helps us a lot when debugging an issue like this.
@hungnv2010 then please attach some reproducible example, because the original issue was about data loss or crash on reload. Looks like you have something different here
@somebody32 I don't know if the problem arises from the realm or from react-native-reanimated. I have upgraded from 5.0.3 to 10.20.0-beta.1 and react-native-reanimated from v1 to v2 with Hermes enabled, debug still runs normally testflight then crash app. both 5.0.3 and 10.20.0-beta.1 crashed a few times when open app.
Anyone who is eager to have this issue fixed, please try the latest betas of 10.20 with hermes support. In my experiments, it was working out of the box
Thank you so much, I was having issues for days and this fixed it
Our Hermes release branch currently solves all issues related to Reanimated v2. Please use this branch if your project needs react-native-reanimated
. If you are having any issues with the current Hermes release branch, please open a new ticket describing your issue.
To quickly switch to this release branch, use the following command:
npm install realm@hermes
We are actively working on this branch, so any input would be appreciated 😃
Our Hermes release branch currently solves all issues related to Reanimated v2.
@takameyer does this include when running them together with the JSC rather than Hermes?
@liamjones Yes, you do not need to enable Hermes for this to work.
A part of the hermes effort was fixing the bridge between Android and the javascript engine. This fixes the conflict we were having with the way react-native-reanimated
establishes this bridge.
Awesome, thanks!
I'm not sure upgrading to realm@hermes
is really a solution here as it currently has some major performance issues. The other workaround is downgrading reanimated, are there any other potential workarounds?
I don't think there's any other workarounds that I am aware of, although perhaps someone from the community has some ideas. We're hoping we can solve the performance regressions soon. Sorry, I realise it's not ideal, but since realising the impact we are treating this as a high priority.
No worries, I know you're working hard on this. I want the JSI implementation to work because when it does it will be 🔥
Sounds like you're close!
I think I'm having the same problem my app keeps crashing when i use realm in drawer or tab navigation but works fine on stack. plzz tell me how to sort this issue. I'm using react native reanimated v2
I think I'm having the same problem my app keeps crashing when i use realm in drawer or tab navigation but works fine on stack. plzz tell me how to sort this issue. I'm using react native reanimated v2
I'm using realm@hermes as @takameyer suggested and it is working, there are still some random crashes but it is better than without it.
Our Hermes release branch currently solves all issues related to Reanimated v2. Please use this branch if your project needs
react-native-reanimated
. If you are having any issues with the current Hermes release branch, please open a new ticket describing your issue.To quickly switch to this release branch, use the following command:
npm install realm@hermes
We are actively working on this branch, so any input would be appreciated 😃
This issu has not been solved for me. when i want realm.write my application crashed
"react": "18.0.0", "react-native": "0.69.0", "react-native-reanimated": "2.15.0",
@AzadMohammadi-z Please take a look at https://github.com/realm/realm-js/blob/v11/COMPATIBILITY.md to find a compatible version. Best is to upgrade to latest version but it will also include upgrading React Native.
@AzadMohammadi-z Please take a look at https://github.com/realm/realm-js/blob/v11/COMPATIBILITY.md to find a compatible version. Best is to upgrade to latest version but it will also include upgrading React Native.
Thank you so much, My problem is solved
will this also happen in a project that has reanimated v2 and also realm but as native component of a native module? we are using a native player component that internally uses realm for managing offline download support and having same sort of issues
@OrenMe if you're using one of the Realm native modules only (e.g. realm-java, realm-cocoa, etc rather than realm-js) I don't think you should run into this issue.
It's specifically a conflict between how realm-js and reanimated v2 both want to bind themselves to the JavaScriptCore and do so in a way that there's a conflict between them. The pure native modules won't know about the JSC and won't be attempting to do anything with it.
thanks @liamjones
Hey, bumping this up again. Here's both of my packages:
"react-native-reanimated": "^3.6.1", "realm": "12.0.0-rc.2",
I had realm 12.6.1 but read somewhere that the rc versions had this fixed. Critical loss in application functionality. Hoping this gets fixed soon.
@Muhammad19Omer
read somewhere that the rc versions had this fixed
This is very unlikely, since 12.6.1
is newer - please open a new Issue with the template filled out, to help us narrow the cause of the issue you're seeing.
I'm locking the issue for further comments as we believe this has been resolved. If you can reproduce an issue with Realm + Reanimated, please help us pin point any potential issue by opening a new issue with the templated filled out and ideally a minimal reproduction. Thanks!
Goals
Use react-native-reanimated v2 alongside Realm. Reanimated v2 used to require Hermes (and I'm aware RealmJS's Hermes support is still WIP) but v2.2.0+ have added JSC support as well [1].
Expected Results
The two to live together happily.
Actual Results
In our instance - the app runs fine on iOS but on Android we can save stuff to Realm but reloading it results in objects being
undefined
. Others have reported app crashes with minimal repros to the renimated project already [2] but I thought I'd report it here too incase it can be fixed from the Realm side.Steps to Reproduce
Install Realm + react-native-reanimated v2.2.0+ in the same app without Hermes - attempt to use Realm on Android.
Code Sample
See minimal repro on this ticket: https://github.com/software-mansion/react-native-reanimated/issues/2028
Version of Realm and Tooling