You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] [Sentry: APP-D1V] HybridApp iOS EXC_BAD_ACCESS in REANodesManager performOperations #96175
Reanimated native node operations crash during a worklet-driven animation frame — possible use-after-free or invalid node state when performOperations runs on the UI thread.
Reproduction
Unknown — see Sentry events linked from the Sentry issue.
REANodesManager performOperations is where Reanimated flushes queued node/view operations on the UI thread during the iOS display link (AnimationFrameQueue). The EXC_BAD_ACCESS (mach) means the worklet is dereferencing a node or view pointer that has already been freed, i.e. a use-after-free.
In practice this happens when a component that owns an animated node (a running useAnimatedStyle/useSharedValue-driven animation) unmounts while a frame is still queued. The view backing the node is torn down, but the pending operation in AnimationFrameQueue still tries to apply to it on the next display link tick, so performOperations touches freed memory and crashes.
Because the signature is entirely in native Reanimated frames and reproduces across app versions 9.4.25 through 9.4.31 (no route captured), there is no single first-party TypeScript line that "causes" it. It is a native stability defect in the pinned Reanimated version combined with animations that are allowed to keep running after their host unmounts. None of the App snippets provided touch worklets directly, which confirms the fault is in the native layer rather than a specific screen.
What changes do you think we should make in order to solve the problem?
Bump react-native-reanimated in package.json to the latest patch that includes the performOperations / AnimationFrameQueue use-after-free hardening. This is the primary fix because the crash lives entirely in native Reanimated frames and cannot be resolved from JS alone. After bumping, regenerate Podfile.lock so the iOS HybridApp binary picks up the patched pod.
As a defensive App-side guard, cancel any long-running or looping animations on unmount so no operation stays queued for a detached view. In components that start animations with withRepeat/withTiming on a useSharedValue, add a cleanup effect that calls cancelAnimation(sharedValue):
This stops Reanimated from enqueuing further frame operations for a node whose view is being freed, which is the exact condition that leads to the freed-pointer access in performOperations.
Add a Sentry breadcrumb/tag capture around navigation transitions so future events record the affected route. Today the Sentry issue reports Affected route(s): unknown, so we cannot narrow the specific animated screen; tagging the active route on transition (near App bootstrap in App.tsx) will let us confirm the version bump resolved it or pinpoint the offending component.
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
MagicCodeInput starts an infinite repeating cursor-blink animation in useEffect with no cleanup handler. When the component unmounts—especially during HybridApp transitions between OldDot and NewDot—the animation's repeating withRepeat(..., -1, false) call continues executing on the Reanimated UI thread, but the underlying animated node reference becomes invalid. When Reanimated's native REANodesManager.performOperations executes on the next display link, it operates on a deallocated or stale node pointer, triggering EXC_BAD_ACCESS.
The useEffect with empty dependencies fires once on mount and sets an infinite repeating animation (-1 means repeat forever). There is no cleanup function — useEffect must return a cleanup that cancels the animation before unmount, but it doesn't. The animation callback runs on the UI thread even after the component is destroyed, and when React Navigation unmounts or transitions (especially during HybridApp navigation), the Reanimated node is deallocated. The next scheduled animation frame tries to update a dead node.
Why the sibling case works:
LoadingBar.tsx has the exact same pattern but with proper cleanup:
When shouldShow becomes false, it explicitly calls cancelAnimation(left) and cancelAnimation(width) before the component unmounts. PulsingView.tsx uses useAnimatedReaction with explicit cancelAnimation calls as well:
useSharedValue is created inside the component, so the cleanup function always runs before the value is garbage-collected.
cancelAnimation() is idempotent — calling it on an already-stopped animation is safe.
The animation is local to MagicCodeInput and has no side effects outside the component, so canceling it on unmount has no impact on other state.
This pattern is already proven in LoadingBar and PulsingView — we are simply applying the same guard that works elsewhere.
We can also apply the same fix to any other infinite animation that uses withRepeat(..., -1) without explicit cleanup. A grep for withRepeat.*-1 across components would find similar patterns.
What alternative solutions did you explore? (Optional)
Move the animation to a context or module-level instance: Wrong — the animation is tied to the individual component's lifecycle and its visual state. Decoupling it would make it harder to reason about and introduce race conditions during navigation.
Use useAnimatedReaction instead of useEffect: This could work, but useAnimatedReaction is for reactive dependencies on shared values, not one-time setup. A simple cleanup in useEffect is clearer and matches the pattern already in the codebase.
This is a native Reanimated race, not a route-specific JavaScript failure. During an iOS display-link tick, Worklets flushes the animation-frame queue on the UI runtime and Reanimated calls REANodesManager.performOperations. That operation can overlap a React Native surface commit/teardown and dereference stale native update state, producing the reported EXC_BAD_ACCESS.
The issue's three first-party frames (REANodesManager.performOperations → WorkletRuntime::runSync → AnimationFrameQueue.executeQueue) match upstream Reanimated issue #9293's symbolicated rAF crash path exactly. Upstream fixed that race through registry locking and performOperations/render-request atomicity changes in PRs #9323 and #9308.
The regression timing also aligns: App merged the Reanimated 4.2.3 and Worklets 0.8.1 upgrades in PRs #90086 and #90088 on May 11–12, and Sentry first saw this crash on May 16. The current App dependency manifest has since moved to 4.3.1/0.8.3, but Reanimated 4.3.1 cherry-picked #9323 and omitted #9308, and APP-D1V remains active through App 9.4.31.
HybridApp production builds use the Mobile-Expensify Xcode workspace and its Podfile.lock, rather than the standalone App iOS lockfile. The supplied checkout does not contain that submodule, so the implementation must first confirm the exact RNReanimated/Worklets pod versions and dSYM symbols in an affected HybridApp build. This changes which lockfile must be updated, but not the producer identified by the matching native stack.
What changes do you think we should make in order to solve the problem?
After confirming the affected HybridApp resolves the App Reanimated pod, upgrade react-native-reanimated to 4.4.0 and, because 4.4.0 requires Worklets 0.9.x, upgrade react-native-worklets to 0.9.1 in the same change. Reanimated 4.4.0 contains both upstream race fixes (#9323 and the missing #9308), along with the rAF/event separation and shared ShadowNodeFamily lifetime changes that harden this same native update path. Regenerate package-lock.json, the standalone native lockfiles, and Mobile-Expensify's HybridApp Podfile.lock so the shipped iOS binary actually links the fixed pair.
Reconcile the App and Mobile-Expensify patch sets as part of the bump; HybridApp installation applies patches from both directories to the installed modules.
Keep and refresh the App Reanimated stoi exception patch for 4.4.0 because upstream still catches only invalid_argument and out_of_range. Remove the Worklets 0.8.3 SerializableRemoteFunction patch after verifying 0.9.1, because Worklets 0.9.1 replaces that remote-function memory model with runtime-aware cleanup and an RN-runtime registry, covering the patch's unsafe cross-thread JSI-lifetime concern upstream.
- Reason: Fixes SIGSEGV crash in `SerializableRemoteFunction` destructor caused by a data race on `globalMarkdownWorkletRuntime`. The fix replaces the stored `jsi::Value` function reference with an ID-based lookup via a `__remoteFunctionCache` map, avoiding the unsafe cross-thread `~jsi::Value()` call during runtime teardown.
- Upstream PR/issue: N/A (patch authored by the `react-native-worklets` maintainer in https://github.com/Expensify/react-native-live-markdown/pull/752#issuecomment-3953415007)
Add a native iOS HybridApp regression/stress test that enqueues animation-frame work, then rapidly unmounts/remounts the React surface during active transitions and verifies the operation completes or is discarded without a crash.
Exercise repeated NewDot/OldDot transitions, background/foreground cycles, and animation-heavy layout/gesture/modal/list/live-markdown flows under Address Sanitizer; repeat app/runtime teardown to validate removal of the old Worklets patch.
Produce a release-mode HybridApp build and verify its dSYM and Mobile-Expensify Podfile.lock resolve Reanimated 4.4.0 and Worklets 0.9.1; verify the standalone iOS/Android lockfiles too, then monitor APP-D1V after staged rollout. Because this is a native timing race without a deterministic route, release stress coverage and the production Sentry check are required in addition to the native harness.
What alternative solutions did you explore? (Optional)
Backporting only #9308 onto the HybridApp's resolved Reanimated version would target the missing change, but the compatible stable 4.4.0/0.9.1 pair already contains it plus the adjacent lifetime and scheduling fixes, avoiding another long-lived native patch. Rolling back to 4.2.1 is also weaker because events continued after the App manifest moved forward and it would reintroduce fixes from later releases. Disabling individual animations, or adding speculative Mobile-Expensify teardown guards without first tying the symbol to shell-owned code, would suppress selected consumers instead of fixing the verified Reanimated producer.
Activity
samranahm commentedon Jul 20, 2026
Proposal
What is the root cause of that problem?
The crash is a native
EXC_BAD_ACCESSinsidereact-native-reanimated, not inside our JS/TS code. The top frames make this clear:REANodesManager performOperationsis where Reanimated flushes queued node/view operations on the UI thread during the iOS display link (AnimationFrameQueue). TheEXC_BAD_ACCESS(mach) means the worklet is dereferencing a node or view pointer that has already been freed, i.e. a use-after-free.In practice this happens when a component that owns an animated node (a running
useAnimatedStyle/useSharedValue-driven animation) unmounts while a frame is still queued. The view backing the node is torn down, but the pending operation inAnimationFrameQueuestill tries to apply to it on the next display link tick, soperformOperationstouches freed memory and crashes.Because the signature is entirely in native Reanimated frames and reproduces across app versions 9.4.25 through 9.4.31 (no route captured), there is no single first-party TypeScript line that "causes" it. It is a native stability defect in the pinned Reanimated version combined with animations that are allowed to keep running after their host unmounts. None of the App snippets provided touch worklets directly, which confirms the fault is in the native layer rather than a specific screen.
What changes do you think we should make in order to solve the problem?
Bump
react-native-reanimatedinpackage.jsonto the latest patch that includes theperformOperations/AnimationFrameQueueuse-after-free hardening. This is the primary fix because the crash lives entirely in native Reanimated frames and cannot be resolved from JS alone. After bumping, regeneratePodfile.lockso the iOS HybridApp binary picks up the patched pod.As a defensive App-side guard, cancel any long-running or looping animations on unmount so no operation stays queued for a detached view. In components that start animations with
withRepeat/withTimingon auseSharedValue, add a cleanup effect that callscancelAnimation(sharedValue):This stops Reanimated from enqueuing further frame operations for a node whose view is being freed, which is the exact condition that leads to the freed-pointer access in
performOperations.Affected route(s): unknown, so we cannot narrow the specific animated screen; tagging the active route on transition (nearAppbootstrap inApp.tsx) will let us confirm the version bump resolved it or pinpoint the offending component.App/src/App.tsx
Lines 72 to 76 in d24f5d7
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
melvin-bot commentedon Jul 20, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @aimane-chnaif (
External)melvin-bot commentedon Jul 20, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022079255464351954766
[-][Sentry: APP-D1V] HybridApp iOS EXC_BAD_ACCESS in REANodesManager performOperations[/-][+][$250] [Sentry: APP-D1V] HybridApp iOS EXC_BAD_ACCESS in REANodesManager performOperations[/+]yusufdeveloper2903 commentedon Jul 20, 2026
Proposal
What is the root cause of that problem?
MagicCodeInputstarts an infinite repeating cursor-blink animation inuseEffectwith no cleanup handler. When the component unmounts—especially during HybridApp transitions between OldDot and NewDot—the animation's repeatingwithRepeat(..., -1, false)call continues executing on the Reanimated UI thread, but the underlying animated node reference becomes invalid. When Reanimated's nativeREANodesManager.performOperationsexecutes on the next display link, it operates on a deallocated or stale node pointer, triggeringEXC_BAD_ACCESS.The bug in detail:
App/src/components/MagicCodeInput.tsx
Lines 460 to 465 in fd467ee
The
useEffectwith empty dependencies fires once on mount and sets an infinite repeating animation (-1means repeat forever). There is no cleanup function —useEffectmust return a cleanup that cancels the animation before unmount, but it doesn't. The animation callback runs on the UI thread even after the component is destroyed, and when React Navigation unmounts or transitions (especially during HybridApp navigation), the Reanimated node is deallocated. The next scheduled animation frame tries to update a dead node.Why the sibling case works:
LoadingBar.tsxhas the exact same pattern but with proper cleanup:App/src/components/LoadingBar.tsx
Lines 54 to 60 in fd467ee
When
shouldShowbecomesfalse, it explicitly callscancelAnimation(left)andcancelAnimation(width)before the component unmounts.PulsingView.tsxusesuseAnimatedReactionwith explicitcancelAnimationcalls as well:App/src/components/PulsingView.tsx
Lines 59 to 64 in fd467ee
Both components explicitly stop animations before destruction.
MagicCodeInputdoes not.What changes do you think we should make in order to solve the problem?
Add a cleanup function to the
useEffectthat cancels the cursor animation on unmount:Why this is safe:
useSharedValueis created inside the component, so the cleanup function always runs before the value is garbage-collected.cancelAnimation()is idempotent — calling it on an already-stopped animation is safe.MagicCodeInputand has no side effects outside the component, so canceling it on unmount has no impact on other state.LoadingBarandPulsingView— we are simply applying the same guard that works elsewhere.We can also apply the same fix to any other infinite animation that uses
withRepeat(..., -1)without explicit cleanup. A grep forwithRepeat.*-1across components would find similar patterns.What alternative solutions did you explore? (Optional)
useAnimatedReactioninstead ofuseEffect: This could work, butuseAnimatedReactionis for reactive dependencies on shared values, not one-time setup. A simple cleanup inuseEffectis clearer and matches the pattern already in the codebase.KJ21-ENG commentedon Jul 20, 2026
Proposal
What is the root cause of that problem?
This is a native Reanimated race, not a route-specific JavaScript failure. During an iOS display-link tick, Worklets flushes the animation-frame queue on the UI runtime and Reanimated calls
REANodesManager.performOperations. That operation can overlap a React Native surface commit/teardown and dereference stale native update state, producing the reportedEXC_BAD_ACCESS.The issue's three first-party frames (
REANodesManager.performOperations→WorkletRuntime::runSync→AnimationFrameQueue.executeQueue) match upstream Reanimated issue #9293's symbolicated rAF crash path exactly. Upstream fixed that race through registry locking andperformOperations/render-request atomicity changes in PRs #9323 and #9308.software-mansion/react-native-reanimated#9293
software-mansion/react-native-reanimated#9323
software-mansion/react-native-reanimated#9308
The regression timing also aligns: App merged the Reanimated 4.2.3 and Worklets 0.8.1 upgrades in PRs #90086 and #90088 on May 11–12, and Sentry first saw this crash on May 16. The current App dependency manifest has since moved to 4.3.1/0.8.3, but Reanimated 4.3.1 cherry-picked #9323 and omitted #9308, and APP-D1V remains active through App 9.4.31.
#90086
#90088
App/package.json
Lines 180 to 218 in 6a1f1a3
HybridApp production builds use the Mobile-Expensify Xcode workspace and its Podfile.lock, rather than the standalone App iOS lockfile. The supplied checkout does not contain that submodule, so the implementation must first confirm the exact RNReanimated/Worklets pod versions and dSYM symbols in an affected HybridApp build. This changes which lockfile must be updated, but not the producer identified by the matching native stack.
App/fastlane/Fastfile
Lines 314 to 370 in 6a1f1a3
App/scripts/pod-install.sh
Lines 46 to 58 in 6a1f1a3
App/.gitmodules
Lines 1 to 3 in 6a1f1a3
What changes do you think we should make in order to solve the problem?
After confirming the affected HybridApp resolves the App Reanimated pod, upgrade
react-native-reanimatedto 4.4.0 and, because 4.4.0 requires Worklets 0.9.x, upgradereact-native-workletsto 0.9.1 in the same change. Reanimated 4.4.0 contains both upstream race fixes (#9323 and the missing #9308), along with the rAF/event separation and sharedShadowNodeFamilylifetime changes that harden this same native update path. Regeneratepackage-lock.json, the standalone native lockfiles, and Mobile-Expensify's HybridApp Podfile.lock so the shipped iOS binary actually links the fixed pair.https://github.com/software-mansion/react-native-reanimated/releases/tag/4.4.0
https://github.com/software-mansion/react-native-reanimated/releases/tag/worklets-0.9.1
Reconcile the App and Mobile-Expensify patch sets as part of the bump; HybridApp installation applies patches from both directories to the installed modules.
App/scripts/applyPatches.sh
Lines 17 to 32 in 6a1f1a3
Keep and refresh the App Reanimated
stoiexception patch for 4.4.0 because upstream still catches onlyinvalid_argumentandout_of_range. Remove the Worklets 0.8.3SerializableRemoteFunctionpatch after verifying 0.9.1, because Worklets 0.9.1 replaces that remote-function memory model with runtime-aware cleanup and an RN-runtime registry, covering the patch's unsafe cross-thread JSI-lifetime concern upstream.App/patches/react-native-reanimated/details.md
Lines 2 to 9 in 6a1f1a3
App/patches/react-native-worklets/details.md
Lines 1 to 9 in 6a1f1a3
Test coverage:
What alternative solutions did you explore? (Optional)
Backporting only #9308 onto the HybridApp's resolved Reanimated version would target the missing change, but the compatible stable 4.4.0/0.9.1 pair already contains it plus the adjacent lifetime and scheduling fixes, avoiding another long-lived native patch. Rolling back to 4.2.1 is also weaker because events continued after the App manifest moved forward and it would reintroduce fixes from later releases. Disabling individual animations, or adding speculative Mobile-Expensify teardown guards without first tying the symbol to shell-owned code, would suppress selected consumers instead of fixing the verified Reanimated producer.
13 remaining items
mountiny commentedon Aug 6, 2026
Lets wait couple more days but looks promising
melvin-bot commentedon Aug 10, 2026
@jakubstec Eep! 4 days overdue now. Issues have feelings too...
jakubstec commentedon Aug 11, 2026
still zero occurences!
melvin-bot commentedon Aug 14, 2026
@jakubstec Whoops! This issue is 2 days overdue. Let's get this updated quick!
jakubstec commentedon Aug 17, 2026
@mountiny 0 crashes in the last 7 days, and still none of post
9.4.45-14releasemountiny commentedon Aug 17, 2026
Seems like this is fixed!