Understanding SQS Visibility Timeout: Why Your Messages Are Being Processed Twice
SQS visibility timeout controls how long a message stays hidden from other consumers after being received — misconfiguring it is the most common cause of duplicate message processing in production queues. TL;DR: SQS Visibility Timeout at a Glance Scenario What Happens Root Cause Fix Message processed twice Two consumers handle the same message Visibility timeout shorter than processing time Increase timeout or call ChangeMessageVisibility Lambda duplicate invocations Function retried before completion Queue timeout less than 6x Lambda timeout Set queue timeout to at least 6x Lambda timeout Message stuck in flight Never requeued after consumer crash Timeout too long, no delete on failure Tune timeout + configure DLQ Message never retried Failed processing silentl...