Skip to content
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

Crash java.lang.IllegalStateException (crashed) cache is closed #1055

Open
4 of 5 tasks
matteinn opened this issue Jun 7, 2023 · 3 comments
Open
4 of 5 tasks

Crash java.lang.IllegalStateException (crashed) cache is closed #1055

matteinn opened this issue Jun 7, 2023 · 3 comments

Comments

@matteinn
Copy link
Contributor

matteinn commented Jun 7, 2023

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.

  1. Environment
    1. Platform: Android
    2. SDK version: 6.2.0
    3. OS version: all
    4. Android Studio version: not relevant
    5. How widespread is the issue. Percentage of devices affected: roughly 0.1%
  2. Debug logs that reproduce the issue: N/A
  3. Steps to reproduce, with a description of expected vs. actual behavior: N/A
  4. 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

@matteinn matteinn added the bug label Jun 7, 2023
@RCGitBot
Copy link
Contributor

RCGitBot commented Jun 7, 2023

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

@tonidero
Copy link
Contributor

tonidero commented Jun 7, 2023

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 getOfferings near 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!

@matteinn
Copy link
Contributor Author

matteinn commented Jun 7, 2023

  • 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 getOfferings near 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!

@vegaro vegaro removed the bug label Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants