Interview Prep/Real-World Interview/Cloud provider issues

An order worker processes the same SQS message three or four times, creating duplicate shipments.

IntermediateTroubleshootingCloud provider issues
Answer

Likely causes → Processing takes longer than the queue's visibility timeout, so the message becomes visible again and another worker picks it up before the first deletes it. Standard queues also deliver at least once by design.

Diagnose →

aws sqs get-queue-attributes --queue-url $Q --attribute-names VisibilityTimeout RedrivePolicy

Compare with p99 processing time in worker logs, and look at the ApproximateReceiveCount attribute on messages.

Fix → Set the visibility timeout well above worst-case processing (for Lambda triggers, at least six times the function timeout), extend it during long work with ChangeMessageVisibility, and add a DLQ with maxReceiveCount.

Prevent → Make consumers idempotent: record processed message IDs (or a business key) with a conditional write and skip duplicates. Use FIFO with deduplication if strict once-per-key processing is required.

All Real-World Interview questions Roadmap: Interview readiness

More on Cloud provider issues