Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why would SQS fail to set a VisibilityTimeout of 43199 when the max is stated as 43200?

Recently needed to set some really long timeouts on SQS messages and saw that the documented limit was 12 hours (43200). So I tried setting the timeout to 1s under that and got this error back that sounds crazy (in that 43199 is in fact less than 43200 in most number systems).

SQSError: SQSError: 400 Bad Request SenderInvalidParameterValueValue 43199 for parameter VisibilityTimeout is invalid. Reason: Total VisibilityTimeout for the message is beyond the limit [43200 seconds]

Anyone have any ideas?

EDIT: Looks like it was the concept of 'Total' timeout being different from what the timeout I was setting with the change_visibility API call. The Total is ticking from when the message was first received

like image 318
Alex Schokking Avatar asked Aug 11 '15 00:08

Alex Schokking


2 Answers

It looks like you were setting message visibility with ChangeMessageVisibility API on message which were already received at that moment and not visible.

Visibility timeout is 12 hour for message in total. It means that when you receive message, visibility timeout is already running for this message. When you call ChangeMessageVisibility you can increase visibility timeout only with value which will not breach 12 hours in total with already elapsed visibility timeout.

like image 130
Lubo Sach Avatar answered Nov 25 '22 07:11

Lubo Sach


I am not sure why you are getting error if you specify the value as 43199 but I just tried to create a queue in AWS Console with 12 hours as the Default Visibility timeout.

AWS Console

Edit :

I tried to set the visibility timeout via. CLI as 43199 seconds and it succeeded as well - I think it must be an interim issue, please try again.

aws sqs set-queue-attributes --queue-url https://sqs.us-east-1.amazonaws.com/12345677/test --attributes VisibilityTimeout=43199

CLI AWS SQS

like image 33
Naveen Vijay Avatar answered Nov 25 '22 06:11

Naveen Vijay