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

!!Heap Dump file Crash #2075

Closed
xiaoyaomeng opened this issue Feb 20, 2021 · 3 comments · Fixed by #2098
Closed

!!Heap Dump file Crash #2075

xiaoyaomeng opened this issue Feb 20, 2021 · 3 comments · Fixed by #2098
Milestone

Comments

@xiaoyaomeng
Copy link

xiaoyaomeng commented Feb 20, 2021

Description

In Android 10, Log:

2021-02-20 09:55:35.841 17079-11470/xxx.xxxx.xxx E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #32
    Process: xxx.xxxx.xxx, PID: 17079
    java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/xxx.xxxx.xxx/cache/leakcanary/2021-02-20_09-49-25_148.hprof
        at leakcanary.internal.LeakCanaryFileProvider$SimplePathStrategy.getUriForFile(LeakCanaryFileProvider.kt:319)
        at leakcanary.internal.LeakCanaryFileProvider$Companion.getUriForFile(LeakCanaryFileProvider.kt:412)
        at leakcanary.internal.activity.LeakViewsKt$shareHeapDump$1.run(LeakViews.kt:34)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)
2021-02-20 09:55:36.844 17079-11470/xxx.xxxx.xxx E/APP: (CrashHandler.java:33) uncaughtException GlipUncaughtException 
    java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/xxx.xxxx.xxx/cache/leakcanary/2021-02-20_09-49-25_148.hprof
        at leakcanary.internal.LeakCanaryFileProvider$SimplePathStrategy.getUriForFile(LeakCanaryFileProvider.kt:319)
        at leakcanary.internal.LeakCanaryFileProvider$Companion.getUriForFile(LeakCanaryFileProvider.kt:412)
        at leakcanary.internal.activity.LeakViewsKt$shareHeapDump$1.run(LeakViews.kt:34)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)

I found that every time I click Share Heap Dump file, it will crash. The Log is as follows. I checked Leakcannary's code and found that it is because there is no cache path directory in the root path xml (leak_canary_file_paths.xml). When leakcanary.internal.LeakDirectoryProvider#newHeapDumpFile dumped the file, it was found that the downloads did not have the write permission, and they were finally put in the cache path.

So this bug occurred. I have forcibly replaced the leakcanary xml in the app with my own xml to solve this problem, but I hope the official can also modify the xml configuration or the code of newHeapDumpFile.

Steps to Reproduce

[Provide a sample project, a .hprof file or a failing test]

  1. [First Step]

  2. [Second Step]

  3. [and so on...]

Expected behavior: [What you expect to happen]

Version Information

  • LeakCanary version:
  • Android OS version:
  • Gradle version:

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.

@pyricau
Copy link
Member

pyricau commented Feb 28, 2021

How should we handle this?

@xiaoyaomeng
Copy link
Author

xiaoyaomeng commented Mar 1, 2021

How should we handle this?

You handle it , just only edit 'leak_canary_file_paths.xml'

Add root path:
<cache-path name="leakcanary_cache" path="leakcanary/" />

pyricau added a commit that referenced this issue Mar 25, 2021
@pyricau pyricau added this to the 2.7 milestone Mar 25, 2021
@xiaoyaomeng
Copy link
Author

okay,thx

ghost pushed a commit to shivagowda/leakcanary that referenced this issue Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants