react-native-reanimated icon indicating copy to clipboard operation
react-native-reanimated copied to clipboard

CppException: Cannot set property 'startTime' of undefined

Open andreialecu opened this issue 1 year ago • 7 comments

Description

This seems to be a new issue, we haven't seen it logged before.

Probably caused by #6143

Just bumped to 3.14.0 and published an update and seeing these logged in Sentry:

com.facebook.jni.CppException: Cannot set property 'startTime' of undefined

TypeError: Cannot set property 'startTime' of undefined
    at manageStateFrameCallback (JavaScript:1:1614)
    at anonymous (JavaScript:1:116)
    at apply (native)
    at anonymous (JavaScript:1:112)
    at forEach (native)
    at anonymous (JavaScript:1:79)
    at com.swmansion.reanimated.AndroidUIScheduler.triggerUI(AndroidUIScheduler.java)
    at com.swmansion.reanimated.AndroidUIScheduler$1.run(AndroidUIScheduler.java:24)
    at com.swmansion.reanimated.AndroidUIScheduler$2.runGuarded(AndroidUIScheduler.java:43)
    at com.facebook.react.bridge.GuardedRunnable.run(GuardedRunnable.java:29)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:233)
    at android.app.ActivityThread.main(ActivityThread.java:8030)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)

Steps to reproduce

  1. not sure of a repro yet, just reporting this for awareness currently

Snack or a link to a repository

https://snack.expo.io/

Reanimated version

3.14.0

React Native version

0.74.2

Platforms

Android

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

andreialecu avatar Jul 21 '24 08:07 andreialecu

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?

github-actions[bot] avatar Jul 21 '24 08:07 github-actions[bot]

The issue might be here, although I see that code hasn't been touched in a while, so perhaps something else was changed that affects it:

https://github.com/software-mansion/react-native-reanimated/blame/0d551fbca1eb2f4a18856fdf7c4de8f496f525c4/packages/react-native-reanimated/src/frameCallback/FrameCallbackRegistryUI.ts#L113

andreialecu avatar Jul 21 '24 08:07 andreialecu

https://github.com/software-mansion/react-native-reanimated/issues/6158#issuecomment-2186659514

Found this video that shows the same error.

andreialecu avatar Jul 21 '24 08:07 andreialecu

Note that if this is related to useFrameCallback, we don't use it in the app anywhere, except for this in react-native-collapsible-tab-view: https://github.com/PedroBern/react-native-collapsible-tab-view/blob/88000ccc38884c1c60cc06af0d149dd208bafbf1/src/Container.tsx#L229-L236

From the usage in the 3rd party library, it seems it's being used with runOnJS as documented to being a fix by the last comment in #6158

Also, this was not logged before in Sentry, but it seems to be affecting a bunch of Android devices (haven't published iOS yet).

It also seems to only happen in a certain screen, and not always. I wasn't able to reproduce it personally yet.

andreialecu avatar Jul 21 '24 08:07 andreialecu

Opened a PR at #6301 with a crash fix.

andreialecu avatar Jul 21 '24 09:07 andreialecu

Hey @andreialecu thanks for submitting the issue & creating a PR! I am currently trying as hard as I can to reproduce the race condition anyhow but it seems to be pretty difficult - if by any means you find a more likely setup let me know!

szydlovsky avatar Jul 22 '24 09:07 szydlovsky

Hey @andreialecu Reanimated just got a 3.15.0 version release and this PR that might possibly fix the issue is in there. Could you please check it out?

szydlovsky avatar Aug 06 '24 12:08 szydlovsky