Intermittent "signature we calculated does not match" errors
We (and other users) have been seeing weird intermittent signing errors - in a given day, many thousands of requests succeed, but about a dozen requests fail (v1.4.4.1 & v1.4.5) :
com.amazonaws.AmazonServiceException: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
The Canonical String for this request should have been
'POST
/
content-length:222
content-type:application/x-amz-json-1.0
host:dynamodb.eu-west-1.amazonaws.com
user-agent:aws-sdk-java/1.4.5 Linux/3.4.43-43.43.amzn1.x86_64 Java_HotSpot(TM)_64-Bit_Server_VM/17.0-b16
x-amz-date:20130605T125514Z
x-amz-target:DynamoDB_20120810.Query
content-length;content-type;host;user-agent;x-amz-date;x-amz-target
87fa64cc8ba1483914fbde19afaf5a727957ed72845e4c1039320495fe46acb1'
The String-to-Sign should have been
'AWS4-HMAC-SHA256
20130605T125514Z
20130605/eu-west-1/dynamodb/aws4_request
f53aaa5fe95ed6c0e9f34f8bfd630cb87a189ed2be914e402842fe104e7cdfdf'
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:653) ~[ios_purchases_api.jar:na]
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:347) ~[ios_purchases_api.jar:na]
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:199) ~[ios_purchases_api.jar:na]
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.invoke(AmazonDynamoDBClient.java:1245)
We're currently getting a dozen or so errors like this a day in Production, and they seem bizarre, given that we are making lots of successful requests with the exact same credentials.
We use a single instance of the com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient class, shared between threads, which lives for the life of the JVM. Is any of that incorrect use?
cc'ing @fulghum because of the big changes to com.amazonaws.auth.AWS4Signer in v1.4.4 https://github.com/aws/aws-sdk-java/commit/c2f2e516#diff-4
(initially reported at https://forums.aws.amazon.com/thread.jspa?messageID=457465)
Hey Roberto, thanks for reporting this. This does seems really odd that it's only happening for such a small percentage of requests. We'll try to trigger the problem over here on our side and see if we can find another clue. Let us know if you can think of anything else that might be helpful.
Hi, Roberto, thanks for report this issue. Double check, this issue did not appear when using Java SDK earlier than 1.4.4?
Hi @yifeireplay - I've just now deployed a build using aws-sdk-java v1.4.3 - within 16 hours we should have enough data to see if the problem was present in that version of the library.
Thank you so much for reporting this issue and your efforts to help us. We have reproduced the issue and fixed it. It is a bug introduced by 1.4.4, Watch our next release.
thank you again!
That's great @yifeireplay - looking forward to it!
Hi, Roberto,
The AWS Java SDK 1.4.6 has been released which includes the bug fix.
thanks again for reporting the issue!
Yifei
Thanks Yifei - we have deployed AWS Java SDK v1.4.6 to Production, and can confirm it seems to have fixed the issue - we've seen no errors in the 24 hours since deployment.
I am seeing the same issue from the C++ library which is making s3 REST Calls. I am sending multiple request is parallel with around 64 threads and seeing this issue for 1/~5000 requests and retry passes for the failed request.
@yifeireplay , @fulghum , Can you tell what was the fix that was put in to fix the issue?
Thanks