Systemsfor Aravinda
0 / 78 core
Week 12 · Production stories

Cloudflare outages

1 hours · core path

Read first: Deploys and chaos, DNS and CDNs

In one sitting

A bad regular expression, a routing leak, and a prefix withdrawal took Cloudflare down in three different years. Each change reached far more traffic than the edit looked like, and in two of them the operators' own path rode the network they had just broken. Count blast radius in requests, and keep a way to undo a change that does not depend on the thing the change can kill.

A change with a wide blast radius will eventually be a bad change. If the path you use to undo it is the path you just broke, the bad change lasts until you can reach the machines again. Cloudflare published three incidents in that shape. The triggers are a regular expression, a routing preference, and a prefix advertisement. The radius is the lesson, and so is a control plane that rides the data plane.

The problem

The edge sits on the HTTP path for other companies’ users. A firewall rule, a backbone route, and a prefix advertisement are all configuration. Configuration feels smaller than a code deploy. In these incidents the configuration was the outage, because it was installed widely, and because the tools the operators needed took the same roads as customer traffic.

Blast radius is the set of users one change can affect. Count it in traffic. A change that touches a few percent of locations can still be half of requests when those locations are the busy ones. A change that touches every location is a worldwide outage even when the patch is a single rule.

Two phrases carry the rest of the page. The data plane forwards customer traffic. The control plane is how operators observe that forwarding and change it. When the control plane is carried by the data plane, a data-plane failure removes the undo. That showed up in more than one incident below.

The design

2 July 2019

A new managed rule in the web application firewall, the WAF, contained a regular expression with catastrophic backtracking. CPU on the HTTP path went to the ceiling worldwide. The outage lasted 27 minutes. Customers saw 502s.

Backtracking is ordinary regex behavior. The engine walks the input. Where the pattern allows a choice, it tries one option. If the rest of the match fails, it returns to that choice and tries the next option. The work stays small when the number of choices stays small. It becomes catastrophic when each extra character multiplies the choices, so a short input forces an exponential amount of work. One request can occupy a core for a long time. Every location was running the rule, so every location’s HTTP path saturated together. The pattern itself stays in their postmortem. It does not get copied onto this page.

The regex was the trigger. They published a longer list of why one pattern became 27 minutes of worldwide 502s:

  • A CPU-use protection had been removed in a refactor. That protection is load shedding by another name: a limit that stops one request from spending the CPU everyone else on the HTTP path needs.
  • The regex engine had no complexity limit. A shedder is a backstop. The engine would still attempt the exponential match.
  • Tests did not catch CPU. A test that checks whether a request is allowed or blocked still passes when the match is merely slow. The failure is time, not a wrong allow-or-deny bit.
  • A non-emergency rule went global without a staged rollout. A canary sends a slice of traffic, watches the signal the user feels, and then proceeds or rolls back. This rule skipped that slice.
  • Rollback was slow.
  • The first global alert was slow. Part of the 27 minutes was time spent not knowing. That is an observability miss sitting next to the CPU miss. There is no published split of the 27 minutes into detection and repair. The duration you can defend is the whole window.
  • Their own dashboard was behind the same edge, so operators were locked out of their tools.

Read that list as brakes, not as color. Any one of them, present and working, changes the incident. A complexity limit or a CPU cap keeps one request off the ceiling. A staged rollout keeps the ceiling inside a slice. A fast alert and a fast rollback shrink the 27 minutes. A dashboard that is not behind the broken edge means someone can actually pull the change. They published all seven as missing or slow.

17 July 2020

A backbone change meant to relieve congestion in Atlanta removed a prefix-list condition instead of disabling the term. A prefix is a block of addresses a site advertises so the rest of the network knows where to send packets. A prefix list limits which of those blocks a policy term applies to. The operator meant to turn the term off. Turning it off would have stopped it. Removing the condition did the opposite: the term matched more routes and leaked them into the backbone.

The leaked routes were advertised with local preference 200. Local server routes were at 100. Local preference is the number those routers use to pick a path inside their own network. The higher number wins. It is not a weight, and it does not split traffic two hundred to one hundred. The router chooses the 200 route and does not choose the 100 route. Traffic from many cities was pulled to Atlanta, and Atlanta was overwhelmed.

The incident lasted about 27 minutes. Traffic across the network dropped by about half. Not every city was hit, because not every site depended on that backbone. A site off that backbone kept serving. Half the traffic is still the radius that matters. “Not worldwide” is a different sentence from “small.”

flowchart TD
  local[Local server route at 100]
  leaked[Leaked backbone route at 200]
  pick[Router picks the higher number]
  atl[Atlanta overwhelmed]
  local --> pick
  leaked --> pick
  pick --> atl

The fix they named puts two bounds on the same mistake. A maximum-prefix limit on backbone sessions caps how many prefixes a session will accept, so one leak cannot import an unbounded set. They did not publish the cap. Do not invent one. A higher local preference on local server routes means one city cannot outrank another city’s own servers. Local traffic stays on local servers unless someone deliberately decides otherwise.

21 June 2022

A change to prefix advertisement policy, part of a resilience project, reordered terms and withdrew a critical subset of prefixes. Anycast advertises the same prefix from many sites. Routing sends the client to an announcement it hears. That is not a promise that the nearest city wins. When a location withdraws a prefix, that announcement disappears. Whoever needed it, customer or operator, loses that path.

The change started at 06:27 UTC, when the rollout reached the locations on the newer architecture. Nineteen data centers were affected, about 4% of locations and about half of requests. The last revert finished at 07:42 UTC. Engineers had trouble reaching the broken locations to undo the change. Overlapping reverts briefly reintroduced the withdrawal. Two undos raced, and the bad advertisement came back inside the same window.

start        06:27 UTC
last revert  07:42 UTC
06:27 to 07:27 = 60 minutes
07:27 to 07:42 = 15 minutes
window       = 75 minutes

Seventy-five minutes is clock arithmetic on the timestamps they published. It is not an extra metric.

sketch only: treat "about 4%" as 0.04
19 / 0.04 = 475

They did not publish an inventory of 475 locations. The sketch says the fleet was on the order of a few hundred sites, and the word “about” is the error bar. The ratio that decides whether the incident was small is the traffic:

about half of requests / about 4% of locations
0.50 / 0.04 = 12.5

Those 19 locations carried on the order of twelve times an even share of requests. A radius you describe as “only 19 sites” is half the service when the busy sites are the ones in the change. Count the radius in requests.

The same shape

Incident Trigger How wide How long
2 July 2019 Regex backtracking in a WAF rule Worldwide HTTP path, customers saw 502s 27 minutes
17 July 2020 Prefix-list condition removed, local preference 200 against 100 About half of traffic, not every city About 27 minutes
21 June 2022 Policy reorder withdrew prefixes 19 data centers, about 4% of locations, about half of requests 06:27 to 07:42 UTC, 75 minutes on the clock

In 2019 the dashboard was behind the edge that was saturated. In 2022 the broken locations were hard to reach, and overlapping reverts put the withdrawal back. Both are a control plane riding the data plane. The 2020 incident is the radius lesson in routing form: preference 200 pulled other cities into Atlanta, and “depends on this backbone” decided who was inside the blast.

flowchart TD
  change[One configuration change]
  data[Data plane]
  customers[Customer traffic]
  operators[Operator path]
  change --> data
  customers --> data
  operators --> data

While the middle box is sick, the operator arrow is sick too. Rollback, the first global alert, and the dashboard all get slow or unreachable. That is why a bad rule and a bad prefix policy last 27 minutes or 75 minutes for reasons that have nothing to do with how fast someone can type a revert.

A practiced rollback and a small radius are the point of the deploy lesson, including the chaos version of it: a hypothesis, a blast radius you chose on purpose, an abort condition, and a rollback you have already done. These three changes inverted that. The radius was accidental, and the rollback was slow or hard to reach.

What they traded

Choice What they gained What they spent
Install a WAF rule at every location Customers get the protection at the same time One catastrophic pattern saturates CPU worldwide and returns 502s
Let backbone routes compete on local preference An operator can draw traffic toward a city to relieve congestion A leak at preference 200 outranks local servers at 100 and pulls other cities into the congested one
Reorder prefix advertisements in a resilience project A tighter policy for which sites announce which prefixes A bad order withdraws the prefixes clients use, and the prefixes operators need for the revert
Serve the dashboard from the same edge as customers One stack to run When that edge fails, the people who would fix it are on the failed path

The 2020 fix is a pair of bounds on the second row, not a reason to skip the fourth row. A maximum-prefix limit stops one session from swallowing a leak. A higher local preference on local server routes stops a remote city from beating local servers. You still want the repair path to work when the preference change is wrong.

A staged rollout spends clock time before the incident. A non-emergency rule waits on a slice. The 2019 rule was non-emergency and went global. The time saved before the change was paid back inside a 27-minute outage whose rollback and first global alert were both slow.

What to steal

Copy the brakes.

Any system you operate gets a slice before a global step, including a change you believe is safe and including a change that is “only configuration.” You watch the signal a user would notice. For the 2019 class of bug that signal is CPU and the error responses, not a test that only checks the allow-or-deny result. You cap the work one request can do, so a single pattern cannot pin a core. You keep an undo that does not depend on the process or the path the change can break. That undo is the control-plane point in one sentence. A laptop that reaches production only through the public edge will be locked out at the moment it is needed.

Leave the global network on the shelf. A five-person system does not have a backbone, a local-preference design, or 19 data centers carrying half of requests. It does have one deployable, one regular expression somebody pasted into a validator, and an admin page served by the same process as the product. That is enough to reproduce the shape: a bad pattern, no CPU cap, a dashboard you cannot load, and a rollback you cannot reach. The radius is every user as soon as there is one deploy and no slice.

If you retell this in five minutes, use 2019 for the brake list and 2022 for reachability. Add 2020 if you still have a minute: preference 200 against 100, about half of traffic, about 27 minutes, and the reason it was not every city. Do not recite a regular expression. Do not invent a request rate.

Check yourself

The 2019 trigger was one regular expression. Why did the outage still cover the HTTP path worldwide for 27 minutes?

Catastrophic backtracking drove CPU on the HTTP path to the ceiling, and customers saw 502s. The pattern was the trigger. The published brakes were already gone or too slow: a CPU-use protection had been removed in a refactor, the regex engine had no complexity limit, tests did not catch CPU, a non-emergency rule went global without a staged rollout, rollback was slow, the first global alert was slow, and the dashboard was behind the same edge so operators were locked out. There is no published split of the 27 minutes. The window is the whole incident.

Local preference was 200 on the leaked routes and 100 on local server routes. Why did cities get pulled to Atlanta, and why did traffic fall by about half instead of to zero?

The higher local preference wins inside their network. It does not split traffic in the ratio 200 to 100. Routers selected the leaked backbone routes, so traffic from many cities was attracted to Atlanta and overwhelmed it. Not every site depended on that backbone, so not every city was in the radius. The sites that did depend on it were enough for traffic across the network to drop by about half, for about 27 minutes.

How long was the 2022 window from the published timestamps, and why is 4 percent of locations a bad way to call the incident small?

From 06:27 UTC to 07:42 UTC is 60 minutes plus 15 minutes, so 75 minutes. Nineteen data centers were about 4 percent of locations and about half of requests. Treating those abouts as exact for a sketch, half divided by 0.04 is 12.5, so the affected locations carried on the order of twelve times an even share of traffic. Radius follows requests. The same sketch says 19 divided by 0.04 is 475 locations in the fleet, and that number is a derivation, not an inventory they published.

What does it mean that the control plane rides the data plane, and which of these incidents showed it?

The data plane forwards customer traffic. The control plane is how operators look at that forwarding and undo a change. If the dashboard, the path that delivers the alert, or the route to the broken machines uses the data plane, the bad change takes the undo with it. In 2019 the dashboard was behind the same edge and operators were locked out of their tools. In 2022 engineers had trouble reaching the broken locations, and overlapping reverts briefly reintroduced the withdrawal. The incident then lasts as long as reachability lasts.

Which controls belong on a five-person system, and which 2020 controls should you be able to describe and then leave alone?

A staged rollout, a check that notices CPU instead of only pass or fail, a cap on work per request, and a rollback path that does not traverse the process you are changing all belong on a small system. A maximum-prefix limit on backbone sessions, and a higher local preference on local server routes so one city cannot outrank another, are the published fix for a network that leaks prefixes between cities. Describe that fix. A single service in one region does not need to build it.

Based on: Cloudflare postmortems, 2 July 2019, 17 July 2020, and 21 June 2022.