awslabs / amazon-sqs-java-extended-client-lib

An extension to the Amazon SQS client that enables sending and receiving messages up to 2GB via Amazon S3.
Apache License 2.0
211 stars 109 forks source link

Deleting from FIFO SQS extended after Visibility time got over #29

Open cdespona opened 6 years ago

cdespona commented 6 years ago

We have found an issue when we try to confirm our messages have been processed using a FIFO SQS extended. When the delete happens it is basically deleting iniatially from the S3 bucket and after that's done it tries to remove from the queue, basically an AmazonSQSException is raised saying the ReceiptHandler is expired, and as a result the message stays in the queue, however the payload is correctly deleted from the S3 bucket. As a result the message is repicked by the queue and when it does try to read it again an AmazonS3Exception is raised saying there is no payload related to the message from the queue. I think the delete operation should be somehow atomic as the message in the queue means nothing without the real content from S3.

We have experimented around changing the order of the operations, so removing first from the queue and later on the S3 bucket and it works better, but from our point of view this should be provided by the API itself.

Let me know if you need any further information.

Quantisan commented 3 years ago

This looks like the code in question, https://github.com/awslabs/amazon-sqs-java-extended-client-lib/blob/2568cec815a842593a6cb3d837a24f957c4437ff/src/main/java/com/amazon/sqs/javamessaging/AmazonSQSExtendedClient.java#L552

what if we try to delete the message first before deleting the s3 payload? @adam-aws