Repository navigation
fix(core): Stop wrapping RNSentry in TurboModuleContext by default - #6921
Conversation
Each wrapped RNSentry call wrote the turbo_module context and two tags to the isolation scope at start and end. Scope sync forwards every write to the native SDK, and sentry-cocoa persists each scope change to disk for watchdog termination tracking. The SDK calls RNSentry about 54 times per tab switch, so this added about 5 ms of CPU per call on iOS. RNSentry is already in the default ignoreTurboModules list, so with default options the wrap only produced crash context for the SDK's own calls. Now RNSentry is wrapped only when the user removes it from ignoreTurboModules, which keeps the opt-in aggregate behavior. Fixes #6886
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5c645a6. Configure here.
antonis
left a comment
There was a problem hiding this comment.
Thanks @alwx 🙇 Turning off the RNSentry wrap by default fixes the reported cost.
The Cursor finding looks valid. Also wdyt of opting in through modules only, not through ignoreTurboModules. With the current approach anyone who sets their own ignore list turns the wrap back on without knowing it.
Review feedback on #6921. Two problems with gating the wrap on ignoreTurboModules: - Any user who sets a custom ignore list without RNSentry would turn the wrap back on without knowing it. - Passing RNSentry through modules wrapped it without RNSENTRY_SKIP, so the first SDK call recursed through scope sync until the app crashed. RNSentry is now wrapped only when it is listed in modules. For that entry the integration resolves the module itself when none is given and always merges RNSENTRY_SKIP into the skip list. The module field becomes optional so that { name: 'RNSentry' } is enough.
|
Thanks, both points were valid and both are fixed now.
The |
antonis
left a comment
There was a problem hiding this comment.
LGTM after the tests go 🟢
📲 Install BuildsAndroid
|

📢 Type of change
📜 Description
turboModuleContextIntegrationno longer wraps the SDK's ownRNSentrymodule by default. To wrap it again, add{ name: 'RNSentry' }to themodulesoption. The integration then merges the scope-sync skip list in itself, so it cannot recurse. User-supplied modules are still wrapped for crash context.💡 Motivation and Context
Each wrapped
RNSentrycall wrote theturbo_modulecontext and two tags to the scope at start and end. Scope sync forwards every write to the native SDK, and sentry-cocoa saves each scope change to disk. This added about 5 ms of CPU to every SDK call on iOS. SinceRNSentrywas already ignored for aggregate stats, the wrap only produced a crash tag naming the SDK method in flight.Fixes #6886
💚 How did you test it?
Added two Jest tests:
RNSentryis not wrapped by default, and anRNSentrycall makes no scope writes. Both failed before the fix.yarn test,yarn lint,yarn circularDepCheck, andyarn api-report:checkpass.📝 Checklist
sendDefaultPIIis enabled.