workerfuse

How a Durable Objects alarm loop runs up your Cloudflare bill

A Durable Object alarm that keeps rescheduling itself racks up requests, storage writes and duration. What that costs at list price, and how to stop it.

A Durable Object alarm runs your alarm() handler at a time you pick. Pretty common pattern: set the next alarm inside the handler. If a bug sets that time to now, or a few ms from now, the handler just runs again and again. The handler keeps succeeding, so you might not notice for a while.

async alarm() {
  await this.flush();
  // Bug: delayMs never got set from config, so it's 0.
  await this.ctx.storage.setAlarm(Date.now() + (this.delayMs ?? 0));
}

What it costs

Every alarm run is a request ($0.15 per million) and every setAlarm is a storage write. On top of that, an object that's busy back to back doesn't get to go idle, so it bills duration too: $12.50 per million GB-s, at 128 MB per object.

Using Cloudflare's own pricing math, an object that's active all day is 0.128 GB × 86,400 s = 11,059 GB-s, about $0.14 a day. Tiny for one object. But if the bug is in the shared class, every object that hits this alarm path can loop. 1,000 of them is ~$138 a day in duration alone, at list price before the monthly allowance.

Why you may not notice

Budget alerts send an email and keep everything running. Cloudflare's newer Durable Objects spending limit does block, but it's monthly and account-wide, so it blocks new DO requests and alarms across the whole account, not just the looping object. A loop that starts on a Friday night can run a long way before either kicks in.

How to stop it

  • Validate the delay before you schedule. Missing, zero or negative means a bug, so throw instead of looping.
  • Set a floor: never schedule an alarm less than a few seconds out.
  • Stop the loop when there is no work. Call deleteAlarm() instead of setting a new one.
  • Watch duration per namespace in the Workers analytics, not only the monthly bill.

workerfuse checks Durable Object usage every five minutes. When a Worker's estimated spend passes your limit, it pauses that Worker instead of the whole account. The stub stops the alarm loop once the object picks it up, which took about five minutes in our test. Start a free trial.

Pause the runaway Worker. Keep the rest running.

workerfuse checks your Cloudflare spend every five minutes and pauses any Worker over its limit.

Start free trial

Keep reading

We measured a Durable Object alarm loop. The analytics undercounted it by ~4x

On a test DO with a 1-second alarm loop, analytics reported about a quarter of the real alarm runs and row writes, and the loop took 5 minutes to stop.

Cloudflare spending limits vs pausing one Worker

Cloudflare now has spending limits for Workers and Durable Objects. They're account-wide and block the whole product. Here's how that compares to pausing only the runaway Worker.

Cloudflare billing horror stories: four runaway bills from 2026

A $34,895 alarm loop, a $10,811 bill from an abandoned side project, a ~$36,000 queue loop, and $4,586 of D1 writes. What broke, how long it ran, and what Cloudflare did about it.