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

Fix "folly::toJson: JSON object value was an INF" #6773

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tomekzaw
Copy link
Member

@tomekzaw tomekzaw commented Nov 28, 2024

Summary

This PR fixes the following error (or crash in release mode) on Android:

folly::toJson: JSON object value was an INF when serializing value at "..."
Screenshot 2024-11-28 at 14 56 22

Haven't seen this one in a while as this was previously fixed in #2901 but it looks like now even catch (std::exception &e) is not enough so we need to try with catch (...). Probably symbol linking is broken somewhere again.

Stack trace:

Fatal Exception: 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)
...

Test plan

Add the following lines in NodesManager.java in onAnimationFrame:

WritableMap writableMap = Arguments.createMap();
writableMap.putDouble("foo", POSITIVE_INFINITY);
handleEvent(9999, "aaa", writableMap);

Copy link
Member

@j-piasecki j-piasecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen a similar case while upgrading the Expensify App to 0.76. This patch has been working well so far: https://github.com/Expensify/App/pull/51475/files#diff-77f222782aaf2043dbe14c4e9d3ad6648bba881dda7f528b77b4cba958563acb.

From what I remember, hermes had a different typeinfo for std::exception than the rest of the app.

@tomekzaw
Copy link
Member Author

Possibly related to facebook/react-native#48027

@andrejpavlovic
Copy link

Issue popped up in Sentry for Android 9/10 when using Modal from react-native. This patch fixed it - thank you.

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.

4 participants