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

Guard against null event handler to prevent android crash #1089

Closed
wants to merge 2 commits into from
Closed

Guard against null event handler to prevent android crash #1089

wants to merge 2 commits into from

Conversation

bnchdrff
Copy link

This PR adds a patch from kaiterra@99d4ddc / getdelta@311da06 to prevent an exception like the following:

com.swmansion.reanimated.nodes.EventNode.receiveEvent
EventNode.java, line 63
java.lang.IllegalArgumentException: Animated events must have event data.

The crash is mentioned in the following issues:

@ssuchanowski
Copy link

Is there a plan to merge this any time soon?

@bnchdrff
Copy link
Author

we're going to try this out & see if it has any effect - if it seems to be a stable fix i'll mark the PR as ready to review

@Apollon77
Copy link

@bnchdrff ANd, did you got results from your tests?

@akread
Copy link

akread commented Jul 22, 2020

Any update on the status of this PR? For a project I am working on I was planning on forking this repo to apply the patch since we are seeing a significant (enough) amount of crashes in production but I'd like to avoid that if this will be merged shortly.

@pyankoff
Copy link

Applying the patch fixed the crashes for me.

@kamalpandey
Copy link

kamalpandey commented Jul 26, 2020

Waiting for this one to be merged.

@jakub-gonet
Copy link
Member

I'd like to wait with merging this after we know what causes the crash, this solution prevents events from being sent if extra data is null but what makes it null in the first place?

If you want to use this solution before it's merged you can use patch-package to do that.

@tuantu196
Copy link

hi team dev, can you review and fix this issue please. i have same bug on my project and i cant fix it :( Many thanks!

@bnchdrff bnchdrff marked this pull request as ready for review August 6, 2020 19:26
@bnchdrff
Copy link
Author

bnchdrff commented Aug 6, 2020

thanks for everyone's patience - yes this patch does resovle the exceptions for our app!

@kamalpandey
Copy link

@jakub-gonet

Does this help?


Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View versioned.host.exp.exponent.modules.api.components.gesturehandler.GestureHandler.getView()' on a null object reference
       at versioned.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.deliverEventToGestureHandler(GestureHandlerOrchestrator.java:279)
       at versioned.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.deliverEventToGestureHandlers(GestureHandlerOrchestrator.java:259)
       at versioned.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.onTouchEvent(GestureHandlerOrchestrator.java:101)
       at versioned.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerRootHelper.dispatchTouchEvent(RNGestureHandlerRootHelper.java:121)
       at versioned.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerEnabledRootView.dispatchTouchEvent(RNGestureHandlerEnabledRootView.java:36)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)
       at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:549)
       at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1953)
       at android.app.Activity.dispatchTouchEvent(Activity.java:3559)
       at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
       at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:502)
       at android.view.View.dispatchPointerEvent(View.java:12027)
       at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5278)
       at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5067)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4581)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4634)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4600)
       at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4727)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4608)
       at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4784)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4581)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4634)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4600)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4608)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4581)
       at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7169)
       at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7143)
       at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7104)
       at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7325)
       at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:192)
       at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(InputEventReceiver.java)
       at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:181)
       at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:7248)
       at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:7353)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:981)
       at android.view.Choreographer.doCallbacks(Choreographer.java:790)
       at android.view.Choreographer.doFrame(Choreographer.java:715)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:967)
       at android.os.Handler.handleCallback(Handler.java:808)
       at android.os.Handler.dispatchMessage(Handler.java:101)
       at android.os.Looper.loop(Looper.java:166)
       at android.app.ActivityThread.main(ActivityThread.java:7529)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)

@jakub-gonet
Copy link
Member

@kamalpandey this seems like another crash, so not really. You can open an issue for it if you want.

Some small reproduction examples would be ideal here, so we can reproduce this crash deterministically.

@kamalpandey
Copy link

@jakub-gonet Sorry I don't have any idea how to reproduce it. I am seeing this on crash log.

aliceathens added a commit to aliceathens/react-native-gesture-handler that referenced this pull request Aug 14, 2020
aliceathens added a commit to aliceathens/react-native-gesture-handler that referenced this pull request Aug 14, 2020
aliceathens added a commit to aliceathens/react-native-gesture-handler that referenced this pull request Aug 14, 2020
@Setekh
Copy link

Setekh commented Aug 17, 2020

Hello guys, is there any plan or ETA when this PR is gonna be merged? We need it to go forward and we'd rather not result to hacks like catching exceptions on the main thread or overriding dependencies.

Thank you very much <3

@jakub-gonet
Copy link
Member

@Setekh, I'll try to investigate it in a few days, until this is merged you can use patch-package to automatically apply this patch after RNGH installation.

@jakub-gonet
Copy link
Member

@bnchdrff, could you check if #1171 fixes this issue for you?

@jakub-gonet
Copy link
Member

Going to close this one in favor of #1171.

Thanks for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants