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

Fix for not closed GzipSource #488

Merged
merged 2 commits into from
Nov 1, 2020
Merged

Fix for not closed GzipSource #488

merged 2 commits into from
Nov 1, 2020

Conversation

vbuberen
Copy link
Collaborator

@vbuberen vbuberen commented Oct 31, 2020

📄 Context

There is an issue #472
Issue appears with StrictMode enabled. We couldn't catch the issue earlier, because sample app has no gzip request with body, so code with error wasn't reachable.

📝 Changes

  • Fixed the issue by adding use { } function to GzipSource in getNativeSource() function.
  • Updated tests to use real Buffer(), since Mockk can't properly react to close() call.
  • Added a fake Gzip request which I fill with some dummy request body and header telling that response is with gzip encoding. It returns 405, but allows to reproduce the issue.
  • Added StrictMode to the sample app, because this is not the first time we have issues reported by people with this mode enabled (for example StrictMode policy violation: android.os.strictmode.LeakedClosableViolation #421)
  • (UPD: after review) Renamed existing gzip request to explicitly mention that it returns just gzip response.

🛠️ How to test

To reproduce the issue remove use from getNativeSource() and use just GzipSource directly. With StrictMode enabled sample will crash when fakeGzipRequest() is called.

⏱️ Next steps

We might want to improve the part of request processing and cover it with some more tests.
Closes #472

@vbuberen vbuberen added the bug Something isn't working label Oct 31, 2020
@vbuberen vbuberen added this to the 3.4.0 milestone Oct 31, 2020
Copy link
Contributor

@MiSikora MiSikora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one minor thing.

As far as the requests revamp go I think we should go with a similar route to responses processing.

@vbuberen vbuberen merged commit bf3132a into develop Nov 1, 2020
@vbuberen vbuberen deleted the fix/gzip branch November 1, 2020 13:47
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 this pull request may close these issues.

StrictModeViolation: GzipSource is not closed
2 participants