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

ANR - com.applovin.impl.sdk.SessionTracker$1.onActivityResumed #698

Open
maximkir-fl opened this issue Aug 13, 2024 · 6 comments
Open

ANR - com.applovin.impl.sdk.SessionTracker$1.onActivityResumed #698

maximkir-fl opened this issue Aug 13, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@maximkir-fl
Copy link

MAX SDK Version

12.1.0

Device/Platform Info

Android 12, OnePlus

Current Behavior

Firebase crashlytics reports an ANR during application resume. The stack trace clearly shows that your SDK's code is blocking the main thread.

main (native):tid=1 systid=5812 
#00 pc 0xc9dac libc.so (__ioctl + 12) (BuildId: bbbdeb7c87c74f1491f92c6e605095b0)
#01 pc 0x83888 libc.so (ioctl + 156) (BuildId: bbbdeb7c87c74f1491f92c6e605095b0)
#02 pc 0x56044 libbinder.so (android::IPCThreadState::talkWithDriver + 292) (BuildId: 130998bfc090f1da32fe9774d36439a9)
#03 pc 0x57280 libbinder.so (android::IPCThreadState::waitForResponse + 64) (BuildId: 130998bfc090f1da32fe9774d36439a9)
#04 pc 0x56fc4 libbinder.so (android::IPCThreadState::transact + 224) (BuildId: 130998bfc090f1da32fe9774d36439a9)
#05 pc 0x4eb18 libbinder.so (android::BpBinder::transact + 312) (BuildId: 130998bfc090f1da32fe9774d36439a9)
#06 pc 0xfbb0 libsensor.so (android::BpSensorServer::createSensorEventConnection + 228) (BuildId: 4258a08232c7c78f8016f15d50d68575)
#07 pc 0x1377c libsensor.so (android::SensorManager::createEventQueue + 112) (BuildId: 4258a08232c7c78f8016f15d50d68575)
#08 pc 0x1a9400 libandroid_runtime.so ((anonymous namespace)::nativeInitSensorEventQueue + 404) (BuildId: 819617e46a856966e090e9e1d3fe76c6)
       at android.hardware.SystemSensorManager$BaseEventQueue.nativeInitBaseEventQueue(Native method)
       at android.hardware.SystemSensorManager$BaseEventQueue.<init>(SystemSensorManager.java:715)
       at android.hardware.SystemSensorManager$SensorEventQueue.<init>(SystemSensorManager.java:881)
       at android.hardware.SystemSensorManager.registerListenerImpl(SystemSensorManager.java:223)
       at android.hardware.SensorManager.registerListener(SensorManager.java:845)
       at android.hardware.SensorManager.registerListener(SensorManager.java:752)
       at com.applovin.impl.sdk.utils.q.a(SourceFile:77)
       at com.applovin.impl.sdk.utils.q.Lq(SourceFile:69)
       at com.applovin.impl.sdk.utils.q.onReceive(SourceFile:149)
       at com.applovin.impl.sdk.AppLovinBroadcastManager.sendBroadcastSync(SourceFile:232)
       at com.applovin.impl.sdk.SessionTracker.Fv(SourceFile:219)
       at com.applovin.impl.sdk.SessionTracker.AC(SourceFile:159)
       at com.applovin.impl.sdk.SessionTracker.a(unavailable)
       at com.applovin.impl.sdk.SessionTracker$1.onActivityResumed(SourceFile:69)
       at android.app.Application.dispatchActivityResumed(Application.java:430)
       at android.app.Activity.dispatchActivityResumed(Activity.java:1400)
       at android.app.Activity.onResume(Activity.java:1966)
       at androidx.fragment.app.FragmentActivity.onResume(FragmentActivity.java:310)
       at com.sample.app.MainActivity.onResume(MainActivity.kt)

Expected Behavior

Use background threads to perform any I/O-related work.

How to Reproduce

You can use the OS & device I provided in the ANR details.

Additional Info

ANR_stacktrace.txt

@maximkir-fl maximkir-fl added the bug Something isn't working label Aug 13, 2024
@maximkir-fl
Copy link
Author

The ANR originates from the session tracker feature. Do you know how I can disable it for a quick WA?

@maximkir-fl
Copy link
Author

Another Example of ANR stack trace (Android12, OnePlus Nord N200 5G):

main (native):tid=1 systid=19376 
#00 pc 0xc9dac libc.so (__ioctl + 12) (BuildId: bbbdeb7c87c74f1491f92c6e605095b0)
#01 pc 0x83888 libc.so (ioctl + 156) (BuildId: bbbdeb7c87c74f1491f92c6e605095b0)
#02 pc 0x56044 libbinder.so (android::IPCThreadState::talkWithDriver + 292) (BuildId: 130998bfc090f1da32fe9774d36439a9)
#03 pc 0x57280 libbinder.so (android::IPCThreadState::waitForResponse + 64) (BuildId: 130998bfc090f1da32fe9774d36439a9)
#04 pc 0x56fc4 libbinder.so (android::IPCThreadState::transact + 224) (BuildId: 130998bfc090f1da32fe9774d36439a9)
#05 pc 0x4eb18 libbinder.so (android::BpBinder::transact + 312) (BuildId: 130998bfc090f1da32fe9774d36439a9)
#06 pc 0xdf68 libsensor.so (android::BpSensorEventConnection::enableDisable + 236) (BuildId: 4258a08232c7c78f8016f15d50d68575)
#07 pc 0x1a97ec libandroid_runtime.so ((anonymous namespace)::nativeEnableSensor + 144) (BuildId: 819617e46a856966e090e9e1d3fe76c6)
       at android.hardware.SystemSensorManager$BaseEventQueue.nativeEnableSensor(Native method)
       at android.hardware.SystemSensorManager$BaseEventQueue.enableSensor(SystemSensorManager.java:824)
       at android.hardware.SystemSensorManager$BaseEventQueue.addSensor(SystemSensorManager.java:740)
       at android.hardware.SystemSensorManager.registerListenerImpl(SystemSensorManager.java:224)
       at android.hardware.SensorManager.registerListener(SensorManager.java:845)
       at android.hardware.SensorManager.registerListener(SensorManager.java:752)
       at com.applovin.impl.sdk.utils.q.a(SourceFile:77)
       at com.applovin.impl.sdk.utils.q.Lq(SourceFile:69)
       at com.applovin.impl.sdk.utils.q.onReceive(SourceFile:149)
       at com.applovin.impl.sdk.AppLovinBroadcastManager.sendBroadcastSync(SourceFile:232)
       at com.applovin.impl.sdk.SessionTracker.Fv(SourceFile:219)
       at com.applovin.impl.sdk.SessionTracker.AC(SourceFile:159)
       at com.applovin.impl.sdk.SessionTracker.a(unavailable)
       at com.applovin.impl.sdk.SessionTracker$1.onActivityResumed(SourceFile:69)
       at android.app.Application.dispatchActivityResumed(Application.java:430)
       at android.app.Activity.dispatchActivityResumed(Activity.java:1400)
       at android.app.Activity.onResume(Activity.java:1966)
       at com.google.android.gms.ads.AdActivity.onResume(com.google.android.gms:play-services-ads-lite@@22.6.0)
       at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1491)
       at android.app.Activity.performResume(Activity.java:8280)
       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4925)
       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4974)
       at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:60)
       at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2345)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:233)
       at android.os.Looper.loop(Looper.java:344)
       at android.app.ActivityThread.main(ActivityThread.java:8212)
       at java.lang.reflect.Method.invoke(Native method)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)
        

@richashukla23 richashukla23 self-assigned this Aug 13, 2024
@richashukla23
Copy link
Contributor

@maximkir-fl You seem to be on an older SDK version. Are you able to upgrade to latest and check?

@maximkir-fl
Copy link
Author

Hi @richashukla23, Is your suggestion based on a fix added to the newest release?

@thomasmso
Copy link
Member

@maximkir-fl - actually, to enable the fix you need to set an extra parameter as I demonstrate below, won't affect your integration.

        val settings = AppLovinSdk.getInstance( this ).getSettings();
        settings.setExtraParameter( "disable_sensor_data_collection", "true" );
        
        val initConfig = AppLovinSdkInitializationConfiguration.builder( "YOUR_SDK_KEY", this )
                .setMediationProvider( AppLovinMediationProvider.MAX )
                .build();

        AppLovinSdk.getInstance( this ).initialize( initConfig, config -> {
            ...
        } );

@Lorenzo45 Lorenzo45 assigned Lorenzo45 and unassigned richashukla23 Sep 6, 2024
@maximkir-fl
Copy link
Author

maximkir-fl commented Dec 1, 2024

@Lorenzo45, @thomasmso, I Followed your suggestion to disable the sensor data collection; now, the sensor interaction is reported as ANR (Android 13, Galaxy A13).

main (native):tid=1 systid=8612
#00 pc 0x9e5f0 libc.so (__ioctl + 8) (BuildId: e00cdd3a04a463527b3eb5e9f99a3dcb)
#01 pc 0x698eb libc.so (ioctl + 26) (BuildId: e00cdd3a04a463527b3eb5e9f99a3dcb)
#02 pc 0x40941 libbinder.so (android::IPCThreadState::talkWithDriver + 216) (BuildId: 81f888cf569f1cfa1c9a9e924878f182)
#03 pc 0x416c5 libbinder.so (android::IPCThreadState::waitForResponse + 44) (BuildId: 81f888cf569f1cfa1c9a9e924878f182)
#04 pc 0x41463 libbinder.so (android::IPCThreadState::transact + 134) (BuildId: 81f888cf569f1cfa1c9a9e924878f182)
#05 pc 0x3b971 libbinder.so (android::BpBinder::transact + 120) (BuildId: 81f888cf569f1cfa1c9a9e924878f182)
#06 pc 0xab31 libsensor.so (android::BpSensorServer::createSensorEventConnection + 148) (BuildId: f00ab6edec6edbeaa3341cfeab3b79c9)
#07 pc 0xcfbd libsensor.so (android::SensorManager::createEventQueue + 72) (BuildId: f00ab6edec6edbeaa3341cfeab3b79c9)
#08 pc 0x12ea59 libandroid_runtime.so ((anonymous namespace)::nativeInitSensorEventQueue + 240) (BuildId: 8a2ff2f752a1e23bae74caaa3d9258ac)
       at android.hardware.SystemSensorManager$BaseEventQueue.nativeInitBaseEventQueue(Native method)
       at android.hardware.SystemSensorManager$BaseEventQueue.<init>(SystemSensorManager.java:785)
       at android.hardware.SystemSensorManager$SensorEventQueue.<init>(SystemSensorManager.java:927)
       at android.hardware.SystemSensorManager.registerListenerImpl(SystemSensorManager.java:239)
       at android.hardware.SensorManager.registerListener(SensorManager.java:869)
       at android.hardware.SensorManager.registerListener(SensorManager.java:776)
       at com.applovin.impl.sdk.utils.k.Lm(SourceFile:58)
       at com.applovin.impl.sdk.utils.k.onReceive(SourceFile:119)
       at com.applovin.impl.sdk.AppLovinBroadcastManager.sendBroadcastSync(SourceFile:232)
       at com.applovin.impl.sdk.SessionTracker.Fv(SourceFile:219)
       at com.applovin.impl.sdk.SessionTracker.AC(SourceFile:159)
       at com.applovin.impl.sdk.SessionTracker.a(unavailable)
       at com.applovin.impl.sdk.SessionTracker$1.onActivityResumed(SourceFile:69)
       at android.app.Application.dispatchActivityResumed(Application.java:450)
       at android.app.Activity.dispatchActivityResumed(Activity.java:1482)
       at android.app.Activity.onResume(Activity.java:2043)
       at com.applovin.adview.AppLovinFullscreenActivity.onResume(unavailable)
       at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1531)
       at android.app.Activity.performResume(Activity.java:8734)
       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5351)
       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5444)
       at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:54)
       at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2574)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.app.ActivityThread.main(ActivityThread.java:8757)
       at java.lang.reflect.Method.invoke(Native method)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
        

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants