15
votes

I have a small set of messages in an SQS queue, that are not deleted even though a deletion request sent to the AWS endpoint returns with a 200 response. The messages are processed by my application fine, and the deletion request is sent fine too.

I'm using the Java AWS SDK 1.3.6.

Has anyone else experienced this problem?

2
Are these SQS messages not deleted at all or does it just take a few seconds? Could you show us some code? - Daan
Hi Daan. They're never deleted, or at least they haven't been in the last few hours. I could show you some code, but it's just regular use of the AWS SDK, so there's not much point! - EngineerBetter_DJ
Hmm, I've never had this problem. Can you delete them manually from the AWS web management console? Is this affecting all of your SQS queues or just this one? If you just have one, could you try creating a new queue and seeing whether the same code works for deleting messages from that queue? I'm not seeing any issues on the AWS service status page, so I don't think SQS is acting up. Could be, though. - Daan

2 Answers

15
votes

Whoops - the queue was accidentally set to defaultVisibilityTimeout=0. Changing this to a positive value fixed the problem.

This still raises a few questions though:

  1. Why did this only affect some messages? Perhaps some took longer to process?
  2. Why did Amazon return a 200 for delete when the messages weren't being deleted?
  3. Was the deletion failing because it fell outside of the 0-second window (in which case why did any deletion requests succeed?), or did they fail because another consumer had picked them up by the time the deletion request was received?
4
votes

Official documentation (version 1.9.13)

IMPORTANT: It is possible you will receive a message even after you have deleted it. This might happen on rare occasions if one of the servers storing a copy of the message is unavailable when you request to delete the message. The copy remains on the server and might be returned to you again on a subsequent receive request. You should create your system to be idempotent so that receiving a particular message more than once is not a problem.