Skip to content

Extremely long auto transactions for react-navigation on AndroidTV/FireTV #4963

@pkaneriendeavor

Description

@pkaneriendeavor

What React Native libraries do you use?

React Navigation

Are you using sentry.io or on-premise?

sentry.io (SaS)

@sentry/react-native SDK Version

6.16

How does your development environment look like?

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

Binaries:
  Node:
    version: 20.12.2
    path: ~/.nvm/versions/node/v20.12.2/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.5.0
    path: ~/.nvm/versions/node/v20.12.2/bin/npm
  Watchman: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK:
    API Levels:
      - "28"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 28.0.3
      - 29.0.3
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 32.0.0
      - 32.1.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
      - 35.0.0
    System Images:
      - android-31 | Google TV ARM 64 v8a
      - android-32 | Google APIs ARM 64 v8a
      - android-33 | Android TV ARM 64 v8a
      - android-33 | Google TV ARM 64 v8a
      - android-34 | Android TV ARM 64 v8a
      - android-34 | Google TV ARM 64 v8a
      - android-Tiramisu | Google TV ARM 64 v8a
    Android NDK: 19.2.5345600
IDEs:
  Android Studio: 2024.3 AI-243.24978.46.2431.13208083
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.18
    path: /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/javac
npmPackages:
  "@react-native-community/cli":
    installed: 14.0.1
    wanted: ^14.0.0
  react:
    installed: 18.3.1
    wanted: ^18.2.0
  react-native: Not Found
  react-native-macos: Not Found
  react-native-tvos:
    installed: 0.77.2-0
    wanted: 0.77.2-0
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false


Sentry.init()

Sentry.init({
  enabled: process.env.NODE_ENV !== 'development',
    dsn: sentrySettings.dsn,
    environment: process.env.NODE_ENV,
    integrations: [
      routingInstrumentation,
      reactNativeTracingIntegration({
        shouldCreateSpanForRequest,
        idleTimeoutMs: Platform.OS === 'android' ? 2000 : undefined,
        finalTimeoutMs:  60000,
      }),
    ],
    beforeSend: (event, hint) => {
      const error = hint.originalException as Error;
      const shouldSendLog = !SENTRY_IGNORE_RULES.some(
        ({ type: ruleType, value: ruleValue }) => ruleType === error.name && ruleValue === error.message
      );

      // Returning null here drops the event
      if (!shouldSendLog) return null;

      return event;
    },
    beforeSendTransaction(event, _hint) {
      // The finalTimeoutMs value set in the integration doesn't seem to remove all long transactions.
      // This is used as a fallback so we don't send transactions longer than the one set in finalTimeoutMs.
      if (event?.timestamp - event?.start_timestamp > finalTimeoutMs) return null;
      return event;
    },
    tracesSampler,
    enableAppStartTracking: true,
    enableAutoPerformanceTracing: true,
});

Steps to Reproduce

We are using react-native-tvos to create an Android and FireTV build. It's a fairly standard setup but we are seeing occasional extremely long transaction times in the hours like below when integrating the react-navigation using the latest react-native-sentry library:

Image

Tricky to know how to exactly reproduce this but I would have thought it shouldn't be possible because of the finalTimeoutMs.

It seems almost identical to the issue posted previously here #3835

Expected Result

Transactions with a maximum of 60 seconds.

Actual Result

Transactions in the hours.

Metadata

Metadata

Assignees

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions