FOUNDING PRICING · 40% OFFfor the first 1,000 members · from ₹95/month
OutageGoogle11 min read

Google's December 2020 Outage: A Quota Cut Broke Sign-In

How an automated quota system starved Google's identity database on 14 December 2020, why Paxos stopped accepting writes, and why sign-in failed for 47 minutes.

ShareXLinkedInWhatsApp
A long, low data centre building with rows of cooling units along its side, behind a fence, with dry hills rising behind it at The Dalles, Oregon.
A long, low data centre building with rows of cooling units along its side, behind a fence, with dry hills rising behind it at The Dalles, Oregon. Photo: Tony Webster from Minneapolis, Minnesota, United States, CC BY 2.0, via Wikimedia Commons.

On Monday 14 December 2020, almost everything at Google that needs you to be signed in stopped working at once: Gmail, YouTube, Drive, Docs, Calendar and the Google Cloud console. No data centre had lost power and no network link was cut. An automated system had decided that the service which knows who every Google user is needed almost no storage, and took its quota away.

The outage lasted 47 minutes by Google's own count. Each step was reasonable on its own: a migration, a grace period, an automatic clean-up, a database that refuses to give stale answers. Together they turned off sign-in for the planet.

A diagram showing the old quota system reporting zero usage for the User ID Service, the automated quota system reducing the account database's quota after a grace period, the Paxos leader no longer able to write, replicas serving outdated data, and the service rejecting authentication lookups so that Gmail, YouTube and Cloud return errors.

What broke for users, and when

Google's incident report says that from 03:46 to 04:33 US/Pacific time, issuing credentials and looking up account details failed for all Google user accounts. Without those lookups, Google's servers could not confirm that a request came from a signed-in user, so they answered almost all authenticated traffic with 5xx server errors.

The BBC reported problems around the world with Gmail, Google Drive, the Android Play Store and Maps, and noted that Google Search itself kept working. That detail is the best clue to the cause. Search does not need to know who you are. The BBC also reported that people could still open the landing pages of affected sites in an incognito window, where no account is attached to the request.

The effects went beyond web pages. The BBC described owners of Google smart speakers who could not switch off their lights, and players of the game Pokémon Go who reported being unable to log in.

A Google Home smart speaker, a Google Home Hub smart display and a Google Home Mini speaker standing together on a dark table.
Google Home smart speakers and a smart display. The BBC reported that owners of Google-connected devices could not control their lights during the outage. Photo: Y2kcrazyjoker4, CC BY-SA 4.0, via Wikimedia Commons.

For Google Cloud customers the picture was mixed, and the report gives numbers:

ServiceImpact reported by Google
Cloud ConsolePeople not already signed in could not log in
BigQueryAbout 75% of streaming requests failed; about 10% of jobs
Cloud StorageAbout 15% of requests, those using OAuth, HMAC or email authentication
Kubernetes EngineAbout 4% of control plane API requests failed
Google WorkspaceEvery authenticated app was down for the duration

The times below are from Google's report. The Pacific times are Google's; the India times are converted from them (Pacific Standard Time is 13 hours 30 minutes behind IST).

US/PacificISTWhat happened
October 2020The User ID Service is registered with a new quota system as part of a migration. Parts of the old system stay in place and report its usage as zero. A grace period delays any enforcement.
03:4317:13The grace period has expired and new quotas take effect. An automated capacity alert fires.
03:4617:16Errors begin in the User ID Service. Sign-in starts failing globally.
03:4817:18Google engineers are paged.
04:0817:38The root cause and a possible fix are identified.
04:2217:52Quota enforcement is disabled in one data centre. Things improve quickly there.
04:2717:57The same change is applied to all data centres.
04:3318:03Error rates return to normal.
05:2118:51The cloud networking control plane, Calendar and the Workspace Admin Console finish recovering.

The service everything depends on

Google's report names the component at the centre: the User ID Service. It keeps a unique identifier for every account and handles the credentials behind OAuth tokens and cookies.

Think about what happens when you open Gmail. Your browser sends a cookie. Gmail's servers cannot tell from the cookie alone whether it is genuine, whether the account still exists, or whether the session was revoked five minutes ago. Somewhere, a service has to look that up. At Google, that lookup ends at the User ID Service. So do the lookups for YouTube, Drive, Calendar, the Cloud console and every API call carrying a user's OAuth token.

The report adds two facts about how this service stores data. First, the account data lives in a distributed database that uses the Paxos protocol to coordinate updates. Second, for security reasons, the service rejects a request when it detects that its data is outdated. Both facts matter in the next section.

The root cause: a quota cut based on a reading of zero

Large companies ration shared resources such as storage and compute with quotas. Each service is allowed a certain amount, and Google's report says a suite of automation tools manages those allowances. A sensible job for such automation is to reclaim what nobody uses.

That job depends completely on the usage number being right.

Google was moving the User ID Service from an old quota system to a new one. In October 2020 the service was registered with the new system. But parts of the old system were left running, and those parts reported the service's usage as 0. A busy service looked, to the automation, like an idle one.

Nothing happened straight away, because a grace period held back enforcement of quota restrictions. When the grace period ran out, the automated quota system did what it was built to do with a service showing zero usage. It reduced the quota for the account database.

A before and after diagram: before, the quota system receives the real usage figure and sets a quota above it, and after the migration it receives a usage figure of zero from leftover parts of the old system and shrinks the quota far below what the account database actually stores.
Automation is only as good as the number it reads

The database was now over its allowance. In Google's words, this stopped the Paxos leader from writing. Shortly afterwards, most read operations were judged outdated, and authentication lookups started returning errors.

Why blocked writes broke reads too

Signing in is mostly a read: look up an account, check a credential. Why would a storage quota, which blocks writes, stop reads?

Start with what Paxos is for. A database that must survive machine failures keeps copies of its data on several replicas. Paxos is a protocol that makes those replicas agree on one ordered sequence of changes. A change counts as committed only when a majority of replicas have accepted it. In the common variant described in Google's SRE book, one replica acts as a stable leader and all writes go through it.

Now the read side. A replica that answers from its own copy can only vouch for the changes it has seen. If it has heard nothing new for a while, it faces an awkward question: has nothing changed, or have I missed something? The SRE book puts it this way: a consistent read needs either a consensus operation of its own or a replica that is guaranteed to be up to date.

Google's report does not describe the internal mechanism, so the following is the general principle and not a description of Google's code. Systems of this kind judge freshness from the steady stream of activity coming from the leader. If the leader cannot write anything at all, that stream stops. From a replica's point of view, a leader that is blocked by quota looks the same as a leader it has lost contact with. Its data begins to age.

At that point the service has two options. It can answer anyway with data that may be old, or it can refuse. For an identity service, old data is dangerous: a password changed, an account suspended or a stolen session revoked might be missing from it. Google chose in advance to refuse: that is the rule in its report about rejecting requests on outdated data. On 14 December that safety rule fired everywhere at once.

A diagram of the same blocked leader seen from a replica: the replica stops receiving fresh updates, cannot tell an idle leader from a lost one, and has two choices, to answer with possibly old account data, which risks honouring a revoked session, or to reject the request, which is what the User ID Service was designed to do.
Stale answer or no answer: the identity service chose no answer

Why the safeguards did not catch it

Google's report is unusually specific here. The quota system had safety checks, and it lists four that could have stopped the change and why each one did not:

  • A check on changes that affect many users. The change targeted a single group, so it did not look like a wide change, even though that one group served every Google user.
  • A check against lowering quota below current usage. Usage was reported as zero, and no quota is below zero.
  • A check on excessive cuts to storage systems. No alert fired during the grace period.
  • A low-quota check. The gap between usage and quota was outside the limit this protection covered.

Notice that most of these checks trusted the same wrong number that caused the problem. A guard that reads the faulty input cannot protect against the faulty input.

Two other things made the incident worse. The first item on Google's list of fixes is to stop the quota automation from making global changes quickly, and the impact was global within minutes. There was no small failure in one place to learn from before the large one. And Google's own tools needed sign-in. The report says Cloud Support's internal tools were affected, which delayed status updates: customers were first updated at 05:34 Pacific, about an hour after error rates had recovered.

What Google said it would change

The report lists five commitments:

  1. Review the quota automation so that it cannot roll out a global change quickly.
  2. Improve monitoring and alerting so wrong configurations are caught sooner.
  3. Make the tools for posting external updates more reliable when internal tools are themselves affected.
  4. Evaluate and build better resilience to write failures in the User ID Service database.
  5. Make Google Cloud services more resilient, so that a User ID Service failure has less effect on the data plane.

The fix on the day already pointed at the first item: enforcement was switched off in one data centre, seen to help, and only then switched off everywhere.

The computer science underneath

Authentication as a shared dependency. Checking a token or cookie is something every product must do, so it is built once and shared. The lesson on authentication and authorisation at scale explains sessions, tokens and OAuth, including the trade-off between tokens that can be verified locally and lookups against a central store. Central lookups give you instant revocation. They also give you a single service whose failure everyone feels.

Consensus and leaders. Paxos and its relatives let a group of machines behave like one reliable machine, as long as a majority can agree. The lesson on consensus and leader election covers why a leader is used and what happens when it cannot make progress. This incident shows a less obvious failure: the leader was alive and reachable, but not permitted to write.

Consistency over availability. When a system cannot be sure its data is current, it must choose between answering and being right. That choice is the heart of CAP and consistency models. An identity system that prefers refusing to guessing is making the consistent choice, and the cost of that choice is an outage like this one.

Blast radius. A change applied to every data centre together has the whole world as its blast radius. Shipping safely with rolling, canary and staged releases and bulkheads, cells and graceful degradation describe the two standard defences: change one slice at a time, and build walls so one slice failing does not sink the rest. Both ideas apply to configuration and quota changes as much as to code.

What an interviewer could ask from this

Why did Google Search keep working while Gmail did not? Search can serve a request without knowing who sent it. Gmail must authenticate every request, and the authentication lookup was what failed.

A storage quota blocks writes. Why did reads fail? The database is replicated with Paxos. When the leader could not write, replicas could no longer show their data was current. The service is designed to reject requests on outdated data, so read lookups returned errors.

Should an authentication service fail open or fail closed? Usually closed. Serving stale identity data can honour revoked sessions or old passwords. The price is availability, so the design should make the stale condition rare and limit how much depends on a live lookup.

How would you design quota automation so this cannot happen? Treat a sudden reading of zero for a known busy service as missing data, not as a fact. Cap how far and how fast a quota can drop. Roll out per data centre with a pause to watch error rates. Do not let the safety checks depend only on the number being checked.

How could dependent services have reduced the impact? Cache successful authentication results for a short, bounded time, and keep data plane work running on existing credentials. Google's report notes the reverse problem too: some Gmail users saw errors for up to an hour afterwards because error responses had been cached.

Takeaways

  • The trigger was a wrong measurement, not a wrong action. The automation correctly shrank the quota of a service that, according to its input, used nothing.
  • Migrations are dangerous in the in-between state, when an old system and a new one both report on the same thing.
  • Safety checks that read the same faulty input as the change they guard will pass it.
  • An identity service that refuses to answer from stale data is safe by design, and every product that depends on it inherits its availability.
  • Global, instant changes remove the chance to catch a mistake while it is still small.

Sources

  1. Google Cloud Status Dashboard: Google Cloud Infrastructure Components, Incident #20013
  2. BBC News: Google outage, YouTube, Docs and Gmail knocked offline (read via the Wayback Machine)
  3. Google SRE Book, Chapter 23: Managing Critical State, Distributed Consensus for Reliability

Written by the Codevizag Academy team

An independent explainer built from the public sources listed above. Codevizag Academy is not affiliated with Google. Found a mistake? Write to support@codevizag.com.

More case studies

Understood it? Now prove it.

The lessons behind this case study are free, and 20 problems a month are judged on real test cases at no cost.

Start solving free