okhttp: Crash during journal file rename

Get this crash from one of the users

Device: Samsung Galaxy Note 4 Retrofit: v1.9 okhttp: v2.6.0

Fatal Exception: java.lang.RuntimeException: java.io.IOException: failed to rename /data/data/com.bandlab.bandlab/cache/journal.tmp to /data/data/com.bandlab.bandlab/cache/journal
       at com.squareup.okhttp.internal.DiskLruCache$1.run(DiskLruCache.java:181)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
       at java.lang.Thread.run(Thread.java:818)
Caused by java.io.IOException: failed to rename /data/data/com.bandlab.bandlab/cache/journal.tmp to /data/data/com.bandlab.bandlab/cache/journal
       at com.squareup.okhttp.internal.io.FileSystem$1.rename(FileSystem.java:85)
       at com.squareup.okhttp.internal.DiskLruCache.rebuildJournal(DiskLruCache.java:409)
       at com.squareup.okhttp.internal.DiskLruCache.access$400(DiskLruCache.java:88)
       at com.squareup.okhttp.internal.DiskLruCache$1.run(DiskLruCache.java:177)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
       at java.lang.Thread.run(Thread.java:818)

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 16 (1 by maintainers)

Most upvoted comments

And in 3.11.0

I’m seeing this issue on okhttp 4.9.0. Though I catch it so it doesn’t crash the app. Not sure what is causing it - maybe because I’m using a lru cache.

Fixed in OkHttp 3.3, coming soon.

hi @yschimke thanks for the response.

This is very common and this is on production.

here is the exception log : image

everytime we released an update, the exceptions log warning always highlighted this issue as trending stability issue.

We’re not sure why in our app this issue still happening while i saw some comments said they are fixed, as you can see my partner @kevinROctavian has left comment in Februari https://github.com/square/okhttp/issues/2119#issuecomment-465940509