Loopuff
- Type
- Serverless
- Anomaly
- Function or Logic App retry loop
- Evolves into
- Loopocalypse
- Weakness
- Execution alerts, idempotent triggers
What it is
Loopuff looks harmless but is expensive. A Function or Logic App triggers itself (directly or indirectly) or retries endlessly on failure, running millions of executions that each cost a tiny amount.
How to spot it
- Execution count far above normal for a Function App or Logic App.
- Cost rises with no change in business activity.
- Run history full of repeated failures or the same message reprocessed.
Common causes
- A function writing to the same container, queue or Cosmos container that triggers it.
- Uncapped retry policies; poison messages never dead-lettered.
- Logic App polling triggers with very short intervals.
- Downstream outage causing retry storms.
Evolution: Loopocalypse
Loops fan out (one trigger spawns many) and connectors are billed per action, so cost grows exponentially.
Defences
- Execution alerts on run counts and failures.
- Make triggers and handlers idempotent.
- Cap retries; use dead-letter queues and circuit breakers.
- Avoid output bindings that retrigger the same function.
Real world encounter
The encounter
A customer has a storage account with SFTP enabled so a 3rd party can submit one file a day. Each upload triggers a function that loads the file into a database, costing less than a dollar a day. Separately, an admin is asked to back up files from an unrelated system to the cloud. They write a PowerShell script that runs hourly, and remembering the SFTP server, they point it there.
The script doesn't clear its local folder, so each run re-uploads everything from previous runs plus anything new. Every upload triggers the function. It worked on their machine. They deploy it on a Friday.
Tracking it down
Nobody noticed over the weekend, because alerts on the original solution were being ignored: the 3rd party doesn't send files at weekends anyway. On Monday morning the bill was around $4k. Execution counts on the function and blob created events on the storage account showed a huge, steady stream of uploads from the admin's backup rather than from the 3rd party.
A second case has the same shape. A 3rd party's bug started sending full files instead of deltas, taking a Logic App from 200 to 200k records a day on pay-per-action pricing. It just worked, so nobody noticed for weeks, and cost went from $10 to $500 a month.
Catching it
The script was fixed and pointed at proper backup storage. The team added alerts on execution counts and messages processed, limited retry policies, and defined an escalation policy and SLA so alerts are not simply ignored.
The lesson
Loopuff is the cloud doing its job: the system scaled happily and processed everything. The cost comes from a loop nobody intended, driven by an unrelated change. Application-level budgets and anomaly detection help, but billing lag means you also need run and message metrics to spot unexpected load early.