agemooij / riak-scala-client

An easy to use, non-blocking, fast Scala client library for interacting with Riak.
http://riak.scalapenos.com/
Apache License 2.0
84 stars 24 forks source link

[Compression] Riak inconsistent compression behaviour with 404 Not Found responses #43

Closed ajantis closed 7 years ago

ajantis commented 7 years ago

Problem

The optional gzip compression for requests and responses is introduced with https://github.com/agemooij/riak-scala-client/pull/40 PR.

When trying to delete an already deleted object, Riak returns a 404 response with a text/plain body - "not found". However, this response MIGHT have a "Content-Encoding: gzip" header (and non-compressed body still). Trying to decompress the payload of such response leads to an internal java.util.zip.ZipException: Not in GZIP format exception in the riak client's http pipeline.

How to reproduce

It has proved to be almost impossible to easily reproduce that behaviour with curl. But a test scenario in RiakGzipSpec.scala submitted together with the #40 pull request triggers this behaviour in ~75% runs on my machine.

Workaround

As a workaround, we may want to not fail response decompression directive in case of a ZipException, but just proceed with payload as it is. ( yes, it does sound ugly :) )

ajantis commented 7 years ago

There is a fix_^W_workaround for that behaviour in https://github.com/agemooij/riak-scala-client/pull/40 PR