Skip to content

Report JS Loop stalls as Errors (similar to App Hangs on iOS)  #3460

Closed

Description

@rodolfoBee

Platform:

  • iOS
  • Android

SDK:

  • @sentry/react-native (>= 1.0.0)
  • react-native-sentry (<= 0.43.2)

SDK version:
5.15.1

react-native version:
0.72.7

Are you using Expo?

  • Yes
  • No

Are you using sentry.io or on-premise?

(@sentry/react-native)

Sentry.init({
  dsn: 'MY_DSN',
  debug:true
})

I have the following issue:

A user reported the app hanging but not event was sent to Sentry. As per docs:

There are many reasons why an app may become unresponsive, such as long-running code, infinite loop bugs, and so on. With app hang tracking you can detect and fix them.

I created an infinite loop to test it and no app hang events were sent. The same infinite loop works fine with Cocoa SDK.

Steps to reproduce:

  • Create a base react-native app
  • Add Sentry to it
  • Add the following button anywhere:
<Button
     onPress={() => {
         var i = 1;
          while (i > 0){i++;}
      }}
      title="LeLoop"
      color="#841584"
  />
  • run the app on ios

It is still possible to scroll through the app, but all other buttons no longer work as the app is still on the loop. But no event is sent.

Under which conditions is it expected for an event to be sent?

Activity

  1. moved this to Waiting for: Product Owner in GitHub Issues with 👀on Dec 11, 2023
  2. yogendrajs commented on Dec 11, 2023

    @yogendrajs

    Based on our recent conversations, thanks for taking the time to create the issue here, Rodolfo. Will subscribe and follow up on this.

  3. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀on Dec 13, 2023
  4. changed the title [-]App Hang tracking not working[/-] [+]Report JS Loop stalls as Errors (similar to App Hangs on iOS) [/+] on Dec 13, 2023
  5. krystofwoldrich commented on Dec 13, 2023

    @krystofwoldrich
    Contributor

    @rodolfoBee and @yogendrajs Thank you for the message.

    The SDK currently reports App Hangs when the native UI thread hangs (users can't interact with the app, even scrolling doesn't work).

    The JS loop hangs (stalls) are currently reported as a metric with Sentry Transactions.

    I've marked this issue as a feature request we will discuss internally if and how to report JS Loop stalls as Errors.

  6. yogendrajs commented on Dec 13, 2023

    @yogendrajs

    @krystofwoldrich understood, thanks. We've also used the React Native Tracing option within the Performance, but having trouble understanding how this metric will be recorded in the dashboard. Can you provide a screenshot or a sample metric displaying the same? Thanks

  7. moved this to Waiting for: Product Owner in GitHub Issues with 👀on Dec 13, 2023
  8. krystofwoldrich commented on Dec 13, 2023

    @krystofwoldrich
    Contributor

    When you open Transaction Detail you will see the stalls on the right side. Transactions are created based on screen names defined in navigation library you use.

    Stall times are displayed in milliseconds.

    Screenshot 2023-12-13 at 16 58 29

  9. 4 remaining items

  10. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀on Dec 19, 2023
  11. self-assigned this
    on Oct 27, 2026
  12. github-actions commented on Nov 5, 2026

    @github-actions
    Contributor

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #6964, which was included in the 8.34.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions