How a Free AI Endpoint Exposed a Hidden Retry Bug That Duplicated Batch Jobs
A developer discovered that migrating a nightly summarization batch job to a free-tier AI model endpoint triggered a long-dormant bug in the retry logic. When the free endpoint's slower tail latency caused requests to time out, the retry loop generated a new idempotency key on each attempt, turning one logical operation into multiple physical executions. This resulted in duplicate database entries and duplicate emails being sent to a customer, though the two symptoms initially appeared unrelated. The root cause was that the original endpoint's consistently low latency had never allowed the flawed retry policy to fire. The incident highlights that timeout thresholds should be based on P99 latency distributions, not median response times, and that retry loops must reuse the same idempotency key across all attempts for the same logical operation.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in