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

Infinite looping on app startup #3205

Closed
5 of 11 tasks
nandorojo opened this issue Jul 20, 2023 · 7 comments
Closed
5 of 11 tasks

Infinite looping on app startup #3205

nandorojo opened this issue Jul 20, 2023 · 7 comments
Labels
Expo Issues related to Sentry React Native Expo support Platform: React-Native Type: 🪲 Bug

Comments

@nandorojo
Copy link

nandorojo commented Jul 20, 2023

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

SDK:

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

SDK version: 5.5.0

react-native version: 0.72.3

Are you using Expo?

  • Yes
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • on-premise

If you are using sentry.io, please post a link to your issue so we can take a look:

Configuration:

(@sentry/react-native)

import * as Sentry from 'sentry-expo'

const dsn = process.env.EXPO_SENTRY_DSN

Sentry.init({
  dsn,
  enableInExpoDevelopment: true,
  debug: __DEV__
})

I have following issue:

Sentry is infinitely looping with an app startup log. Refreshing my development client fixes it. It only happens when I open it for the first time.

Screenshot.-.20.July.2023.mp4

This started after upgrading to SDK 49.

Steps to reproduce:

I'm not sure how to reproduce this, or why it's happening.

Actual result:

Infinite looping.

Expected result:

No infinite looping.

@krystofwoldrich
Copy link
Member

Hi,
thank you for the message,
this is caused by capturing HTTP spans of the Expo dev server.

You can fix it like this:

https://docs.expo.dev/guides/using-sentry/#troubleshooting

import * as Sentry from 'sentry-expo';
import * as Network from 'expo-network';

const devServerPort = 8081;
let devServerIpAddress: string | null = null;
Network.getIpAddressAsync().then(ip => {
  devServerIpAddress = ip;
});

Sentry.init({
  tracesSampleRate: 1.0,
  integrations: [
    new Sentry.Native.ReactNativeTracing({
      shouldCreateSpanForRequest: url => {
        return !__DEV__ || !url.startsWith(`http://${devServerIpAddress}:${devServerPort}/logs`);
      },
    }),
  ],
});

@lindan4
Copy link

lindan4 commented Sep 6, 2023

@krystofwoldrich The fix doesn't seem to work for me. I still get the infinite logs.

@nandorojo
Copy link
Author

same here.

1 similar comment
@gloredo
Copy link

gloredo commented Sep 18, 2023

same here.

@krystofwoldrich
Copy link
Member

Thank you for the comments.

Could anyone check what are the HTTP requests causing the issue? Note you might need to adjust the devServerPort or remove it from like this:

import * as Sentry from 'sentry-expo';
import * as Network from 'expo-network';

let devServerIpAddress: string | null = null;
Network.getIpAddressAsync().then(ip => {
  devServerIpAddress = ip;
});

Sentry.init({
  tracesSampleRate: 1.0,
  integrations: [
    new Sentry.Native.ReactNativeTracing({
      shouldCreateSpanForRequest: url => {
        return !__DEV__ || !url.startsWith(`http://${devServerIpAddress}`);
      },
    }),
  ],
});

Does the new snippet fix the code?

@gloredo
Copy link

gloredo commented Sep 29, 2023

Thank you for the comments.

Could anyone check what are the HTTP requests causing the issue? Note you might need to adjust the devServerPort or remove it from like this:

import * as Sentry from 'sentry-expo';
import * as Network from 'expo-network';

let devServerIpAddress: string | null = null;
Network.getIpAddressAsync().then(ip => {
  devServerIpAddress = ip;
});

Sentry.init({
  tracesSampleRate: 1.0,
  integrations: [
    new Sentry.Native.ReactNativeTracing({
      shouldCreateSpanForRequest: url => {
        return !__DEV__ || !url.startsWith(`http://${devServerIpAddress}`);
      },
    }),
  ],
});

Does the new snippet fix the code?

It works! Thx @krystofwoldrich

expo start -c:
iOS

 LOG  Sentry Logger [log]: Integration installed: ModulesLoader
 LOG  Sentry Logger [log]: Unhandled promise rejections will be caught by Sentry.
 LOG  Sentry Logger [log]: Integration installed: ReactNativeErrorHandlers
 LOG  Sentry Logger [log]: Integration installed: Release
 LOG  Sentry Logger [log]: Integration installed: InboundFilters
 LOG  Sentry Logger [log]: Integration installed: FunctionToString
 LOG  Sentry Logger [log]: Integration installed: Breadcrumbs
 LOG  Sentry Logger [log]: Integration installed: LinkedErrors
 LOG  Sentry Logger [log]: Integration installed: Dedupe
 LOG  Sentry Logger [log]: Integration installed: HttpContext
 LOG  Sentry Logger [log]: Integration installed: EventOrigin
 LOG  Sentry Logger [log]: Integration installed: SdkInfo
 LOG  Sentry Logger [log]: Integration installed: ReactNativeInfo
 LOG  Sentry Logger [log]: Integration installed: DebugSymbolicator
 LOG  Sentry Logger [log]: Integration installed: RewriteFrames
 LOG  Sentry Logger [log]: Integration installed: DeviceContext
 LOG  Sentry Logger [log]: [ReactNativeTracing] Native frames instrumentation initialized.
 LOG  Sentry Logger [log]: [ReactNativeTracing] Not instrumenting route changes as routingInstrumentation has not been set.
 LOG  Sentry Logger [log]: Integration installed: ReactNativeTracing
 LOG  Sentry Logger [log]: Integration installed: ExpoBareIntegration
 LOG  Sentry Logger [log]: Setting idle transaction on scope. Span ID: 9fedaf8f2c349972
 LOG  Sentry Logger [log]: [Tracing] starting ui.load transaction - App Start
 LOG  Sentry Logger [log]: Starting heartbeat
 LOG  Sentry Logger [log]: pinging Heartbeat -> current counter: 0
 LOG  Sentry Logger [log]: [ReactNativeTracing] Starting ui.load transaction "App Start" on scope
 LOG  Sentry Logger [log]: [Tracing] Starting 'app.start.warm' span on transaction 'App Start' (9fedaf8f2c349972).
 LOG  Sentry Logger [log]: [Tracing] finishing IdleTransaction 2023-09-29T15:13:27.624Z ui.load
 LOG  Sentry Logger [log]: [StallTracking] Stall measurements were not added to transaction due to exceeding the max count.
 LOG  Sentry Logger [log]: [Tracing] flushing IdleTransaction
 LOG  Sentry Logger [log]: [Measurements] Adding measurements to transaction {
  "app_start_warm": {
    "value": 32896.54296875,
    "unit": "millisecond"
  }
}
 LOG  Sentry Logger [log]: [Tracing] Finishing ui.load transaction: App Start.
 LOG  Sentry Logger [log]: [NativeFrames] Native frames timed out for ui.load transaction App Start. Not adding native frames measurements.

Android

 LOG  Sentry Logger [log]: Integration installed: ModulesLoader
 LOG  Sentry Logger [log]: Unhandled promise rejections will be caught by Sentry.
 LOG  Sentry Logger [log]: Integration installed: ReactNativeErrorHandlers
 LOG  Sentry Logger [log]: Integration installed: Release
 LOG  Sentry Logger [log]: Integration installed: InboundFilters
 LOG  Sentry Logger [log]: Integration installed: FunctionToString
 LOG  Sentry Logger [log]: Integration installed: Breadcrumbs
 LOG  Sentry Logger [log]: Integration installed: LinkedErrors
 LOG  Sentry Logger [log]: Integration installed: Dedupe
 LOG  Sentry Logger [log]: Integration installed: HttpContext
 LOG  Sentry Logger [log]: Integration installed: EventOrigin
 LOG  Sentry Logger [log]: Integration installed: SdkInfo
 LOG  Sentry Logger [log]: Integration installed: ReactNativeInfo
 LOG  Sentry Logger [log]: Integration installed: DebugSymbolicator
 LOG  Sentry Logger [log]: Integration installed: RewriteFrames
 LOG  Sentry Logger [log]: Integration installed: DeviceContext
 LOG  Sentry Logger [log]: [ReactNativeTracing] Native frames instrumentation initialized.
 LOG  Sentry Logger [log]: [ReactNativeTracing] Not instrumenting route changes as routingInstrumentation has not been set.
 LOG  Sentry Logger [log]: Integration installed: ReactNativeTracing
 LOG  Sentry Logger [log]: Integration installed: ExpoBareIntegration

[Update]

On Android when Dev Client App is restarted the lopping occurs and after some time return the error:

ERROR  Sentry Logger [error]: Error while sending event: [Error: Exception in HostFunction: Malformed calls from JS: field sizes are different.

[[10,26],[1,0],[[11473,100,1696006958024,false]],13142]]

@krystofwoldrich
Copy link
Member

@gloredo Thanks, happy to hear the fix works.

@kahest kahest added the Expo Issues related to Sentry React Native Expo support label Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Expo Issues related to Sentry React Native Expo support Platform: React-Native Type: 🪲 Bug
Projects
Archived in project
Archived in project
Development

No branches or pull requests

5 participants