square / leakcanary

A memory leak detection library for Android.

Home Page:https://square.github.io/leakcanary

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Couldn't open dumped heap - due to missing read/write permissions

sylwek845 opened this issue · comments

Description

[Description of the issue]

Steps to Reproduce

No easy steps to reproduce. We use additional tool to shield our apk, and it seems to only happen after the app is shielded. It fails on reading the file back, when inspecting the .hprof file in cache, I noticed that it has no permissions -------- instead of --rw---- which causes the analysis to fail. We see this behaviour for all libs (startup/release/integration).

java.lang.RuntimeException: Couldn't dump heap; open("/Download/heap-cabfe654-e799-444e-9f81-fcdf83a100f3.hprof") failed: No such file or directory
                                                 	at dalvik.system.VMDebug.dumpHprofData(Native Method)
                                                 	at dalvik.system.VMDebug.dumpHprofData(VMDebug.java:544)
                                                 	at dalvik.system.VMDebug.dumpHprofData(VMDebug.java:514)
                                                 	at android.os.Debug.dumpHprofData(Debug.java:2045)
                                                 	at leakcanary.internal.RealHeapAnalysisJob.dumpHeap(RealHeapAnalysisJob.kt:222)
                                                 	at leakcanary.internal.RealHeapAnalysisJob.dumpAndAnalyzeHeap(RealHeapAnalysisJob.kt:128)
                                                 	at leakcanary.internal.RealHeapAnalysisJob.proceed(RealHeapAnalysisJob.kt:94)
                                                 	at com.deliveroo.driverapp.leakdetection.LeakDetector.flagInterceptor$lambda$0(LeakDetector.kt:25)
                                                 	at com.deliveroo.driverapp.leakdetection.LeakDetector.$r8$lambda$uBvd7p0R3jfd7fLgl-Kn5i6Pc9Y(Unknown Source:0)
                                                 	at com.deliveroo.driverapp.leakdetection.LeakDetector$$ExternalSyntheticLambda1.intercept(Unknown Source:0)
                                                 	at leakcanary.internal.RealHeapAnalysisJob.proceed(RealHeapAnalysisJob.kt:91)
                                                 	at leakcanary.internal.RealHeapAnalysisJob.execute(RealHeapAnalysisJob.kt:69)
                                                 	at leakcanary.BackgroundTrigger$backgroundListener$1$2.run(BackgroundTrigger.kt:46)
                                                 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
                                                 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
                                                 	at com.deliveroo.driverapp.leakdetection.LeakDetector$analysisExecutor$1$1.invoke(LeakDetector.kt:33)
                                                 	at com.deliveroo.driverapp.leakdetection.LeakDetector$analysisExecutor$1$1.invoke(LeakDetector.kt:31)
                                                 	at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)
                                                 ====================================
                                                 METADATA
                                                 
                                                 Build.VERSION.SDK_INT: 31
                                                 Build.MANUFACTURER: samsung
                                                 LeakCanary version: Unknown
                                                 Analysis duration: 0 ms
                                                 Heap dump file path: /Download/heap-cabfe654-e799-444e-9f81-fcdf83a100f3.hprof
                                                 Heap dump timestamp: 1697453077916
                                                 ====================================, stripHeapDumpDurationMillis=null)

Version Information

  • LeakCanary version: 2.12
  • Android OS version: Any
  • Gradle version: 8.1.2

Additional Information

Setting the permission after creating the file seems to be fixing the issue.

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

still investigating if the issue is not on my end.