Crash `java.lang.IllegalStateException (crashed) cache is closed`
- [ ] I have updated Purchases SDK to the latest version
- [x] I have read the Contribution Guidelines
- [x] I have searched the Community
- [x] I have read docs.revenuecat.com
- [x] I have searched for existing Github issues
Describe the bug A clear and concise description of what the bug is. The more detail you can provide the faster our team will be able to triage and resolve the issue. Do not remove any of the steps from the template below. If a step is not applicable to your issue, please leave that step empty.
This crash has only been observed in production by monitoring crash-reporting tools, didn't find any way to replicate nor any specific patterns in the affected audience: in fact is spans across differente manufacturers, OS versions, geography and so on. The only apparent hint is that this crash happens early in the app session, right after startup.
- Environment
- Platform: Android
- SDK version: 6.2.0
- OS version: all
- Android Studio version: not relevant
- How widespread is the issue. Percentage of devices affected: roughly 0.1%
- Debug logs that reproduce the issue: N/A
- Steps to reproduce, with a description of expected vs. actual behavior: N/A
- Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)
java.lang.IllegalStateException (crashed)
cache is closed
at com.android.okhttp.internal.DiskLruCache.checkNotClosed (DiskLruCache.java:632)
at com.android.okhttp.internal.DiskLruCache.get (DiskLruCache.java:426)
at com.android.okhttp.Cache.get (Cache.java:187)
at com.android.okhttp.Cache$1.get (Cache.java:142)
at com.android.okhttp.internal.http.HttpEngine.sendRequest (HttpEngine.java:215)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute (HttpURLConnectionImpl.java:465)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse (HttpURLConnectionImpl.java:411)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream (HttpURLConnectionImpl.java:248)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream (DelegatingHttpsURLConnection.java:211)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream (HttpsURLConnectionImpl.java:30)
at com.revenuecat.purchases.common.HTTPClient.getInputStream (HTTPClient.kt:68)
at com.revenuecat.purchases.common.HTTPClient.performCall (HTTPClient.kt:147)
at com.revenuecat.purchases.common.HTTPClient.performRequest (HTTPClient.kt:108)
at com.revenuecat.purchases.common.HTTPClient.performRequest$default (HTTPClient.kt:14)
at com.revenuecat.purchases.common.Backend$getOfferings$call$1.call (Backend.kt:266)
at com.revenuecat.purchases.common.Dispatcher$AsyncCall.run (Dispatcher.kt:39)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:462)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run (ScheduledThreadPoolExecutor.java:301)
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:923)
Additional context Add any other context about the problem here.
As far as I can tell, this crash wasn't happening on the previous 6.1.1 SDK version, except for some extremely rare occurrences here and there
👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!
Hi @matteinn,
Looking at the stack trace, it seems to be crashing when we try to fetch offerings after SDK configuration from your hint... A few things that would be useful:
- Do you have any logs from your crash monitoring tool?
- Could you provide a snippet of the code you use to configure the SDK?
- Also, do you call
getOfferingsnear app startup? If so, could we get a snippet of that code as well? - Could you double-check you're not configuring the SDK multiple times in any path?
Let us know if you notice anything else in the meantime about these crashes!
- Do you have any logs from your crash monitoring tool?
Nope
- Could you provide a snippet of the code you use to configure the SDK?
At app opening...
Purchases.logLevel = if (BuildConfig.DEBUG) LogLevel.VERBOSE else LogLevel.ERROR
val configuration = PurchasesConfiguration.Builder(context, REDACTED)
.appUserID(appUserId)
.build()
Purchases.configure(configuration).apply {
updatedCustomerInfoListener = this@PurchasesManager
}
with(Purchases.sharedInstance) {
setEmail(email)
...
collectDeviceIdentifiers()
}
userRepository.isLoggedIn
.subscribe({ isLoggedIn ->
when (isLoggedIn) {
true -> { purchases.logInWith(...) }
false -> { purchases.logOut() }
}
}, {})
.also{ disposables.add(it) }
- Also, do you call
getOfferingsnear app startup? If so, could we get a snippet of that code as well?
Nope, only when strictly needed (e.g. when a paywall needs to be shown)
- Could you double-check you're not configuring the SDK multiple times in any path?
Yes, that's not happening
Let us know if you notice anything else in the meantime about these crashes!
Absolutely!
This issue has been automatically locked due to no recent activity after it was closed. Please open a new issue for related reports.