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

DiskReadViolation when calling LeakCanary.setConfig() in Application.onCreate() #2117

Closed
mhernand40 opened this issue Apr 27, 2021 · 4 comments

Comments

@mhernand40
Copy link

Description

Our app is using LeakCanary 2.6 and upon launch after a clean install, on my Pixel 2XL test device, when observing Logcat errors, I saw the following stack trace from our base application's onCreate():

2021-04-27 15:57:30.506 15134-15352/com.tinder E/StrictMode: StrictMode policy violation
    android.os.strictmode.DiskReadViolation
        at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1596)
        at android.app.SharedPreferencesImpl.awaitLoadedLocked(SharedPreferencesImpl.java:275)
        at android.app.SharedPreferencesImpl.getBoolean(SharedPreferencesImpl.java:344)
        at leakcanary.internal.InternalLeakCanary.getDumpEnabledInAboutScreen$leakcanary_android_core_release(InternalLeakCanary.kt:116)
        at leakcanary.internal.HeapDumpControl.iCanHasHeap(HeapDumpControl.kt:56)
        at leakcanary.internal.HeapDumpControl.updateICanHasHeap(HeapDumpControl.kt:48)
        at leakcanary.LeakCanary.setConfig(LeakCanary.kt:299)

Steps to Reproduce

No sample project at the moment.

Version Information

  • LeakCanary version: 2.6
  • Android OS version: 11
  • Gradle version: 6.8.3
@mhernand40
Copy link
Author

Not really sure if there is much to be done since this seems to be more of a SharedPreferences issue during the first initial load of SharedPreferences but figured I'd call it out.

@pyricau
Copy link
Member

pyricau commented Apr 28, 2021

Thx! Can you upgrade to 2.7 and check if it still happens? We def can get this fixed.

@mhernand40
Copy link
Author

Just updated to 2.7 and I am still seeing the same stack trace upon a cold launch after a clean install:

2021-04-29 16:50:03.732 26184-26383/com.tinder E/StrictMode: StrictMode policy violation
    
    android.os.strictmode.DiskReadViolation
        at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1596)
        at android.app.SharedPreferencesImpl.awaitLoadedLocked(SharedPreferencesImpl.java:275)
        at android.app.SharedPreferencesImpl.getBoolean(SharedPreferencesImpl.java:344)
        at leakcanary.internal.InternalLeakCanary.getDumpEnabledInAboutScreen$leakcanary_android_core_release(InternalLeakCanary.kt:116)
        at leakcanary.internal.HeapDumpControl.iCanHasHeap(HeapDumpControl.kt:56)
        at leakcanary.internal.HeapDumpControl.updateICanHasHeap(HeapDumpControl.kt:48)
        at leakcanary.LeakCanary.setConfig(LeakCanary.kt:299)
        at com.tinder.application.DebugTinderBaseApplication.configureLeakCanary(DebugTinderApplication.kt:84)
        at com.tinder.application.TinderApplication.onCreate(TinderApplication.kt:92)
        at com.tinder.application.DebugTinderBaseApplication.onCreate(DebugTinderApplication.kt:58)
        at com.tinder.application.Hilt_DebugTinderApplication.onCreate(Hilt_DebugTinderApplication.java:43)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6712)
        at android.app.ActivityThread.access$1300(ActivityThread.java:237)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

@mcarare
Copy link

mcarare commented Jan 7, 2022

This still happens in 2.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants