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

1.6.0 Job initialization triggers a main thread disk read (Android JVM) #3180

Closed
radixdev opened this issue Feb 9, 2022 · 7 comments
Closed
Labels

Comments

@radixdev
Copy link

radixdev commented Feb 9, 2022

Android Strictmode is stating that the initialization path of any created Job is triggering expensive disk reads (on the main thread). This behavior was introduced in 1.6.0 in this PR.

Simply calling .launch { } on the CoroutineScope is enough to trigger this disk read issue. I propose that the eager uncaught exception logic is configurable behind a system property or in some way configurable to avoid this issue. Additionally, this code is running as part of an SDK so we cannot completely control when it is executed as if we were the host application.

@nreid260

Custom CoroutineScope

object CompanyCoroutineScope : CoroutineScope {
    private val exceptionHandler = CoroutineExceptionHandler { _, e ->
        companylog(E, e) { "Child job of CompanyCoroutineScope got exception: $e" }
    }

    override val coroutineContext: CoroutineContext = Dispatchers.IO + exceptionHandler + SupervisorJob()
}

The disk reads

2022-02-09 15:05:07.077 21991-21991/com.company.sample D/StrictMode: StrictMode policy violation; ~duration=286 ms: android.os.strictmode.DiskReadViolation
        at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1659)
        at java.io.UnixFileSystem.getLastModifiedTime(UnixFileSystem.java:289)
        at java.io.File.lastModified(File.java:937)
        at java.util.zip.ZipFile.<init>(ZipFile.java:265)
        at java.util.zip.ZipFile.<init>(ZipFile.java:187)
        at java.util.jar.JarFile.<init>(JarFile.java:169)
        at java.util.jar.JarFile.<init>(JarFile.java:106)
        at libcore.io.ClassPathURLStreamHandler.<init>(ClassPathURLStreamHandler.java:46)
        at dalvik.system.DexPathList$Element.maybeInit(DexPathList.java:750)
        at dalvik.system.DexPathList$Element.findResource(DexPathList.java:777)
        at dalvik.system.DexPathList.findResources(DexPathList.java:572)
        at dalvik.system.BaseDexClassLoader.findResources(BaseDexClassLoader.java:279)
        at java.lang.ClassLoader.getResources(ClassLoader.java:839)
        at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:349)
        at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:402)
        at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:488)
        at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:786)
        at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:816)
        at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:807)
        at kotlinx.coroutines.CoroutineExceptionHandlerImplKt.<clinit>(CoroutineExceptionHandlerImpl.kt:23)
        at kotlinx.coroutines.CoroutineExceptionHandlerImplKt.initializeDefaultExceptionHandlers(CoroutineExceptionHandlerImpl.kt:27)
        at kotlinx.coroutines.Job.<clinit>(Job.kt:120)
        at kotlinx.coroutines.AbstractCoroutine.<init>(AbstractCoroutine.kt:51)
        at kotlinx.coroutines.StandaloneCoroutine.<init>(Builders.common.kt:190)
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:55)
        at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1)
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47)
        at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source:1)
        at com.company.images.DefaultCompanyImageLoader.initDiskCacheTask(DefaultCompanyImageLoader.kt:213)
        at com.company.images.DefaultCompanyImageLoader.<init>(DefaultCompanyImageLoader.kt:53)
        at com.company.Company.<init>(Company.java:230)
        at com.company.Company.<init>(Company.java:18)
        at com.company.Company.getInstance(Company.java:193)
        at com.company.Company.getInstance(Company.java:22)
        at com.company.sample.CompanyApplication.onCreate(CompanyApplication.kt:76)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1211)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6725)
        at android.app.ActivityThread.access$1500(ActivityThread.java:247)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2053)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
2022-02-09 15:05:07.078 21991-21991/com.company.sample D/StrictMode: StrictMode policy violation; ~duration=286 ms: android.os.strictmode.DiskReadViolation
        at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1659)
        at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:250)
        at java.io.File.isDirectory(File.java:843)
        at java.io.File.toURI(File.java:728)
        at libcore.io.ClassPathURLStreamHandler.<init>(ClassPathURLStreamHandler.java:51)
        at dalvik.system.DexPathList$Element.maybeInit(DexPathList.java:750)
        at dalvik.system.DexPathList$Element.findResource(DexPathList.java:777)
        at dalvik.system.DexPathList.findResources(DexPathList.java:572)
        at dalvik.system.BaseDexClassLoader.findResources(BaseDexClassLoader.java:279)
        at java.lang.ClassLoader.getResources(ClassLoader.java:839)
        at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:349)
        at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:402)
        at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:488)
        at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:786)
        at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:816)
        at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:807)
        at kotlinx.coroutines.CoroutineExceptionHandlerImplKt.<clinit>(CoroutineExceptionHandlerImpl.kt:23)
        at kotlinx.coroutines.CoroutineExceptionHandlerImplKt.initializeDefaultExceptionHandlers(CoroutineExceptionHandlerImpl.kt:27)
        at kotlinx.coroutines.Job.<clinit>(Job.kt:120)
        at kotlinx.coroutines.AbstractCoroutine.<init>(AbstractCoroutine.kt:51)
        at kotlinx.coroutines.StandaloneCoroutine.<init>(Builders.common.kt:190)
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:55)
        at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1)
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47)
        at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source:1)
        at com.company.images.DefaultCompanyImageLoader.initDiskCacheTask(DefaultCompanyImageLoader.kt:213)
        at com.company.images.DefaultCompanyImageLoader.<init>(DefaultCompanyImageLoader.kt:53)
        at com.company.Company.<init>(Company.java:230)
        at com.company.Company.<init>(Company.java:18)
        at com.company.Company.getInstance(Company.java:193)
        at com.company.Company.getInstance(Company.java:22)
        at com.company.sample.CompanyApplication.onCreate(CompanyApplication.kt:76)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1211)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6725)
        at android.app.ActivityThread.access$1500(ActivityThread.java:247)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2053)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
2022-02-09 15:05:07.078 21991-21991/com.company.sample D/StrictMode: StrictMode policy violation; ~duration=285 ms: android.os.strictmode.DiskReadViolation
        at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1659)
        at java.io.UnixFileSystem.getLastModifiedTime(UnixFileSystem.java:289)
        at java.io.File.lastModified(File.java:937)
        at java.util.zip.ZipFile.<init>(ZipFile.java:265)
        at java.util.zip.ZipFile.<init>(ZipFile.java:187)
        at java.util.jar.JarFile.<init>(JarFile.java:169)
        at java.util.jar.JarFile.<init>(JarFile.java:106)
        at libcore.io.ClassPathURLStreamHandler.<init>(ClassPathURLStreamHandler.java:46)
        at dalvik.system.DexPathList$Element.maybeInit(DexPathList.java:750)
        at dalvik.system.DexPathList$Element.findResource(DexPathList.java:777)
        at dalvik.system.DexPathList.findResources(DexPathList.java:572)
        at dalvik.system.BaseDexClassLoader.findResources(BaseDexClassLoader.java:279)
        at java.lang.ClassLoader.getResources(ClassLoader.java:839)
        at dalvik.system.BaseDexClassLoader.findResources(BaseDexClassLoader.java:290)
        at java.lang.ClassLoader.getResources(ClassLoader.java:839)
        at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:349)
        at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:402)
        at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:488)
        at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:786)
        at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:816)
        at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:807)
        at kotlinx.coroutines.CoroutineExceptionHandlerImplKt.<clinit>(CoroutineExceptionHandlerImpl.kt:23)
        at kotlinx.coroutines.CoroutineExceptionHandlerImplKt.initializeDefaultExceptionHandlers(CoroutineExceptionHandlerImpl.kt:27)
        at kotlinx.coroutines.Job.<clinit>(Job.kt:120)
        at kotlinx.coroutines.AbstractCoroutine.<init>(AbstractCoroutine.kt:51)
        at kotlinx.coroutines.StandaloneCoroutine.<init>(Builders.common.kt:190)
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:55)
        at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1)
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47)
        at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source:1)
        at com.company.images.DefaultCompanyImageLoader.initDiskCacheTask(DefaultCompanyImageLoader.kt:213)
        at com.company.images.DefaultCompanyImageLoader.<init>(DefaultCompanyImageLoader.kt:53)
        at com.company.Company.<init>(Company.java:230)
        at com.company.Company.<init>(Company.java:18)
        at com.company.Company.getInstance(Company.java:193)
        at com.company.Company.getInstance(Company.java:22)
        at com.company.sample.CompanyApplication.onCreate(CompanyApplication.kt:76)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1211)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6725)
        at android.app.ActivityThread.access$1500(ActivityThread.java:247)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2053)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
2022-02-09 15:05:07.079 21991-21991/com.company.sample D/StrictMode: StrictMode policy violation; ~duration=285 ms: android.os.strictmode.DiskReadViolation
        at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1659)
        at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:250)
        at java.io.File.isDirectory(File.java:843)
        at java.io.File.toURI(File.java:728)
        at libcore.io.ClassPathURLStreamHandler.<init>(ClassPathURLStreamHandler.java:51)
        at dalvik.system.DexPathList$Element.maybeInit(DexPathList.java:750)
        at dalvik.system.DexPathList$Element.findResource(DexPathList.java:777)
        at dalvik.system.DexPathList.findResources(DexPathList.java:572)
        at dalvik.system.BaseDexClassLoader.findResources(BaseDexClassLoader.java:279)
        at java.lang.ClassLoader.getResources(ClassLoader.java:839)
        at dalvik.system.BaseDexClassLoader.findResources(BaseDexClassLoader.java:290)
        at java.lang.ClassLoader.getResources(ClassLoader.java:839)
        at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:349)
        at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:402)
        at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:488)
        at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:786)
        at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:816)
        at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:807)
        at kotlinx.coroutines.CoroutineExceptionHandlerImplKt.<clinit>(CoroutineExceptionHandlerImpl.kt:23)
        at kotlinx.coroutines.CoroutineExceptionHandlerImplKt.initializeDefaultExceptionHandlers(CoroutineExceptionHandlerImpl.kt:27)
        at kotlinx.coroutines.Job.<clinit>(Job.kt:120)
        at kotlinx.coroutines.AbstractCoroutine.<init>(AbstractCoroutine.kt:51)
        at kotlinx.coroutines.StandaloneCoroutine.<init>(Builders.common.kt:190)
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:55)
        at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1)
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47)
        at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source:1)
        at com.company.images.DefaultCompanyImageLoader.initDiskCacheTask(DefaultCompanyImageLoader.kt:213)
        at com.company.images.DefaultCompanyImageLoader.<init>(DefaultCompanyImageLoader.kt:53)
        at com.company.Company.<init>(Company.java:230)
        at com.company.Company.<init>(Company.java:18)
        at com.company.Company.getInstance(Company.java:193)
        at com.company.Company.getInstance(Company.java:22)
        at com.company.sample.CompanyApplication.onCreate(CompanyApplication.kt:76)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1211)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6725)
        at android.app.ActivityThread.access$1500(ActivityThread.java:247)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2053)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
@qwwdfsad
Copy link
Collaborator

qwwdfsad commented Feb 10, 2022

Could you please elaborate whether you have R8 enabled?

We previously had the same issue with Dispatchers.Main (#1231), but it was fixed with specific R8 optimization.

We could workaround it with if on Class.forName("android."), but it would be nice to know why the optimization doesn't work in the first place

@radixdev
Copy link
Author

Yes, R8 is enabled. The same issue persists

# compiler: R8
# compiler_version: 3.1.51
# min_api: 24
# pg_map_id: e65c6c8
# common_typos_disable
# {"id":"com.android.tools.r8.mapping","version":"1.0"}
2022-02-10 13:13:04.807 3238-3238/com.appboy.sample D/StrictMode: StrictMode policy violation; ~duration=333 ms: android.os.strictmode.DiskReadViolation
        at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1659)
        at java.io.UnixFileSystem.getLastModifiedTime(UnixFileSystem.java:289)
        at java.io.File.lastModified(File.java:937)
        at java.util.zip.ZipFile.<init>(ZipFile.java:265)
        at java.util.zip.ZipFile.<init>(ZipFile.java:187)
        at java.util.jar.JarFile.<init>(JarFile.java:169)
        at java.util.jar.JarFile.<init>(JarFile.java:106)
        at libcore.io.ClassPathURLStreamHandler.<init>(ClassPathURLStreamHandler.java:46)
        at dalvik.system.DexPathList$Element.maybeInit(DexPathList.java:750)
        at dalvik.system.DexPathList$Element.findResource(DexPathList.java:777)
        at dalvik.system.DexPathList.findResources(DexPathList.java:572)
        at dalvik.system.BaseDexClassLoader.findResources(BaseDexClassLoader.java:279)
        at java.lang.ClassLoader.getResources(ClassLoader.java:839)
        at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:349)
        at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:402)
        at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:488)
        at aa.j.g(:786)
        at aa.j.i(:816)
        at aa.j.h(:807)
        at aa.e.h(Unknown Source:0)
        at ca.h0.<clinit>(:23)
        at ca.h0.b(:27)
        at ca.p1.<clinit>(:120)
        at ca.w1.getKey(:29)
        at l9.g$a$a.a(:33)
        at l9.g$a$a.invoke(:32)
        at l9.g$b$a.a(:70)
        at ca.p1$a.b(:112)
        at ca.w1.fold(:27)
        at l9.g$a.a(:32)
        at l9.c.plus(:111)

@qwwdfsad
Copy link
Collaborator

qwwdfsad commented Feb 11, 2022

If it is okay for you, could you please share small reproducing project so we can dissect it?

@radixdev
Copy link
Author

radixdev commented Feb 14, 2022

Hi @qwwdfsad ,

Apologies for the weekend delay. https://github.com/radixdev/sscs-kotlin-coroutines-3180 is a reproducing project.

CustomCoroutineScope is the relevant coroutine object

2022-02-14 14:17:10.836 16958-16958/com.radix.myapplication D/StrictMode: StrictMode policy violation; ~duration=19 ms: android.os.strictmode.DiskReadViolation
        at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1659)
        at java.io.UnixFileSystem.getLastModifiedTime(UnixFileSystem.java:289)
        at java.io.File.lastModified(File.java:937)
        at java.util.zip.ZipFile.<init>(ZipFile.java:265)
        at java.util.zip.ZipFile.<init>(ZipFile.java:187)
        at java.util.jar.JarFile.<init>(JarFile.java:169)
        at java.util.jar.JarFile.<init>(JarFile.java:106)
        at libcore.io.ClassPathURLStreamHandler.<init>(ClassPathURLStreamHandler.java:46)
        at dalvik.system.DexPathList$Element.maybeInit(DexPathList.java:750)
        at dalvik.system.DexPathList$Element.findResource(DexPathList.java:777)
        at dalvik.system.DexPathList.findResources(DexPathList.java:572)
        at dalvik.system.BaseDexClassLoader.findResources(BaseDexClassLoader.java:279)
        at java.lang.ClassLoader.getResources(ClassLoader.java:839)
        at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:349)
        at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:402)
        at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:488)
        at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:786)
        at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:816)
        at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:807)
        at kotlinx.coroutines.CoroutineExceptionHandlerImplKt.<clinit>(CoroutineExceptionHandlerImpl.kt:23)
        at kotlinx.coroutines.CoroutineExceptionHandlerImplKt.initializeDefaultExceptionHandlers(CoroutineExceptionHandlerImpl.kt:27)
        at kotlinx.coroutines.Job.<clinit>(Job.kt:120)
        at kotlinx.coroutines.JobSupport.getKey(JobSupport.kt:29)
        at kotlin.coroutines.CoroutineContext$plus$1.invoke(CoroutineContext.kt:33)
        at kotlin.coroutines.CoroutineContext$plus$1.invoke(CoroutineContext.kt:32)
        at kotlin.coroutines.CoroutineContext$Element$DefaultImpls.fold(CoroutineContext.kt:70)
        at kotlinx.coroutines.Job$DefaultImpls.fold(Job.kt:112)
        at kotlinx.coroutines.JobSupport.fold(JobSupport.kt:27)
        at kotlin.coroutines.CoroutineContext$DefaultImpls.plus(CoroutineContext.kt:32)
        at kotlin.coroutines.CombinedContext.plus(CoroutineContextImpl.kt:111)
        at com.radix.myapplication.CustomCoroutineScope.<clinit>(CustomCoroutineScope.kt:17)
        at com.radix.myapplication.MainActivity.onCreate(MainActivity.kt:13)
        at android.app.Activity.performCreate(Activity.java:8050)
        at android.app.Activity.performCreate(Activity.java:8030)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3608)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3792)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2210)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
2022-02-14 14:17:12.630 16958-16970/com.radix.myapplication W/System: A resource failed to call close. 
2022-02-14 14:17:13.254 16958-16958/com.radix.myapplication D/StrictMode: StrictMode policy violation; ~duration=19 ms: android.os.strictmode.DiskReadViolation
        at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1659)
        at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:250)
        at java.io.File.isDirectory(File.java:843)
        at java.io.File.toURI(File.java:728)
        at libcore.io.ClassPathURLStreamHandler.<init>(ClassPathURLStreamHandler.java:51)
        at dalvik.system.DexPathList$Element.maybeInit(DexPathList.java:750)
        at dalvik.system.DexPathList$Element.findResource(DexPathList.java:777)
        at dalvik.system.DexPathList.findResources(DexPathList.java:572)
        at dalvik.system.BaseDexClassLoader.findResources(BaseDexClassLoader.java:279)
        at java.lang.ClassLoader.getResources(ClassLoader.java:839)
        at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:349)
        at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:402)
        at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:488)
        at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:786)
        at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:816)
        at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:807)
        at kotlinx.coroutines.CoroutineExceptionHandlerImplKt.<clinit>(CoroutineExceptionHandlerImpl.kt:23)
        at kotlinx.coroutines.CoroutineExceptionHandlerImplKt.initializeDefaultExceptionHandlers(CoroutineExceptionHandlerImpl.kt:27)
        at kotlinx.coroutines.Job.<clinit>(Job.kt:120)
        at kotlinx.coroutines.JobSupport.getKey(JobSupport.kt:29)
        at kotlin.coroutines.CoroutineContext$plus$1.invoke(CoroutineContext.kt:33)
        at kotlin.coroutines.CoroutineContext$plus$1.invoke(CoroutineContext.kt:32)
        at kotlin.coroutines.CoroutineContext$Element$DefaultImpls.fold(CoroutineContext.kt:70)
        at kotlinx.coroutines.Job$DefaultImpls.fold(Job.kt:112)
        at kotlinx.coroutines.JobSupport.fold(JobSupport.kt:27)
        at kotlin.coroutines.CoroutineContext$DefaultImpls.plus(CoroutineContext.kt:32)
        at kotlin.coroutines.CombinedContext.plus(CoroutineContextImpl.kt:111)
        at com.radix.myapplication.CustomCoroutineScope.<clinit>(CustomCoroutineScope.kt:17)
        at com.radix.myapplication.MainActivity.onCreate(MainActivity.kt:13)
        at android.app.Activity.performCreate(Activity.java:8050)
        at android.app.Activity.performCreate(Activity.java:8030)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3608)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3792)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2210)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

@qwwdfsad qwwdfsad added the bug label Feb 15, 2022
qwwdfsad added a commit that referenced this issue Feb 15, 2022
…auses verification of the whole JAR/dex (-> file I/O) and ANR

Fixes #3180
@qwwdfsad
Copy link
Collaborator

Thanks! Verified my fix works

@qwwdfsad
Copy link
Collaborator

qwwdfsad commented Apr 6, 2022

Fixed in 1.6.1

@qwwdfsad qwwdfsad closed this as completed Apr 6, 2022
@radixdev
Copy link
Author

radixdev commented Apr 6, 2022

Thank you @qwwdfsad !

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

No branches or pull requests

2 participants