-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Gzip compression doesn't work with DynamoDB (crc32 errors) #526
Comments
Hi @aws team, We are also impacted by this bug. Please fix this 👍 |
I've also noticed this while trying to use it with Kinesis streaming. Since the easiest way to set up the KCL is with a common client for Kinesis, DynamoDB and CloudWatch, it means that you need to disable Gzip compression for all three of those, which is not ideal.
|
It looks like a bug in java sdk, will fix that. Thanks for the report. |
Hello @jakozaur , can you give us a specific test case ? I am working on fixing this. |
@zhangzhx I'm hitting it every time, when I enable Gzip compression and than try to use DynamoDB Api. I just created DynamoDB client:
and then every network call fails. |
aws/aws-sdk-js#405 is probably relevant to your interests. DynamoDB is returning a checksum of the compressed bytes, which many HTTP clients transparently decompress for you making the checksum "wrong". Ideally they would switch to returning a checksum over the uncompressed bytes, but until that happens the only real option is to disable checksum validation when you might get a gzipped response. :( |
Oh bother, didn't see the linked Android SDK issue. It's unfortunate that they fixed this client-side and are now depending on the checksum matching the compressed bytes, as that pretty much closes the door on a fix coming from the server-side. If you have a reasonable way of getting the compressed bytes out of the Apache HttpClient, you may as well follow suit and verify the checksum on that. |
Thanks @fernomac for the explain. I will reach out to the DynamoDB server team and figure out a safe way to fix this and not breaking android as well. Maybe letting them send both CRCs from uncompressed and compressed payload would be an option. |
@zhangzhx, could you please let us know if there is any update? Thank you in advance. |
Also hitting this. Any status on a fix? |
Sorry for the long wait. We asked the service team and they are not planning to change the checksum to uncompressed data. We will soon migrate our underlying Apache Httpclient from 4.3.6 to a newer version 4.5. With that said, we will fix this issue in the new Httpclient by disabling response content automatic decompression for dynamo. I will let you know once that happens. |
+1 :) |
We have fixed this bug in our latest release 1.11.20. Please try the new version and let us know if you have further questions. Sorry for the long waiting of the bug fix. |
I think you actually may have introduced a bigger bug.... out of the blue once we updated to 1.11.20 we started seeing this issue (when previously we were not). |
Hi @theRealDrumBum, can you give me a detailed description what the issue you are seeing? |
Its basically the same issue reported above, except introduced with 1.11.20... |
Can you give me some sample code to reproduce this bug? Thanks. |
Any details about how you've configured the client would be very helpful as well. |
I can help out, we are having the same issue. Version In a Spring app:
And somewhere else, the exception mentioned above when executing:
Exception:
|
Which versions of the aws-java-sdk-dynamodb and aws-java-sdk-core are being used at runtime? |
We got
|
Still the same with |
I have not been able to reproduce this. Would it be possible to provide some wire log samples? Keep in mind logs may contain sensitive data. http://docs.aws.amazon.com/java-sdk/latest/developer-guide/java-dg-logging.html |
Hey @thisismana, do you see this error not having Gzip configured? I couldn't reproduce this issue as well. Please provide some wire log for us to further investigate. Thanks. |
Sorry for the late answer, but the problem seems to be resolved now. Even with the versions mentioned above. Guess it wasn't the java-sdks fault. retested it with close the issue? |
Hmm interesting. Well if you see any further issues with it please let us know. |
It's still an issue. |
Can you give us more information such as sample code that can reproduce this issue, error log or exception trace? Thanks. |
com.amazonaws.AmazonClientException: Unable to execute HTTP request: Client calculated crc32 checksum didn't match that calculated by server side |
Do you see this for every request? |
Here's the code. I've stripped out as much as I can. java -jar build\libs\word-count-emr-1.0-adee88b.jar |
I've stripped out even more of our code. |
1.11.19 works |
Thanks for providing these sample code. I saw you intended to perform a query operation using DynamoDB Mapper. I couldn't reproduce this issue. Could you turn on log4j to get the wire log for us to investigate? Also, did you turn on Gzip in the ClientConfiguration setting? Here is how to turn on log4j. Keep in mind logs may contain sensitive data such as credentials. |
Gzip doesn't affect the crc error. I'll try the wire log...
|
@zhangzhx can you email me at dan.vallejo / nordstrom.com |
Able to reproduce with the sample you've provided. Digging into it now. |
WOOHOO |
For some reason it's not wrapping the content in a CRC calculating input stream so the client side crc is always 0. Still investigating. |
Ah okay got it. It's an issue with the request timeout feature not playing nice with how we are calculating the checksum now. For the request timeout when wrap with a BufferedHttpEntity to ensure we read the entire request before leaving AmazonHttpClient (to strictly enforce the timeout over the whole receiving of the request) and this is messing up checksum calculation. Looking for a fix now. |
Okay got a fix in mind and I'll make sure it goes out in tomorrows release. If this is blocking you then temporarily disabling the request timeout and client execution timeout features will fix this issue. |
@danvallejo Thanks for reporting this and providing the sample code, it was enormously helpful tracking this issue down. The fix has been staged and will be released tomorrow as part of 1.11.28. |
Sweet! I think Dan deserves an Xl Dynamodb shirt - we can meet you in the -Matt On Wed, Aug 17, 2016 at 5:20 PM Andrew Shore notifications@github.com
|
WOOOOOOOOHOOOOOOOOOOOOO |
I still don't see the 1.11.28 package. |
Not sure how frequently that's synced with Maven Central. You should be able to pull it down from central though. http://search.maven.org/#artifactdetails|com.amazonaws|aws-java-sdk-core|1.11.28|jar |
What public maven url do you use? buildscript { |
Maven Central is http://repo1.maven.org/maven2/ I believe |
Fix VERIFIED. Thanks. |
If you setup gzip, sometimes I get an exception:
Android SDK fixed that bug. See:
aws-amplify/aws-sdk-android#40
and the actual fix:
aws-amplify/aws-sdk-android@b03c51e
Please also fix it in Java SDK.
The text was updated successfully, but these errors were encountered: