coil-kt / coil

Image loading for Android and Compose Multiplatform.
https://coil-kt.github.io/coil/
Apache License 2.0
10.86k stars 668 forks source link

`IOException atomic move not supported` when using Coil with `com.android.tools:desugar_jdk_libs_nio:2.0.0` #1526

Closed eygraber closed 2 years ago

eygraber commented 2 years ago

I'm using Coil 2.2.2 and also use Android desugaring with com.android.tools:desugar_jdk_libs:2.0.0 and everything works fine.

If I change the desugaring library to com.android.tools:desugar_jdk_libs_nio:2.0.0, every image load results in an IOException with the message atomic move not supported.

Not sure if this is an issue on the desugaring side or on Coil's side.

colinrtwhite commented 2 years ago

Which version of the Android Gradle Plugin are you using? Desugaring 2.0.0 requires AGP 7.4.0-alpha10 or later: https://github.com/google/desugar_jdk_libs/blob/master/CHANGELOG.md#version-200-2022-09-16

eygraber commented 2 years ago

7.4 Beta 4

colinrtwhite commented 2 years ago

Hmm do you have the full stack trace? I think I know what the issue might be.

eygraber commented 2 years ago
java.io.IOException: atomic move not supported
    at okio.NioSystemFileSystem.atomicMove(NioSystemFileSystem.kt:82)
    at okio.ForwardingFileSystem.atomicMove(ForwardingFileSystem.kt:225)
    at coil.disk.DiskLruCache.completeEdit(DiskLruCache.kt:462)
    at coil.disk.DiskLruCache.access$completeEdit(DiskLruCache.kt:84)
    at coil.disk.DiskLruCache$Editor.complete(DiskLruCache.kt:768)
    at coil.disk.DiskLruCache$Editor.commit(DiskLruCache.kt:743)
    at coil.disk.DiskLruCache$Editor.commitAndGet(DiskLruCache.kt:750)
    at coil.disk.RealDiskCache$RealEditor.commitAndGet(RealDiskCache.kt:61)
    at coil.disk.RealDiskCache$RealEditor.commitAndGet(RealDiskCache.kt:55)
    at coil.fetch.HttpUriFetcher.writeToDiskCache(HttpUriFetcher.kt:173)
    at coil.fetch.HttpUriFetcher.fetch(HttpUriFetcher.kt:80)
    at coil.fetch.HttpUriFetcher$fetch$1.invokeSuspend(Unknown Source:14)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
colinrtwhite commented 2 years ago

Filed an issue with the D8 team here since it seems like an issue with the desugared code.

colinrtwhite commented 2 years ago

Going to close this out since this is a bug with D8 and will be fixed in the next desugar_jdk_libs release.