Lesson 4 of 13 · 15m
The Queue Promises Delivery, Not Order, Not Once
Visibility timeouts, offset commits, and dead-letter queues are the real queue contract — at least once, possibly out of order, maybe twice to a dead consumer.
A work queue's contract is narrower than it sounds in the README: your message will be delivered at least once. Not exactly once, not in order, and not necessarily to a consumer that is still alive by the time processing finishes. Everything else — ordering, dedup, poison messages — is a knob with a price.
The visibility timeout race
SQS standard queues are the plain case: at-least-once delivery, best-effort ordering. The mechanism that produces duplicates in the wild is the visibility timeout, 30 seconds by default. When a consumer receives a message it becomes invisible to other consumers for that window; if the consumer does not delete it in time, the message reappears and a second consumer picks it up. Processing that takes 90 seconds against the default setting means two workers run your job concurrently — not a failure of the queue, a failure of a guess. Extend it mid-flight with ChangeMessageVisibility or size the timeout above your p99 processing time, and treat the duplicate as normal traffic anyway: the timeout is a floor, not a promise, because a consumer can also crash outright.
SQS FIFO queues buy ordering and deduplication with MessageGroupId and MessageDeduplicationId — a five-minute dedup interval — at the cost of throughput, because ordering serializes. Ordering is the most expensive feature in any queue: it is the constraint that you cannot scale consumers against one key.
Offsets are your commit point, so commit deliberately
Kafka makes the trade explicit. enable.auto.commit is on by default and commits offsets every 5 seconds (auto.commit.interval.ms). Where you place the commit relative to the work chooses your guarantee:
- Commit, then process: a crash between the two loses the record — at-most-once.
- Process, then commit: a crash between the two replays the record — at-least-once.
There is no third option on that axis, because the offset commit and the side effect cannot be made atomic — that is the dual-write problem, and the outbox lesson covers what it takes to close it for real. RabbitMQ says the same thing in different words: ack after processing or autoAck and accept loss, with delivery-limit on quorum queues bouncing repeat offenders to a dead-letter exchange.
The poison message is the failure mode hiding inside all of this. A message that crashes your handler does not just fail once: it is redelivered, crashes the next consumer, gets redelivered again. Without a delivery limit the queue turns into a crash loop that consumes all your workers one at a time. Set delivery-limit (or a maxReceiveCount redrive policy on SQS), route the offender to a dead-letter queue, and alert on DLQ depth — a DLQ nobody watches is a landfill that thinks it is monitoring.
Ordering is the other price. It exists only within a partition key — Kafka partitions, SQS FIFO MessageGroupId — and it serializes consumers per key, which is why it costs throughput and why "just make everything ordered" is not an answer.
A Redis list is not a queue, whatever the blog post said. LPUSH/BRPOP gives you blocking pops and no acks, no redelivery tracking, and durability bounded by whatever appendonly/save you configured. RPOPLPUSH to a processing list was the traditional fix; Redis Stream XREADGROUP/XPENDING/XACK is the modern one, with XAUTOCLAIM to steal messages from dead consumers — but you have to want it, because a plain list will happily lose the message the moment a consumer dies mid-pop.
What to actually do
Pick your commit order on purpose and write down which guarantee you bought — "we process-then-commit and dedup downstream" is a design; forgetting to choose is not. Set visibility timeouts and max.poll.interval.ms above measured p99 processing, extend them for long jobs, and send repeat deliveries to a DLQ instead of letting a poison message spin forever. The consumer contract is idempotency, which is why the previous lesson exists. And watch consumer lag, not queue depth: depth is a number, lag is the queue telling you the pipeline is behind.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
What is Platform as a Service? The Sweet Spot Between "Too Easy" and "Too Much Work"
Platform as a Service sits between raw servers and fully managed software. You push code, the platform runs it. No Nginx config, no OS patches, no 3 AM server alerts. Here is what PaaS actually gives you, what it costs you in control, and how to decide if it is the right layer for your application.
The World now is Serverless and Container based
A new report from Datadog reveals that serverless computing could be entering the mainstream. This has already been the case in my world for the past few years. Results show that more than half of all organizations are using serverless on one of the three major public cloud providers: Amazon,
AWS Emulator Puts AWS on Your Laptop. Keep Your IAM Tests Off It.
AWS released AWS Emulator on November 11, a free local server that answers AWS API calls on 127.0.0.1 with per-run keys and fresh certificates.
A 257-Byte Password Is the Key: Inside the OpenSSH musl Bypass
CVE-2026-123158 lets an attacker log into a locked account on musl-based systems like Alpine by sending a password nobody set. The trigger is one number, 257, and the reason is a C library returning a single asterisk. I reproduced the exact boundary against musl 1.2.4 and read the fix.