question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android - okhttp3.internal.io.FileSystem$Companion$SYSTEM$1.rename (FileSystem.java:89) crash

See original GitHub issue

These crashes keep happening: failed to rename /data/user/0/com.package/cache/62ac51d56050cb47dea413039d3e3b67.0.tmp to /data/user/0/com.package/cache/62ac51d56050cb47dea413039d3e3b67.0

They happen randomly and not all the time, I’m unable to reproduce which makes it all the more confusing. The crashes are all similar to this one, but will sometimes be “delete” or “read”

They’re happening too often to ignore. Is there a way to mitigate or fix this this? As far as I can tell, it happens on most devices. I apologize for the lack of information. We’re using version 4.5.0.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
oproulxcommented, Dec 11, 2020

Hello,

We are still seeing this crash on version 4.9.0.

Fatal Exception: java.io.IOException: failed to rename /data/user/0/OURAPP/cache/57ad8dd5e5e0a9c6b5f4b00d66f8e3c6.0.tmp to /data/user/0/OURAPP/cache/57ad8dd5e5e0a9c6b5f4b00d66f8e3c6.0
       at okhttp3.internal.io.FileSystem$Companion$SystemFileSystem.rename(FileSystem.java:90)
       at okhttp3.internal.cache.DiskLruCache.completeEdit$okhttp(DiskLruCache.java:532)
       at okhttp3.internal.cache.DiskLruCache$Editor.commit(DiskLruCache.java:901)
       at okhttp3.Cache$RealCacheRequest$1.close(Cache.java:406)
       at okio.internal.RealBufferedSinkKt.commonClose(RealBufferedSinkKt.java:203)
       at okio.RealBufferedSink.close(RealBufferedSink.java:286)
       at okhttp3.internal.cache.CacheInterceptor$cacheWritingResponse$cacheWritingSource$1.read(CacheInterceptor.java:190)
       at okio.internal.RealBufferedSourceKt.commonRead(RealBufferedSourceKt.java:39)
       at okio.RealBufferedSource.read(RealBufferedSource.java:189)
       at okio.internal.RealBufferedSourceKt.commonExhausted(RealBufferedSourceKt.java:49)
       at okio.RealBufferedSource.exhausted(RealBufferedSource.java:197)
       at okio.GzipSource.read(GzipSource.java:88)
       at okio.internal.RealBufferedSourceKt.commonRead(RealBufferedSourceKt.java:39)
       at okio.RealBufferedSource.read(RealBufferedSource.java:189)
       at okio.ForwardingSource.read(ForwardingSource.java:29)
       at retrofit2.OkHttpCall$ExceptionCatchingResponseBody$1.read(OkHttpCall.java:288)
       at okio.RealBufferedSource$inputStream$1.read(RealBufferedSource.java:158)
       at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:288)
       at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:351)
       at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:180)
       at java.io.InputStreamReader.read(InputStreamReader.java:184)
       at okhttp3.ResponseBody$BomAwareReader.read(ResponseBody.java:211)
       at com.google.gson.stream.JsonReader.fillBuffer(JsonReader.java:1295)
       at com.google.gson.stream.JsonReader.nextNonWhitespace(JsonReader.java:1333)
       at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:538)
       at com.google.gson.stream.JsonReader.peek(JsonReader.java:425)
       at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:40)
       at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:27)
       at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:225)
       at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:121)
       at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.java:519)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:764)

Any help is greatly appreciated!

Olivier

0reactions
oproulxcommented, Dec 11, 2020

If you have two serviceApi then you likely have two Cache instances sharing the same directory, this is probably the cause.

See https://square.github.io/okhttp/4.x/okhttp/okhttp3/-ok-http-client/#okhttpclients-should-be-shared

Thanks for the suggestion! We will ensure that only 1 client is created and post back if that resolves the crashes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to rename cache/journal to cache/journal.bkp
I just received this crash report from HockeyApp. ... at com.squareup.okhttp.internal.io.FileSystem$1.rename(FileSystem.java:85) at ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found