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

StrictModeViolation: GzipSource is not closed #472

Closed
mattprecious opened this issue Oct 6, 2020 · 3 comments · Fixed by #488
Closed

StrictModeViolation: GzipSource is not closed #472

mattprecious opened this issue Oct 6, 2020 · 3 comments · Fixed by #488
Labels
bug Something isn't working

Comments

@mattprecious
Copy link

✍️ Describe the bug

Caused by: java.lang.Throwable: Explicit termination method 'end' not called
   at dalvik.system.CloseGuard.open(CloseGuard.java:237)
   at java.util.zip.Inflater.<init>(Inflater.java:122)
   at okio.GzipSource.<init>(GzipSource.kt:44)
   at com.chuckerteam.chucker.internal.support.IOUtils.getNativeSource(IOUtils.kt:59)
   at com.chuckerteam.chucker.api.ChuckerInterceptor.processRequest(ChuckerInterceptor.kt:132)
   at com.chuckerteam.chucker.api.ChuckerInterceptor.intercept(ChuckerInterceptor.kt:97)

💣 Steps to reproduce

StrictMode.setVmPolicy(
  VmPolicy.Builder()
    .detectLeakedClosableObjects()
    .penaltyLog()
    .penaltyDeath()
)

Call an endpoint using gzip compression.

🔧 Expected behavior

No violation. GzipSource is closed.

📱 Tech info

  • Chucker version: 3.3.0
@MiSikora MiSikora added the bug Something isn't working label Oct 6, 2020
@vbuberen
Copy link
Collaborator

vbuberen commented Oct 9, 2020

Thanks for reporting.

While trying to reproduce found out that in our sample app we don't actually have a request with a proper header for Gzip, so have nothing going through GzipSource and this is why don't see the same issue.

@cortinico
Copy link
Member

While trying to reproduce

Have you had any luck reproducing this @vbuberen ?

@vbuberen
Copy link
Collaborator

Yes. To reproduce you can manually add Content-Encoding header with gzip value to a request in our sample app.
Only with this header ChuckerInterceptor will call the code which makes strict mode complain.
This is why I mentioned that we have no good request in the sample app at the moment.

@ghost ghost added the Pending PR The resolution for the issue is in PR label Oct 31, 2020
@ghost ghost removed the Pending PR The resolution for the issue is in PR label Nov 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants