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
Cache is closed exception with OkHttp 2.7.1 #2228
Comments
Do you have code that closes the cache? |
Nope I don't have any logic that handles cache, except for during construction of OkHttpClient okHttpClient = new OkHttpClient();
okHttpClient.setCache(new Cache(context.getApplicationContext().getCacheDir(),
CACHE_SIZE)); My network logic mostly relies on standard Retrofit interfaces with callback, with |
I am seeing the
Most of them (95%) occur on Nexus 9/Android 6.0.1. edit: It is very rare (only a handful users last month), so the device/Android version might be skewed due to the user base. Possibly related to #2365. |
We started to see same crash after upgrading from 2.5 to 2.7.5. Using retrofit 1.9.0 Stack Trace 0 java.lang.IllegalStateException: cache is closed |
Also seeing this in 3.0.1.
|
For me looks like it's happening when I POST the same url twice in a row, happens every time:
|
In my case this was happening because I had two okhttp instances share the same cache directory, which isn't recommended by okhttp according to documentation. Once having two different cache directories problem not happening anymore |
@samehgerges definitely only have 1 instance. |
Figured it out. I was calling cache.delete() before the second POST which apparently closes the cache. |
Got these (very rare) crashes recently, started after I upgraded to Retrofit 2.0.0-beta2. All of my network calls use asynchronous callbacks, either through
OkHttpClient.newCall(Request).enqueue(OkHttp.Callback)
orRetrofit.Call.enqueue(Retrofit.Callback)
I'm using OkHttp 2.7.1 and Retrofit 2.0.0-beta2.
The text was updated successfully, but these errors were encountered: