Leak in SystemJobService
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- android, kotlin
- Domain
- mobile-dev
Research direction
Start with the issue's LeakCanary trace and the SystemJobService lifecycle on Android API 23, then reproduce using WorkManager 2.5.0 and LeakCanary 2.6 with a periodic worker. Done means determining whether the retained service is a reproducible library leak and documenting or fixing the result; the issue names no source file or test.
Written by the indexing model from the issue text.
Description
Hi everyone,
we're using WorkManager in an app in which we've also LeakCanary configured and we always receive this warning after a run of each Periodic Worker:
16:49:08.888 LeakCanary
====================================
HEAP ANALYSIS RESULT
====================================
1 APPLICATION LEAKS
References underlined with "~~~" are likely causes.
Learn more at https://squ.re/leaks.
774 bytes retained by leaking objects
Signature: 6491376cfe66b1cac0d47b3ae180fd902719aa5
┬───
│ GC Root: Global variable in native code
│
├─ android.app.job.JobService$1 instance
│ Leaking: UNKNOWN
│ Retaining 802 B in 15 objects
│ Anonymous subclass of android.app.job.IJobService$Stub
│ this$0 instance of androidx.work.impl.background.systemjob.SystemJobService
│ ↓ JobService$1.this$0
│ ~~~~~~
╰→ androidx.work.impl.background.systemjob.SystemJobService instance
Leaking: YES (ObjectWatcher was watching this because androidx.work.impl.background.systemjob.SystemJobService
received Service#onDestroy() callback)
Retaining 774 B in 14 objects
key = 155d4c85-1073-4df1-bd0f-250b40c959c8
watchDurationMillis = 5248
retainedDurationMillis = 246
mApplication instance of xx.yy.MyApp
mBase instance of android.app.ContextImpl
====================================
0 LIBRARY LEAKS
A Library Leak is a leak caused by a known bug in 3rd party code that you do not have control over.
See https://square.github.io/leakcanary/fundamentals-how-leakcanary-works/#4-categorizing-leaks
====================================
0 UNREACHABLE OBJECTS
An unreachable object is still in memory but LeakCanary could not find a strong reference path
from GC roots.
====================================
METADATA
Please include this in bug reports and Stack Overflow questions.
Build.VERSION.SDK_INT: 23
Build.MANUFACTURER: alps
LeakCanary version: 2.6
App process name: xx.yy.MyApp
Stats: LruCache[maxSize=3000,hits=101,misses=300675,hitRate=0%]
RandomAccess[bytes=11383030,reads=300675,travel=696095628841,range=23369842,size=28770980]
Heap dump reason: 1 retained objects, app is not visible
Analysis duration: 202141 ms
Heap dump file path: /storage/emulated/0/Download/leakcanary-xx.yy.MyApp/2021-03-08_16-45-32_740.
hprof
Heap dump timestamp: 1615218548838
Heap dump duration: 13889 ms
====================================
WorkManager library in use: androidx.work:work-rxjava2:2.5.0
LeakCanary library in use: com.squareup.leakcanary:leakcanary-android:2.6
Any advice? Did you see this warning yet?
I don't know if can be a useful info, but the app we're developing is a system app used on embedded device (Android based, obviously)
- Dominant language
- Kotlin
- Stars
- 557
- Forks
- 242
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from android/codelab-android-workmanager
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
android/codelab-android-workmanager#261 · 1 reaction ·
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
android/codelab-android-workmanager#324 · 1 reaction ·
-
Difficulty 1/5 Under an hour Newbie friendliness 50/100
All issues in android/codelab-android-workmanager
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
johanhaleby/occurrent#1120 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
2 rename bugs Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ankidroid/Anki-Android#21999 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
openwallet-foundation/multipaz#2028 ·