react-native-reanimated: [Android] Native crash on React Native 0.65-rc3 / reanimated 2.3 alpha 2
Description
The application ends up crashing after a few seconds of use with an issue seemingly originated in libreanimated.so:
react-native-reanimated@^2.3.0-alpha.2:
react-native@^0.65.0-rc.3
The logs are from a simulator but it also happens on device. Please do let me know if I can provide you with any more debug info.
The crash:
tombstoned: received crash request for pid 16158
crash_dump64: performing dump of process 15998 (target tid = 16158)
DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
DEBUG : Build fingerprint: 'google/sdk_gphone_x86_64/generic_x86_64_arm64:11/RSR1.201211.001/7027799:user/release-keys'
DEBUG : Revision: '0'
DEBUG : ABI: 'x86_64'
DEBUG : Timestamp: 2021-08-04 16:45:05+0100
DEBUG : pid: 15998, tid: 16158, name: hades >>> com.getpaired.app <<<
DEBUG : uid: 10160
DEBUG : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
DEBUG : Abort message: 'terminating with uncaught exception of type std::runtime_error: Unable to retrieve jni environment. Is the thread attached?'
DEBUG : rax 0000000000000000 rbx 0000000000003e7e rcx 000077e3ffd1d2a8 rdx 0000000000000006
DEBUG : r8 0000000000000000 r9 0000000000000000 r10 000077e10f8f9fd0 r11 0000000000000246
DEBUG : r12 000077e10f8fa1c0 r13 0000003000000008 r14 000077e10f8f9fc8 r15 0000000000003f1e
DEBUG : rdi 0000000000003e7e rsi 0000000000003f1e
DEBUG : rbp 000077e10f8fa660 rsp 000077e10f8f9fb8 rip 000077e3ffd1d2a8
DEBUG : backtrace:
DEBUG : #00 pc 000000000005a2a8 /apex/com.android.runtime/lib64/bionic/libc.so (syscall+24) (BuildId: 3707c39fc397eeaa328142d90b50a973)
DEBUG : #01 pc 000000000005d212 /apex/com.android.runtime/lib64/bionic/libc.so (abort+194) (BuildId: 3707c39fc397eeaa328142d90b50a973)
DEBUG : #02 pc 00000000000a729b /data/app/~~lmq3je1BbxNWbJtPz5Bjig==/com.getpaired.app-inlOIcjHWLG8qEZZwKEhfg==/lib/x86_64/libc++_shared.so (BuildId: 013d16f5e2afb684dc5c7ebda3499fd97205ac47)
DEBUG : #03 pc 00000000000a745d /data/app/~~lmq3je1BbxNWbJtPz5Bjig==/com.getpaired.app-inlOIcjHWLG8qEZZwKEhfg==/lib/x86_64/libc++_shared.so (BuildId: 013d16f5e2afb684dc5c7ebda3499fd97205ac47)
DEBUG : #04 pc 00000000000bd4d2 /data/app/~~lmq3je1BbxNWbJtPz5Bjig==/com.getpaired.app-inlOIcjHWLG8qEZZwKEhfg==/lib/x86_64/libc++_shared.so (BuildId: 013d16f5e2afb684dc5c7ebda3499fd97205ac47)
DEBUG : #05 pc 00000000000bd468 /data/app/~~lmq3je1BbxNWbJtPz5Bjig==/com.getpaired.app-inlOIcjHWLG8qEZZwKEhfg==/lib/x86_64/libc++_shared.so (std::terminate()+40) (BuildId: 013d16f5e2afb684dc5c7ebda3499fd97205ac47)
DEBUG : #06 pc 00000000000d1b5e /data/app/~~lmq3je1BbxNWbJtPz5Bjig==/com.getpaired.app-inlOIcjHWLG8qEZZwKEhfg==/lib/x86_64/libreanimated.so (BuildId: 62098f20cee9b154bcc6f0be2e58717a622f9f32)
Previous logs from application launch:
15998 15998 W m.getpaired.ap: Unexpected CPU variant for X86 using defaults: x86_64
D SoLoader: init start
D SoLoader: adding system library source: /vendor/lib64
D SoLoader: adding system library source: /system/lib64
D SoLoader: adding application source: com.facebook.soloader.DirectorySoSource[root = /data/app/~~lmq3je1BbxNWbJtPz5Bjig==/com.getpaired.app-inlOIcjHWLG8qEZZwKEhfg==/lib/x86_64 flags = 0]
D SoLoader: adding backup source from : com.facebook.soloader.ApkSoSource[root = /data/data/com.getpaired.app/lib-main flags = 1]
D SoLoader: Preparing SO source: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
D SoLoader: Preparing SO source: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
D SoLoader: Preparing SO source: com.facebook.soloader.DirectorySoSource[root = /data/app/~~lmq3je1BbxNWbJtPz5Bjig==/com.getpaired.app-inlOIcjHWLG8qEZZwKEhfg==/lib/x86_64 flags = 0]
D SoLoader: Preparing SO source: com.facebook.soloader.ApkSoSource[root = /data/data/com.getpaired.app/lib-main flags = 1]
V fb-UnpackingSoSource: locked dso store /data/user/0/com.getpaired.app/lib-main
V fb-UnpackingSoSource: deps mismatch on deps store: regenerating
V fb-UnpackingSoSource: so store dirty: regenerating
08-04 16:42:14.620 15998 15998 D ApkSoSource: not allowing consideration of lib/x86_64/libreanimated.so: deferring to libdir
Expected behavior
Actual behavior & steps to reproduce
Can’t reproduce it deterministically, it always happens after a few seconds.
Snack or minimal code example
I hope the above stack traces can help narrow down the issue, we have a very complex app with heavy use of reanimated.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 32
- Comments: 30 (19 by maintainers)
Commits related to this issue
- shows android crash ref https://github.com/software-mansion/react-native-reanimated/issues/2256 — committed to andreialecu/rnctv-react-native-bare-test by andreialecu 3 years ago
- Fix jni refference in destructor (#2389) Authors: @Szymon20000 @piaskowyk After changes in Hermes's garbage collector - the host object destructor can be called from another thread than JNI is assi... — committed to software-mansion/react-native-reanimated by piaskowyk 3 years ago
I am also running into this issue on android with the react-native-reanimated@2.3.0-alpha.2 release.
Description
The application crashes immediately when running on android in the simplest use case.
Expected behavior
The application does not crash.
Actual behavior & steps to reproduce
Create a bare react native project. Install react-native-reanimated@2.3.0-alpha.2, follow the instructions for the android setup and then build the app. The app builds successfully on android studio but crashes immediately when trying to run it.
If I downgrade the version of react-native-reanimated to 2.2.0 in the same project it starts working again.
This problem ONLY exists on android. On iOS version 2.3.0-alpha.2 works fine.
Snack or minimal code example
https://github.com/hmust92/AwesomeProject
Package versions
Affected platforms
It seems that
2.3.0-alpha.3
has just been released, but I’m getting the same crash on Android.There does seem to be a difference, it crashes a bit later. With alpha.2 it was crashing instantly. But with alpha.3 I can interact with the app a bit before it crashes.
This issue is probably related to this Hermes’s issue: https://github.com/facebook/hermes/issues/590
Just got a different stacktrace for an android crash on
2.3.0-alpha.3
if this helps:I don’t think #2040 is related, that crash was originally reported on 2.1.0 as well, but we weren’t having any crashes up until 2.3.0-alpha.
I believe
2.3.0-alpha.2
is unfortunately completely broken on Android currently.There seems to be a 2.2.1 version planned which brings RN 0.65 support on the 2.2.0 line. It was initially scheduled for last week, but it seems it got delayed.
The 2.3.0 crash might’ve been introduced by #1879 as per other reports. I’m hoping that 2.2.1 will work properly.
Apparently my crash is connected to
interpolateColor
method and it seems to be introduced in the following commit: https://github.com/software-mansion/react-native-reanimated/commit/5d2cf0f7b6053a1b94b1d27570dee649f7d022a8#diff-7d21e3d74f24354efa89336b8bf8f70b6a9361923678365bd8219753da3f53c4R693@piaskowyk I also remember that everything seemed to work fine on 0.64 while creating the repro in https://github.com/software-mansion/react-native-reanimated/issues/2256#issuecomment-912539629.
I believe the crash started occurring after updating the project to 0.65 indeed.
I was able to create a repro for this. It seems to be a race condition of some sort because if I delay adding the component that uses reanimated for a bit, the crash doesn’t occur. But if it’s added at app start, it crashes.
This branch shows it: https://github.com/andreialecu/rnctv-react-native-bare-test/tree/bug-androidcrash
Relevant files: https://github.com/andreialecu/rnctv-react-native-bare-test/blob/bug-androidcrash/Crash.tsx And: https://github.com/andreialecu/rnctv-react-native-bare-test/blob/c2afa0f3030d96c9c9530feb75379a30d38b7036/App.tsx#L90
It’s a dirty repro, but I just hacked it together quick based on a real app it occurs in.
(cc @piaskowyk @jmysliv)
@KoreanThinker , hey let’s don’t chase the guys so much. We are all would like to use the latest react-native version with reanimated on board, but let’s try to be patience 😃 Hope we will see 2.2.1 or new alpha soon 😃
Hello guys,
I have changed my hermes to
false
and it works for me (no crash). I don’t know about hermes but it work.@piaskowyk when will 2.2.1 be release?