Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Native Application stuck in init / black screen of death for iOS Simulator #4549

Open
CarlosELopez opened this issue Feb 16, 2025 · 5 comments

Comments

@CarlosELopez
Copy link

What React Native libraries do you use?

Hermes, React Navigation

Are you using sentry.io or on-premise?

on-premise (Self-Hosted)

@sentry/react-native SDK Version

6.3.0

How does your development environment look like?

System:
  OS: macOS 15.3
  CPU: (10) arm64 Apple M1 Pro
  Memory: 116.03 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.20.5
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.8.2
    path: /opt/homebrew/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK:
    API Levels:
      - "28"
      - "29"
      - "30"
      - "31"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 28.0.3
      - 30.0.2
      - 30.0.3
      - 33.0.0
      - 33.0.1
      - 33.0.3
      - 34.0.0
      - 35.0.0
      - 35.0.1
    System Images:
      - android-34 | Google APIs ARM 64 v8a
      - android-VanillaIceCream | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12550806
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.13
    path: /Users/clopez32/.jenv/shims/javac
  Ruby:
    version: 3.4.1
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.75.4
    wanted: 0.75.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

package.json "@sentry/react-native": "6.0.0", // used to be "6.3.0", but I'm playing with it.

yarn list --depth=0
 |─ @sentry-internal/[email protected]
├─ @sentry-internal/[email protected]
├─ @sentry-internal/[email protected]
├─ @sentry-internal/[email protected]
├─ @sentry/[email protected]
├─ @sentry/[email protected]
├─ @sentry/[email protected]
├─ @sentry/[email protected]
├─ @sentry/[email protected]
├─ @sentry/[email protected]
├─ @sentry/[email protected]
├─ @sentry/[email protected]
├─ @sentry/[email protected]
├─ @sentry/[email protected]
├─ @sentry/[email protected]
├─ @sentry/[email protected]
├─ @sentry/[email protected]
├─ @sentry/[email protected]
├─ @sentry/[email protected]
  - RNSentry (6.7.0):
    - DoubleConversion
    - glog
    - hermes-engine
    - RCT-Folly (= 2024.01.01.00)
    - RCTRequired
    - RCTTypeSafety
    - React-Core
    - React-debug
    - React-Fabric
    - React-featureflags
    - React-graphics
    - React-hermes
    - React-ImageManager
    - React-NativeModulesApple
    - React-RCTFabric
    - React-rendererdebug
    - React-utils
    - ReactCodegen
    - ReactCommon/turbomodule/bridging
    - ReactCommon/turbomodule/core
    - Sentry/HybridSDK (= 8.44.0)
    - Yoga
- Sentry/HybridSDK (8.44.0)

Sentry.init()

export const SENTRY_INTEGRATIONS = [
  Sentry.reactNavigationIntegration({
     enableTimeToInitialDisplay: true,
  }),
  entry.appStartIntegration({ standalone: true}),
  Sentry.reactNativeTracingIntegration(),
];

Sentry.init({
  dsn: '### self hosted',
  environment,
  release: sentryReleaseVersion,
  sampleRate: 0.05, // Error rate
  tracesSampleRate: 0.05, // Transactions
  profilesSampleRate: 1.0, // relative to tracesSampleRate, capture profile info.
  integrations: SENTRY_INTEGRATIONS,
  enableCaptureFailedRequests: true,
  enableAutoSessionTracking: true,
  attachStacktrace: true,
  enableAutoPerformanceTracing: true,
  enableUserInteractionTracing: true,
  attachViewHierarchy: true,
});

Steps to Reproduce

  • yarn install --reset--cache
  • cd ios && pod install
  • cd .. && yarn start
  • My app runs on Rosetta/x86. Build and Run from Xcode.

This started happening over the last two-three days for my local development setup. It was working fine before.

I am working against an iOS Simulator. When I start my app on the simulator, my applications gets stuck on a black screen after the splash screen. The JS Bundle downloads from metro, but it seems the app never starts.

As an experiment, I ran my app against my physical device. While connected to Xcode and Metro locally, I get the same hung result.
When I disconnect my device and just run the build, it eventually starts.

As an experiment I removed Sentry completely and it brings it back to life.

As an experiment, I downgraded to version 5.34.0 I get a different crash, but the application seems to start and respond. I have tried using @sentry/react-native version 6.3.0, 6.6.0, 6.7.0 but I'm currently getting the exact same result.

To gather more info, I pause execution from Xcode, I see the com.facebook.react.Javascript thread is stuck on something related to Hermes profiling. I don't get a stack trace or crash message from Xcode.

Image

Image

Image

Expected Result

App starts up and I can see it. This only happens when I remove Sentry pods completely or when I run on my device independently.

Actual Result

I get a black screen of death and a hang on RN Sentry in iOS simulator.

Image

@CarlosELopez
Copy link
Author

CarlosELopez commented Feb 16, 2025

After playing more with it, I downgraded to @sentry/react-native version 6.1.0 and I disabled instrumentation below, and my app is back up.

RNSentry.m

#if __has_include(<hermes/hermes.h>) && SENTRY_PROFILING_SUPPORTED
#    define SENTRY_PROFILING_ENABLED 0 <-- Change from 1
#    import <Sentry/SentryProfilingConditionals.h>
#else
#    define SENTRY_PROFILING_ENABLED 0
#    define SENTRY_TARGET_PROFILING_SUPPORTED 0
#endif

@markushi
Copy link
Member

@CarlosELopez thanks for letting us know and taking a deep dive.
@krystofwoldrich can you take a look at this?

@krystofwoldrich
Copy link
Member

Hi @CarlosELopez,
thank you for the details,

The cause is the Hermes Profiler locking the JS thread, but I don't see why from the current information.


Does the lock happen on every start or does it happen randomly?


Since it started recently, have you made any changes in the past 3 days that might be seemingly irrelevant? Like upgrading the RN version, changing any Sentry.init options, installing a new dependency to the project... anything that would help us reproduce the issue?

@getsantry getsantry bot moved this to Waiting for: Community in GitHub Issues with 👀 3 Feb 17, 2025
@krystofwoldrich krystofwoldrich moved this from Needs Discussion to Needs More Information in Mobile & Cross Platform SDK Feb 17, 2025
@CarlosELopez
Copy link
Author

Hi @krystofwoldrich thanks for the reply. Here is some extra information:

We are recent adopters of Sentry, migrating from Crashlytics. We just landed the PR for our first integration about 2 weeks ago. We shipped this version to production. I suspect there might be some underlying dependency that has changed. As far as I can tell, no native changes on our side. I repeated some more tests to see if I can continue to narrow it down.

  • I am pulling the same yarn.lock from the version we shipped last week and the hang is 100% of the time for me occurring on iOS Simulator.
  • I am able to launch on Android simulator properly.
  • I am able to launch on an iPhone physical device properly.

Currently, I pull our code from 2-3 days ago, and cleaned installed everything and I still get the same hang that was not occurring before. . My package.json is:

@sentry/react-native version "6.6.0"
@sentry/core version "8.53.0"
@sentry/cli "2.41.1"
@sentry/react version "8.53.0"
pod `Sentry (8.44.0)`
pod `RNSentry (6.6.0)`

I will confirm with my coworkers tomorrow if they see something on their iOS simulator as well. I'm a bit stumped on what is going wrong with it.

I do have a workaround but it requires If I do my workaround above, I have to Simulator > Erase All Content and Settings when switching the SENTRY_PROFILING_ENABLED macro value.

@getsantry getsantry bot moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 3 Feb 17, 2025
@kahest kahest moved this from Needs More Information to Needs Investigation in Mobile & Cross Platform SDK Feb 17, 2025
@krystofwoldrich
Copy link
Member

@CarlosELopez Thank you for the details.

Can you confirm if it happens for your colleagues as well?

Is the iOS version of the sim the same as the device you are using?

If you disable profiling by removing profilesSampleRate (instead of the macro value) in the JS options does the issue stop?

@krystofwoldrich krystofwoldrich moved this from Needs Investigation to Needs More Information in Mobile & Cross Platform SDK Feb 19, 2025
@getsantry getsantry bot moved this to Waiting for: Community in GitHub Issues with 👀 3 Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for: Community
Status: Needs More Information
Development

No branches or pull requests

3 participants