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

Keyboard animation progress may be infinite and crash app #739

Closed
matthieuMay opened this issue Dec 19, 2024 · 3 comments · Fixed by #740
Closed

Keyboard animation progress may be infinite and crash app #739

matthieuMay opened this issue Dec 19, 2024 · 3 comments · Fixed by #740
Assignees
Labels
🤖 android Android specific 🎯 crash Library triggers a crash of the app

Comments

@matthieuMay
Copy link
Contributor

Describe the bug
In production we randomly see a crash with the following stack trace
java.lang.RuntimeException: folly::toJson: JSON object value was an INF when serializing value at "progress"
at com.facebook.react.bridge.NativeMap.toString(NativeMap.kt)
at com.swmansion.reanimated.nativeProxy.EventHandler.receiveEvent(EventHandler.java)
at com.swmansion.reanimated.nativeProxy.EventHandler.receiveEvent(EventHandler.java:25)
at com.facebook.react.uimanager.events.Event.dispatch(Event.java:173)
at com.swmansion.reanimated.NodesManager.handleEvent(NodesManager.java:350)
at com.swmansion.reanimated.NodesManager.onEventDispatch(NodesManager.java:336)
at com.facebook.react.uimanager.events.EventDispatcherImpl.dispatchEvent(EventDispatcherImpl.java:119)
at com.reactnativekeyboardcontroller.extensions.ThemedReactContextKt.dispatchEvent(ThemedReactContext.kt:23)
at com.reactnativekeyboardcontroller.listeners.KeyboardAnimationCallback.onProgress(KeyboardAnimationCallback.kt:267)
at androidx.core.view.WindowInsetsAnimationCompat$Impl21.dispatchOnProgress(WindowInsetsAnimationCompat.java:922)
at androidx.core.view.WindowInsetsAnimationCompat$Impl21$Impl21OnApplyWindowInsetsListener$1.onAnimationUpdate(WindowInsetsAnimationCompat.java:832)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1558)
at android.animation.ValueAnimator.animateBasedOnTime(ValueAnimator.java:1349)
at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1481)
at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
at android.animation.AnimationHandler.access$100(AnimationHandler.java:37)
at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1278)
at android.view.Choreographer.doCallbacks(Choreographer.java:1019)
at android.view.Choreographer.doFrame(Choreographer.java:907)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1248)
at android.os.Handler.handleCallback(Handler.java:900)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:219)

This error is rare (like 1 out of 10000 sessions) and we did not find a way to reproduce it. It is due to an incomplete numerical consistency check in KeyboardAnimationCallback.onProgress.

We made a patch package and release it to production. It fixes the issue.
I will submit a PR with the fin in a few minutes

@kirillzyusko
Copy link
Owner

@matthieuMay which version of the lib do you use?

@kirillzyusko kirillzyusko added 🤖 android Android specific 🎯 crash Library triggers a crash of the app labels Dec 19, 2024
@matthieuMay
Copy link
Contributor Author

1.14.5

@kirillzyusko
Copy link
Owner

kirillzyusko commented Dec 19, 2024

1.14.5

On which Android version do you see the crash? I fixed this problem for Android < 9 here #718

kirillzyusko pushed a commit that referenced this issue Dec 19, 2024
## 📜 Description

Add a numerical safety test to keyboard animation progress

## 💡 Motivation and Context

It solves a random crash in production where progress is infinite

Fixes
#739
#737
#735

## 📢 Changelog

### Android

- added `isInfinite` check along with `isNaN`;

## 🤔 How Has This Been Tested?

Releasing it to production via a patch package the error report
disappeared

## 📝 Checklist

- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 android Android specific 🎯 crash Library triggers a crash of the app
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants