https://kotlinlang.org logo
#random
Title
# random
r

Rabia Anjum

03/12/2024, 3:03 PM
Thank you for allowing me to join this channel. My Android app has been updated from Apollo 2.5 to 3.8. And now that I've moved, I'm receiving this error. I can't figure out the precise code where is coming from, nor can I reproduce it. I added a try catch block to attempt and catch this exception while clearing the cache upon logout, but it was unsuccessful, and the crash continued. Fatal Exception: java.io.IOException failed to delete /data/user/0/com.example.mobile/cache/http-cache/63e602c86c6aa918b680ba2f111c3fa9.1
s

Stefan Oltmann

03/12/2024, 4:35 PM
You better ask on StackOverflow.
👍 1
k

Klitos Kyriacou

03/12/2024, 5:41 PM
Unfortunately we can't really give an answer without knowing much more information. You say that you don't know where this error is coming from. Typically, this would be in the stack trace, but if you don't log the stack trace, this will be very difficult to find.
r

Rabia Anjum

03/12/2024, 5:53 PM
I logged the stack trace but it's difficult to figure out the starting point. Fatal Exception: java.io.IOException: failed to delete /data/user/0/com.example.mobile/cache/http-cache/63e602c86c6aa918b680ba2f111c3fa9.1 at okio.JvmSystemFileSystem.delete(JvmSystemFileSystem.kt:129) at okio.FileSystem.delete(FileSystem.kt:114) at com.apollographql.apollo3.cache.http.internal.DiskLruCacheKt.delete(DiskLruCache.kt:1018) at com.apollographql.apollo3.cache.http.internal.DiskLruCacheKt.access$delete(DiskLruCache.kt:1) at com.apollographql.apollo3.cache.http.internal.DiskLruCache.removeEntry(DiskLruCache.kt:560) at com.apollographql.apollo3.cache.http.internal.DiskLruCache.remove(DiskLruCache.kt:549) at com.apollographql.apollo3.cache.http.DiskLruHttpCache.remove(DiskLruHttpCache.kt:103) at com.apollographql.apollo3.cache.http.HttpCache$httpCache$2$intercept$1$2.invokeSuspend(HttpCacheExtensions.kt:132) at com.apollographql.apollo3.cache.http.HttpCache$httpCache$2$intercept$1$2.invoke(:8) at com.apollographql.apollo3.cache.http.HttpCache$httpCache$2$intercept$1$2.invoke(:4) at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit(Emitters.kt:223) at kotlinx.coroutines.flow.FlowKt__ErrorsKt$catchImpl$2.emit(Errors.kt:158) at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15) at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15) at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:87) at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:66) at com.apollographql.apollo3.cache.normalized.FetchPolicyInterceptors$CacheAndNetworkInterceptor$1$intercept$1$invokeSuspend$$inlined$map$1$2.emit(Emitters.kt:223) at kotlinx.coroutines.flow.FlowKt__ErrorsKt$catchImpl$2.emit(Errors.kt:158) at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15) at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15) at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:87) at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:66) at com.apollographql.apollo3.cache.normalized.internal.ApolloCacheInterceptor$readFromNetwork$$inlined$map$1$2.emit(Emitters.kt:223) at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit(Emitters.kt:224) at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15) at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15) at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:87) at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:66) at com.apollographql.apollo3.network.http.HttpNetworkTransport$execute$1.invokeSuspend(HttpNetworkTransport.kt:90) at com.apollographql.apollo3.network.http.HttpNetworkTransport$execute$1.invoke(:8) at com.apollographql.apollo3.network.http.HttpNetworkTransport$execute$1.invoke(:4) at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61) at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230) at kotlinx.coroutines.flow.internal.ChannelFlowOperatorImpl.flowCollect(ChannelFlow.kt:195) at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collect$suspendImpl(ChannelFlow.kt:167) at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collect() at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1.collect(SafeCollector.common.kt:113) at com.apollographql.apollo3.cache.normalized.internal.ApolloCacheInterceptor$readFromNetwork$$inlined$map$1.collect(SafeCollector.common.kt:113) at kotlinx.coroutines.flow.FlowKt__CollectKt.emitAll(Collect.kt:109) at kotlinx.coroutines.flow.FlowKt.emitAll(:1) at com.apollographql.apollo3.cache.normalized.internal.ApolloCacheInterceptor$interceptQuery$1.invokeSuspend(ApolloCacheInterceptor.kt:196) at com.apollographql.apollo3.cache.normalized.internal.ApolloCacheInterceptor$interceptQuery$1.invoke(:8) at com.apollographql.apollo3.cache.normalized.internal.ApolloCacheInterceptor$interceptQuery$1.invoke(:4) at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61) at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230) at kotlinx.coroutines.flow.internal.ChannelFlowOperatorImpl.flowCollect(ChannelFlow.kt:195) at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collect$suspendImpl(ChannelFlow.kt:167) at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collect() at kotlinx.coroutines.flow.FlowKt__ErrorsKt.catchImpl(Errors.kt:156) at kotlinx.coroutines.flow.FlowKt.catchImpl(:1) at kotlinx.coroutines.flow.FlowKt__ErrorsKt$catch$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:113) at com.apollographql.apollo3.cache.normalized.FetchPolicyInterceptors$CacheAndNetworkInterceptor$1$intercept$1$invokeSuspend$$inlined$map$1.collect(SafeCollector.common.kt:113) at kotlinx.coroutines.flow.FlowKt__CollectKt.emitAll(Collect.kt:109) at kotlinx.coroutines.flow.FlowKt.emitAll(:1) at com.apollographql.apollo3.cache.normalized.FetchPolicyInterceptors$CacheAndNetworkInterceptor$1$intercept$1.invokeSuspend(FetchPolicyInterceptors.kt:211) at com.apollographql.apollo3.cache.normalized.FetchPolicyInterceptors$CacheAndNetworkInterceptor$1$intercept$1.invoke(:8) at com.apollographql.apollo3.cache.normalized.FetchPolicyInterceptors$CacheAndNetworkInterceptor$1$intercept$1.invoke(:4) at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61) at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230) at kotlinx.coroutines.flow.FlowKt__ErrorsKt.catchImpl(Errors.kt:156) at kotlinx.coroutines.flow.FlowKt.catchImpl(:1) at kotlinx.coroutines.flow.FlowKt__ErrorsKt$catch$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:113) at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1.collect(SafeCollector.common.kt:113) at kotlinx.coroutines.flow.FlowKt__EmittersKt$onCompletion$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:114) at kotlinx.coroutines.flow.internal.ChannelFlowOperatorImpl.flowCollect(ChannelFlow.kt:195) at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo$suspendImpl(ChannelFlow.kt:157) at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo() at kotlinx.coroutines.flow.internal.ChannelFlow$collectToFun$1.invokeSuspend(ChannelFlow.kt:60) 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)
k

Klitos Kyriacou

03/12/2024, 6:06 PM
Unfortunately, this error message doesn't say why it failed to delete the file. This is because okio uses the old
java.io.File.delete
method as can be seen on Github. I don't understand why a library that calls itself "A modern I/O library" uses
File.delete
instead of
java.nio.file.Files.delete
which would have given a much more descriptive error message.
r

Rabia Anjum

03/12/2024, 7:31 PM
Yes, I agree that these logs are ineffective, and they use an obsolete API, as you mentioned. I'll try to raise the issue on their Github.
a

agrosner

03/12/2024, 9:03 PM
Can you ask in #apollo-kotlin ?
Or raise an issue yes
r

Rabia Anjum

03/12/2024, 9:09 PM
Sure, I'll post the question in #apollo-kotlin as well. Thanks!
2 Views