Skip to content

fix(ios): Return NO from requiresMainQueueSetup#6202

Open
antonis wants to merge 1 commit into
mainfrom
antonis/fix-requires-main-queue-setup
Open

fix(ios): Return NO from requiresMainQueueSetup#6202
antonis wants to merge 1 commit into
mainfrom
antonis/fix-requires-main-queue-setup

Conversation

@antonis
Copy link
Copy Markdown
Contributor

@antonis antonis commented May 21, 2026

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Return NO from +requiresMainQueueSetup in RNSentry.mm. The module's init only performs a trivial NSObject allocation (RNSentryTimeToDisplay), which has no main-thread requirement.

Note that methodQueue still returns dispatch_get_main_queue(), so all exported RCT methods continue to execute on the main thread as before.

💡 Motivation and Context

When requiresMainQueueSetup returns YES, React Native uses dispatch_sync(mainQueue, ...) to initialize the module during bridge setup. This unnecessary synchronization point can contribute to startup hangs if the main thread is blocked.

This was originally set to YES in 2017 when methodQueue was changed to return the main queue, but init never actually required main-thread execution.

Fixes #6201

💚 How did you test it?

This is a one-line change to a React Native module lifecycle constant. The sample app CI builds validate that the app starts correctly.

📝 Checklist

  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing
  • No breaking changes

🔮 Next steps

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • fix(ios): Return NO from requiresMainQueueSetup by antonis in #6202
  • feat(core): Expose pauseAppHangTracking and resumeAppHangTracking APIs by antonis in #6192

🤖 This preview updates automatically when you update the PR.

@sentry
Copy link
Copy Markdown

sentry Bot commented May 21, 2026

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
Sentry RN io.sentry.reactnative.sample 8.12.0 (89) Release

⚙️ sentry-react-native Build Distribution Settings

@github-actions
Copy link
Copy Markdown
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3835.69 ms 1209.92 ms -2625.77 ms
Size 5.15 MiB 6.68 MiB 1.53 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
3817909+dirty 1183.90 ms 1187.50 ms 3.60 ms
44c8b3f+dirty 3823.85 ms 1207.66 ms -2616.19 ms
b0d3373+dirty 3831.75 ms 1227.29 ms -2604.46 ms
7d6fd3a+dirty 1223.29 ms 1229.57 ms 6.28 ms
6176a94+dirty 3836.50 ms 1217.64 ms -2618.86 ms
5c1e987+dirty 1204.30 ms 1222.15 ms 17.85 ms
3d377b5+dirty 1218.48 ms 1219.51 ms 1.03 ms
7d8c8bd+dirty 3837.24 ms 1215.51 ms -2621.73 ms
4966363+dirty 3854.04 ms 1231.55 ms -2622.50 ms
5fe1c6c+dirty 1220.79 ms 1217.63 ms -3.16 ms

App size

Revision Plain With Sentry Diff
3817909+dirty 3.38 MiB 4.73 MiB 1.35 MiB
44c8b3f+dirty 5.15 MiB 6.66 MiB 1.51 MiB
b0d3373+dirty 5.15 MiB 6.68 MiB 1.53 MiB
7d6fd3a+dirty 3.38 MiB 4.77 MiB 1.39 MiB
6176a94+dirty 5.15 MiB 6.68 MiB 1.53 MiB
5c1e987+dirty 3.38 MiB 4.73 MiB 1.35 MiB
3d377b5+dirty 3.38 MiB 4.76 MiB 1.38 MiB
7d8c8bd+dirty 5.15 MiB 6.68 MiB 1.53 MiB
4966363+dirty 5.15 MiB 6.68 MiB 1.53 MiB
5fe1c6c+dirty 3.38 MiB 4.77 MiB 1.39 MiB

@github-actions
Copy link
Copy Markdown
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3857.24 ms 1228.83 ms -2628.41 ms
Size 5.15 MiB 6.68 MiB 1.53 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
3817909+dirty 1210.76 ms 1215.64 ms 4.89 ms
44c8b3f+dirty 3849.24 ms 1209.94 ms -2639.31 ms
b0d3373+dirty 3842.49 ms 1218.49 ms -2624.00 ms
7d6fd3a+dirty 1210.89 ms 1217.63 ms 6.74 ms
6176a94+dirty 3854.15 ms 1221.77 ms -2632.38 ms
5c1e987+dirty 1208.43 ms 1220.72 ms 12.29 ms
3d377b5+dirty 1201.55 ms 1201.80 ms 0.25 ms
7d8c8bd+dirty 3847.98 ms 1230.77 ms -2617.21 ms
4966363+dirty 3863.07 ms 1227.19 ms -2635.88 ms
5fe1c6c+dirty 1201.36 ms 1209.15 ms 7.78 ms

App size

Revision Plain With Sentry Diff
3817909+dirty 3.38 MiB 4.73 MiB 1.35 MiB
44c8b3f+dirty 5.15 MiB 6.66 MiB 1.51 MiB
b0d3373+dirty 5.15 MiB 6.68 MiB 1.53 MiB
7d6fd3a+dirty 3.38 MiB 4.77 MiB 1.39 MiB
6176a94+dirty 5.15 MiB 6.68 MiB 1.53 MiB
5c1e987+dirty 3.38 MiB 4.73 MiB 1.35 MiB
3d377b5+dirty 3.38 MiB 4.76 MiB 1.38 MiB
7d8c8bd+dirty 5.15 MiB 6.68 MiB 1.53 MiB
4966363+dirty 5.15 MiB 6.68 MiB 1.53 MiB
5fe1c6c+dirty 3.38 MiB 4.77 MiB 1.39 MiB

@antonis antonis marked this pull request as ready for review May 21, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Triggers the full CI test suite skip-changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return NO from requiresMainQueueSetup to avoid main-queue dispatch_sync at bridge init

1 participant