Skip to content

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

@HADeveloper

Description

@HADeveloper

What React Native libraries do you use?

RN New Architecture, Expo Application Services (EAS), Expo (mobile only), React Navigation

Are you using sentry.io or on-premise?

sentry.io (SaS)

Are you using any other error monitoring solution alongside Sentry?

No

Other Error Monitoring Solution Name

No response

@sentry/react-native SDK Version

6.20.0

How does your development environment look like?

⬇  Place the `npx react-native@latest info` output here. ⬇

(REDACTED)
iOS:
  hermesEnabled: true
  newArchEnabled: true


Sentry.init()

Sentry.init({
  dsn: 'https://...@sentry.io/...'
  // other options
});

N/A

Steps to Reproduce

RNSentry's +requiresMainQueueSetup currently returns YES (packages/core/ios/RNSentry.mm). Its init only performs a trivial NSObject allocation — no UIKit or main-thread-only work — so it can safely return NO.

Returning YES forces a dispatch_sync onto the main queue during bridge setup, which has been observed as a rare "App Hang" crasher (notably reported by Shopify: https://arc.net/l/quote/kkxmwgdb). Concern grows under the New Architecture where bridge-init timing is tighter.

Proposed change: return NO. Happy to open a PR if it's welcome.

Expected Result

No Crash

Actual Result

Startup crashes

(This is more of a preventative measure as we are cleaning up things and moving to new arch)

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions