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

In situations where the network is slow, ANR often occurs #2649

Closed
yaohuzhou opened this issue Apr 12, 2023 · 9 comments · Fixed by #2691
Closed

In situations where the network is slow, ANR often occurs #2649

yaohuzhou opened this issue Apr 12, 2023 · 9 comments · Fixed by #2691
Assignees
Labels
Platform: Android Type: Bug Something isn't working

Comments

@yaohuzhou
Copy link

Integration

sentry-android

Build System

Gradle

AGP Version

7.3.1

Proguard

Disabled

Version

6.17.0

Steps to Reproduce

Reproduction steps:

1. Initialize SDK.

`class TestApplication : Application() {

override fun onCreate() {
    super.onCreate()
    SentryAndroid.init(this) { options ->
        options.isDebug = BuildConfig.DEBUG
        options.dsn = "https://examplePublicKey@o0.ingest.sentry.io/0"
        options.isEnableSystemEventBreadcrumbs = false
        options.isEnableUncaughtExceptionHandler = true
        options.isEnableNdk = true
        options.isAnrEnabled = true
        options.maxRequestBodySize = SentryOptions.RequestSize.MEDIUM
        options.isAnrReportInDebug = false
        options.tracesSampleRate = 1.0
        options.profilesSampleRate = 1.0
    }
}

}`

2.Simulate a weak network environment using Charles proxy.
Throttle Settings-> Bandwidth (kbps): Download = 1 Upload = 1
Start Throttling

3.Repeat opening the app multiple times and wait for about 20 seconds.

4.ANR

image

Expected Result

There will be no ANR.

Actual Result

ANR often occurs.

image

@yaohuzhou
Copy link
Author

The bug can be reproduced using the demo.
Demo.zip

Charles Throttle Settings
image

@romtsn
Copy link
Member

romtsn commented Apr 12, 2023

@yaohuzhou hi, thanks for the report. Can you share the full stacktrace/thread dump of the ANR please? It's not clear why you think our SDK is the cause.

@yaohuzhou
Copy link
Author

@yaohuzhou hi, thanks for the report. Can you share the full stacktrace/thread dump of the ANR please? It's not clear why you think our SDK is the cause.
anr_2023-04-13.txt
I hope this log file is helpful for you.

@romtsn romtsn self-assigned this Apr 19, 2023
@yaohuzhou
Copy link
Author

yaohuzhou commented Apr 27, 2023 via email

@helloword1
Copy link

I have the same problem:

sun.misc.Unsafe.park(Native Method)
2
java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
3
java.util.concurrent.FutureTask.awaitDone(FutureTask.java:450)
4
java.util.concurrent.FutureTask.get(FutureTask.java:192)
5
io.sentry.android.core.AndroidTransactionProfiler.onTransactionFinish(AndroidTransactionProfiler.java:263)
6
io.sentry.SentryTracer.finish(SentryTracer.java:391)
7
io.sentry.SentryTracer.finish(SentryTracer.java:350)
8
io.sentry.android.core.ActivityLifecycleIntegration.finishTransaction(ActivityLifecycleIntegration.java:332)
9
io.sentry.android.core.ActivityLifecycleIntegration.stopTracing(ActivityLifecycleIntegration.java:305)
10
io.sentry.android.core.ActivityLifecycleIntegration.onActivityDestroyed(ActivityLifecycleIntegration.java:458)
11
android.app.Application.dispatchActivityDestroyed(Application.java:579)
12
android.app.Activity.dispatchActivityDestroyed(Activity.java:1591)
13
android.app.Activity.onDestroy(Activity.java:2775)
14
androidx.fragment.app.FragmentActivity.onDestroy(FragmentActivity.java:258)

@helloword1
Copy link

我今天也遇到这个问题,降到6.16.0也一样

@kahest
Copy link
Member

kahest commented Apr 27, 2023

cc @stefanosiano since this seems to be related to the Profiler

@helloword1
Copy link

这个文件:AndroidTransactionProfiler 260行使用线程池的submit()方法,再get的时候会阻塞子线程,导致卡顿。

@stefanosiano
Copy link
Member

@kahest @helloword1 @yaohuzhou I'll have a look at it soon.
Thanks for all the feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android Type: Bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants