-
-
Notifications
You must be signed in to change notification settings - Fork 435
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
Initializing the SDK more than once could causes an ANR #2576
Comments
I assume this is not a crash, but an ANR, looking at the stacktrace? Also, it looks like you're initializing Sentry inside |
Hi @romtsn , yes it is an ANR(Updated the title). Our app is in react-native and one sdk is in Java(Android). We are using sentry in both and both are pointing to different sentry projects. The ANR is in the sdk. We can't use |
Have you followed the manual setup steps for RN when setting up both SDKs? |
Yes, for RN, we are using Autolinking as mentioned in the doc |
@nandanxyz By default, the Android SDK is initialized automatically by the RN SDK. You can disable that and initialize the Android SDK manually. Are you using the |
Hi @krystofwoldrich , no we are not using |
@krystofwoldrich could you please take a look at this again? |
Just to recap, This should be possible, but we have not tested this scenario. You would need to disable the native layer in the RN SDK (note that you might lose a lot of the SDK features depending on the Android SDK) and then initialize the Android SDK separately. As you mentioned that you don't use Could running init twice for the Android SDK be a problem @romtsn? If you want to use all the features of the RN SDK the Android SDK needs to point to the same DSN. Could you share code snippets of how you initialize both SDKs? |
Thank you @krystofwoldrich On React-Native: const routingInstrumentation = new Sentry.ReactNavigationInstrumentation();
Sentry.init({
dsn: <DSN-1>,
tracesSampleRate: 0.3,
integrations: [
new Sentry.ReactNativeTracing({
idleTimeout: 5000,
routingInstrumentation,
tracingOrigins: ["localhost", /^\//, /^https:\/\//]
})
],
release: `${APPLICATIONID}@${DeviceInfo?.getVersion()}+${DeviceInfo?.getBuildNumber()}`,
dist: DeviceInfo?.getBuildNumber()
}); On Android: <meta-data android:name="io.sentry.auto-init" android:value="false" />
<provider
android:name="io.sentry.android.core.SentryInitProvider"
android:authorities="${applicationId}.SentryInitProvider"
tools:node="remove" />
<provider
android:name="io.sentry.android.core.SentryPerformanceProvider"
android:authorities="${applicationId}.SentryPerformanceProvider"
tools:node="remove" /> and, SentryAndroid.init(mContext, options -> {
options.setDsn(<DSN-2>);
options.setTracesSampleRate(1.0);
options.setEnableUserInteractionTracing(true);
options.setAnrEnabled(true);
options.setEnvironment(<ENV-name>);
options.setBeforeSend((event, hint) -> {
String environment = event.getEnvironment();
if (environment == null || environment.equals("TEST")) {
return null;
} else if(environment.equals(<ENV-name>)){
return event;
}else{
return null;
}
});
}); |
Yes, we do not recommend doing that, as there might be unpredictable consequences (like this issue). For the same reason we require to disable However, I'm thinking we should still avoid this blocking transport termination on Android, or at least offload this to another thread when |
We are getting this error. We have a multi-module application. Every module is using :base module and we have :app module.
We used this plugin in both of base and app module. Maybe we can only describe in :app module. If I remove usage of plugin in base module. Can I solve this problem? |
For the upcoming 7.0 release we reduced the flush timeouts (see #2858) |
I believe this was resolved by #3200 |
Integration
sentry-android
Build System
Gradle
AGP Version
7.2.1
Proguard
Enabled
Version
6.7.1
Steps to Reproduce
We are getting this issue on different devices in Firebase:
The text was updated successfully, but these errors were encountered: