react-native-gesture-handler
react-native-gesture-handler copied to clipboard
Rare crash on android
Description
We dont have any reference to worklet or runOnJS seems to be coming from RNGestureHandlerStateChangeEvent. Happens to about 1% of users, Android 14 the most.
Exception com.facebook.jni.CppException: Exception in HostFunction: [Reanimated] Attempted to extract from a HostObject that wasn't converted to a Shareable.
Error: Exception in HostFunction: [Reanimated] Attempted to extract from a HostObject that wasn't converted to a Shareable.
at _scheduleOnJS (native)
at anonymous (JavaScript:1:453)
at anonymous (JavaScript:1:212)
at anonymous (JavaScript:1:638)
at handleAndFlushAnimationFrame (JavaScript:1:148)
at com.swmansion.reanimated.nativeProxy.EventHandler.receiveEvent
at com.swmansion.reanimated.nativeProxy.EventHandler.receiveEvent (EventHandler.java:25)
at com.swmansion.gesturehandler.react.RNGestureHandlerStateChangeEvent.dispatch (RNGestureHandlerStateChangeEvent.kt:50)
at com.swmansion.reanimated.NodesManager.handleEvent (NodesManager.java:327)
at com.swmansion.reanimated.NodesManager.onEventDispatch (NodesManager.java:313)
at com.facebook.react.uimanager.events.EventDispatcherImpl.dispatchEvent (EventDispatcherImpl.java:116)
at com.swmansion.gesturehandler.ReactContextExtensionsKt.dispatchEvent (ReactContextExtensions.kt:9)
at com.swmansion.gesturehandler.react.RNGestureHandlerModule.sendEventForDirectEvent (RNGestureHandlerModule.kt:605)
at com.swmansion.gesturehandler.react.RNGestureHandlerModule.sendEventForReanimated (RNGestureHandlerModule.kt:591)
at com.swmansion.gesturehandler.react.RNGestureHandlerModule.onStateChange (RNGestureHandlerModule.kt:543)
at com.swmansion.gesturehandler.react.RNGestureHandlerModule.access$onStateChange (RNGestureHandlerModule.kt:49)
at com.swmansion.gesturehandler.react.RNGestureHandlerModule$eventListener$1.onStateChange (RNGestureHandlerModule.kt:312)
at com.swmansion.gesturehandler.core.GestureHandler.dispatchStateChange (GestureHandler.kt:84)
at com.swmansion.gesturehandler.core.GestureHandlerOrchestrator.onHandlerStateChange (GestureHandlerOrchestrator.kt:133)
at com.swmansion.gesturehandler.core.GestureHandler.moveToState (GestureHandler.kt:558)
at com.swmansion.gesturehandler.core.GestureHandler.cancel (GestureHandler.kt:647)
at com.swmansion.gesturehandler.core.GestureHandlerOrchestrator.cancelAll (GestureHandlerOrchestrator.kt:215)
at com.swmansion.gesturehandler.core.GestureHandlerOrchestrator.onTouchEvent (GestureHandlerOrchestrator.kt:39)
at com.swmansion.gesturehandler.react.RNGestureHandlerRootHelper.dispatchTouchEvent (RNGestureHandlerRootHelper.kt:101)
at com.swmansion.gesturehandler.react.RNGestureHandlerRootView.dispatchTouchEvent (RNGestureHandlerRootView.kt:36)
at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3286)
at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2990)
at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3286)
at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2990)
at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3286)
at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2990)
at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3286)
at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2990)
at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3286)
at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2990)
at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3286)
at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2990)
at com.android.internal.policy.DecorView.superDispatchTouchEvent (DecorView.java:1117)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent (PhoneWindow.java:1971)
at android.app.Activity.dispatchTouchEvent (Activity.java:4388)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent (WindowCallbackWrapper.java:70)
at com.android.internal.policy.DecorView.dispatchTouchEvent (DecorView.java:1075)
at android.view.View.dispatchPointerEvent (View.java:15803)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent (ViewRootImpl.java:8153)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess (ViewRootImpl.java:7877)
at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:7213)
at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:7270)
at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:7236)
at android.view.ViewRootImpl$AsyncInputStage.forward (ViewRootImpl.java:7434)
at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:7244)
at android.view.ViewRootImpl$AsyncInputStage.apply (ViewRootImpl.java:7491)
at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:7217)
at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:7270)
at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:7236)
at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:7244)
at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:7217)
at android.view.ViewRootImpl.deliverInputEvent (ViewRootImpl.java:10788)
at android.view.ViewRootImpl.doProcessInputEvents (ViewRootImpl.java:10676)
at android.view.ViewRootImpl.enqueueInputEvent (ViewRootImpl.java:10632)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent (ViewRootImpl.java:10926)
at android.view.InputEventReceiver.dispatchInputEvent (InputEventReceiver.java:285)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents
at android.view.InputEventReceiver.consumeBatchedInputEvents (InputEventReceiver.java:262)
at android.view.ViewRootImpl.doConsumeBatchedInput (ViewRootImpl.java:10874)
at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run (ViewRootImpl.java:11020)
at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1301)
at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1309)
at android.view.Choreographer.doCallbacks (Choreographer.java:923)
at android.view.Choreographer.doFrame (Choreographer.java:844)
at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:1283)
at android.os.Handler.handleCallback (Handler.java:942)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loopOnce (Looper.java:226)
at android.os.Looper.loop (Looper.java:313)
at android.app.ActivityThread.main (ActivityThread.java:8757)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)
Steps to reproduce
Unable to re produce, it doesnt seem to happen to all users. Just a select few.
Snack or a link to a repository
N/A
Gesture Handler version
2.14.0
React Native version
0.72.6
Platforms
Android
JavaScript runtime
Hermes
Workflow
Expo bare workflow
Architecture
Paper (Old Architecture)
Build type
Release mode
Device
Real device
Device model
No response
Acknowledgements
Yes
Hey! 👋
The issue doesn't seem to contain a minimal reproduction.
Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?
Hi @claudesortwell! Which version of reanimated do you use? It is very likely that it was fixed in 3.6.0
Hi @claudesortwell! Which version of
reanimateddo you use? It is very likely that it was fixed in3.6.0
Been using 3.6.1 of reanimated @m-bert for weeks still crashing
In that case could you provide some more information? Like reproduction or a code snippet demonstrating how do you use gesture handlers. Unfortunately we can't do much without it.
You could also try to upgrade reanimated to 3.7.0, but as I said, it should be already fixed in 3.6.0.
@m-bert cant seem to replicate it, on 2 of my Android devices or simulator. Just have crash reports in sentry and play console.
Will upgrade RN and reanimated and check back.
Hi @claudesortwell I am facing the same issue. did it work after the upgrading reanimated to 3.7.0?
I've been crashing on android, when entering multiple tap gestures in a short timespan.
Gesture handler version 2.14.0
Reanimated version 3.6.3
React Native version 0.73.4
Hi @Kalightortaio! In that case would you be able to provide a reproduction? I've tried to spam on Tap gesture but I haven't experienced any crash. Also it would be great if you could test that on Reanimated 3.8.0 since there were some fixes that could help.
Also, please take a look at these 2 issues in Reanimated:
Hi @claudesortwell and @m-bert, in my case was an inline declaration of a function to run in the runOnJS
workletContext {
runOnJS(() => onGestureCancel?.())();
}
For me was happening in the implementation of the react-native-drawer-layout while using the useAnimatedGestureHandler
For the fix just need to create the function in the JSContext
Check the official fix for this: https://github.com/react-navigation/react-navigation/commit/3cfb3e63949f0aa6f4b14db02161dd88fd10cb12?diff=unified&w=1
@m-bert @claudesortwell just a heads up, this also occurs on IOS
Hi @ismaelsousa! Thanks a lot! ❤️
this also occurs on IOS
Does it happen with the fix in drawer-layout?
Also it would be great if someone else could confirm that fix in drawer-layout helps.
@m-bert I guess the fix should solve ios as well
Great! @claudesortwell, could you please look into it? Do you use react-native-drawer-layout? If so, does the fix provided by @ismaelsousa work?
Great! @claudesortwell, could you please look into it? Do you use
react-native-drawer-layout? If so, does the fix provided by @ismaelsousa work?
I've actually rolled out the above fix above yesterday (Sydney time) doesn't seem to be crashing anymore. Just going to leave the issue open for a few more hours till more users come on.
@ismaelsousa thanks for finding this fix, seems to have been causing the crash.
Seems to be fixed, thanks again @ismaelsousa
I'm glad to hear that. Thank you one more time @ismaelsousa!