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

Transparent GZIP with condition cache can cause ioexception #358

Closed
pablolb opened this issue Nov 29, 2013 · 6 comments
Closed

Transparent GZIP with condition cache can cause ioexception #358

pablolb opened this issue Nov 29, 2013 · 6 comments
Labels
bug Bug in existing code
Milestone

Comments

@pablolb
Copy link

pablolb commented Nov 29, 2013

WIth transparent gzip enabled, if the same resource is requested after it has been cached with cache validators, an ioexception is thrown.

@pablolb
Copy link
Author

pablolb commented Nov 29, 2013

This can happen when using okhttp with volley for example.

Here is an example test & fix
pablolb@ab61aea

@swankjesse
Copy link
Member

Thanks! I'll take a look.

If you fill out our contributor's agreement and submit a pull request I can use your code.

@pablolb
Copy link
Author

pablolb commented Dec 3, 2013

Sorry, now its duplicated. It did follow the execution with the debugger for a couple of test cases to understand the issue but still... please do take a look, tests ran ok, but as it is re-entrant code somebody with better knowledge of the code-base should definitely have a better understanding.

@codefromthecrypt
Copy link

What does the IOException look like when this fails without the patch?

@swankjesse
Copy link
Member

One other option is to change initContentStream to be called differently when hasResponseBody() returns null. That should be relatively straightforward and make it possible to use caches external to OkHttp.

@swankjesse
Copy link
Member

@pablolb please give the fix a try!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug in existing code
Projects
None yet
Development

No branches or pull requests

3 participants