<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kashif Manzer</title>
    <description>The latest articles on DEV Community by Kashif Manzer (@kashif_manzer).</description>
    <link>https://dev.to/kashif_manzer</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4141917%2F22f6777f-adeb-4fe8-86bd-58fce72dfb78.png</url>
      <title>DEV Community: Kashif Manzer</title>
      <link>https://dev.to/kashif_manzer</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kashif_manzer"/>
    <language>en</language>
    <item>
      <title>The rollback that kept the bug: how a duplicate identity broke env0's AWS deployments</title>
      <dc:creator>Kashif Manzer</dc:creator>
      <pubDate>Fri, 27 Nov 2026 14:16:33 +0000</pubDate>
      <link>https://dev.to/kashif_manzer/the-rollback-that-kept-the-bug-how-a-duplicate-identity-broke-env0s-aws-deployments-2fa2</link>
      <guid>https://dev.to/kashif_manzer/the-rollback-that-kept-the-bug-how-a-duplicate-identity-broke-env0s-aws-deployments-2fa2</guid>
      <description>&lt;p&gt;Tuesday 10 November 2026, just before nine in the morning, UTC. A release finished rolling out at env0, a platform that runs infrastructure deployments for other teams. Minutes later, some customers' AWS deployments started failing at the credentials step, before any of their own code had run.&lt;/p&gt;

&lt;p&gt;The error was plain: &lt;code&gt;Not authorized to perform sts:AssumeRoleWithWebIdentity&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;env0 did the obvious thing. It rolled the release back. The previous version went live at 11:00 UTC, and the deployments kept failing.&lt;/p&gt;

&lt;p&gt;That is the interesting part of this incident. A rollback is supposed to undo a bad change. Here, the rollback kept the bug, because the bug was not really in the new code. It was in a choice the old code and the new code made differently, about which of two identical-looking robot users to trust.&lt;/p&gt;

&lt;h2&gt;
  
  
  First, the plain words
&lt;/h2&gt;

&lt;p&gt;OIDC is short for OpenID Connect. In plain terms, it is a way for one system to prove who it is to another system without sharing a long-lived password or access key.&lt;/p&gt;

&lt;p&gt;The proof is a token. A token here is a signed statement, a small bundle of claims that says who issued it, who it is for, and who it is about. The claim that says who the token is about is called the subject, shortened to &lt;code&gt;sub&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;When a deployment tool wants to act in your AWS account, it presents that token to AWS STS, the Security Token Service. STS checks the token against the trust policy on an IAM role. A trust policy is the rule that says who may assume that role. Many teams pin the exact &lt;code&gt;sub&lt;/code&gt; value in that policy, so only tokens about one specific identity are accepted. If the token arrives with a different &lt;code&gt;sub&lt;/code&gt;, STS refuses, and you get the error above.&lt;/p&gt;

&lt;p&gt;To mint those tokens, env0 keeps an internal system user for each customer organisation. Think of it as a robot account whose only job is to sign the proof. The customer AWS account trusts tokens about that one robot.&lt;/p&gt;

&lt;p&gt;Now the failure in one sentence, which is also how env0 put it in its postmortem: an organisation had two identical-looking robot users, env0 had always used one of them, the new code started using the other one, and the customer's AWS only trusts the first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the duplicates came from
&lt;/h2&gt;

&lt;p&gt;The duplicates were not new. According to the postmortem, a create race in early 2025 left some organisations with more than one system user, created seconds apart. A create race means two requests ran at nearly the same moment, each checked whether the user existed, each saw that it did not, and each created one.&lt;/p&gt;

&lt;p&gt;For more than a year, that did not matter. The old code looked the user up with a search in Auth0, the identity service env0 uses, and took the first result. The search returned the same user every time, so every token carried the same &lt;code&gt;sub&lt;/code&gt;, and AWS kept accepting them. A duplicate that nobody ever picks is harmless.&lt;/p&gt;

&lt;p&gt;The change on 10 November, in release v4.0.312, moved that lookup from the Auth0 search to a database table. The new code made a different choice when more than one row existed: it took the oldest row.&lt;/p&gt;

&lt;p&gt;Oldest sounds like a sensible tie-break. It is also a different tie-break from the one the system had effectively been using. For 21 organisations, the oldest row was not the user their tokens had used before. Four of those organisations minted tokens during the incident window. Two of them pinned &lt;code&gt;sub&lt;/code&gt; in their AWS trust policies, and those two failed. The other two did not pin &lt;code&gt;sub&lt;/code&gt;, so their deployments passed, with tokens about a different robot than the day before, and nobody noticed.&lt;/p&gt;

&lt;p&gt;That split is worth pausing on. The same change was a hard outage for two customers and a silent identity swap for two others. Pinning &lt;code&gt;sub&lt;/code&gt; is the stricter, safer setting, and it is exactly what turned a quiet change into a visible failure. The customers who had done the careful thing were the ones who broke.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the rollback did not roll back
&lt;/h2&gt;

&lt;p&gt;Here is the trap, and it is the reason this incident is worth your time.&lt;/p&gt;

&lt;p&gt;The old code took the first result of an unsorted Auth0 search. Unsorted means the code did not say in what order results should come back. Auth0, in practice, returns the most recently updated user first.&lt;/p&gt;

&lt;p&gt;From 08:57 UTC, the duplicate user minted every token. Minting a token updates that user, so for two hours the duplicate kept becoming the most recently updated one. When env0 rolled back to the previous version at 11:00, the old code ran its search, got the duplicate first, and picked it again.&lt;/p&gt;

&lt;p&gt;The rollback restored the old code. It did not restore the old choice, because the old choice depended on state that the incident itself had changed.&lt;/p&gt;

&lt;p&gt;This shape shows up in ordinary code all the time. Any &lt;code&gt;users[0]&lt;/code&gt; after a search with no explicit sort order is a choice made by the database, the search index, or the last writer, not by you. It works until the day something changes which row comes first. Then it changes silently, in production, and rolling back does not help if the new state now feeds the old code the same wrong answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why nobody saw it for 75 minutes
&lt;/h2&gt;

&lt;p&gt;The first failed deployment was at 08:59 UTC. env0 learned about the incident from a customer report at 10:14 UTC, one hour and fifteen minutes later. No alert had fired.&lt;/p&gt;

&lt;p&gt;The reason is uncomfortable and common. On env0's side, everything succeeded. The token mint worked every time. The failure happened later, in the customer's call to AWS STS, outside env0's logs. Alerts that watch your own error logs cannot see a failure that happens in somebody else's system.&lt;/p&gt;

&lt;p&gt;There was a second blind spot. The log line for a minted token recorded the key identifier as &lt;code&gt;****&lt;/code&gt;, masked out. So even after the report, env0's own logs could not say which robot user had minted the tokens. The answer was in the Auth0 action logs, which showed the minting user changing at 08:57, at the same moment as the deploy. Root cause was found within about 40 minutes of the report, from those logs.&lt;/p&gt;

&lt;p&gt;Masking identifiers in logs is a reasonable habit. Masking the one identifier you would need to tell two identical-looking identities apart is the kind of detail that only matters on the worst morning.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix, and the cache that kept it broken
&lt;/h2&gt;

&lt;p&gt;The mitigation was small and careful. Between about 11:11 and 11:21 UTC, env0 marked the duplicate users so that only the original could be selected. Ten duplicate users across six organisations. Each organisation kept the user with the most logins, because a check across all 80 duplicate groups, 30 for the OIDC user and 50 for another deployer user, showed that exactly one user per group had any logins. That gave the fix a safe rule: keep the one that has actually been used.&lt;/p&gt;

&lt;p&gt;And still the tokens used the duplicates. The lookup was cached. A cache is a stored copy of an earlier answer, kept so the next lookup is fast. This one held search results for 3,600 seconds, one hour. The corrected data was in place, but the cached answer still pointed at the duplicate.&lt;/p&gt;

&lt;p&gt;env0 refreshed the six stale cache entries one by one instead of flushing the whole cache. A full flush would have dropped cached token grants for everyone and risked rate limits from Auth0. At 11:35 UTC the original users started minting again, and by 11:36 deployments recovered. Total impact, about two hours and thirty-seven minutes.&lt;/p&gt;

&lt;p&gt;The permanent fix, as described in the postmortem, changes the rule itself: the selection always keeps the identity an organisation already uses, and it cannot change once set. Plus removing the duplicates, alerting when several organisations fail with the same error in a short window, and a check after each release that the minting user per organisation has not changed.&lt;/p&gt;

&lt;p&gt;One honest limit. The postmortem was written on the day, and at that point the permanent fix was approved but not yet merged. The counts above, 21 organisations where the oldest row differed, four that minted in the window, two that failed, are the postmortem's own numbers from its token logs. I have not named the affected customers, because the public summary does not name them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two guards you can add this week
&lt;/h2&gt;

&lt;p&gt;The first guard is to make the choice once, store it, and refuse to re-choose. If your system has a get-or-create step for a robot user, a service account, or any identity that other systems trust by name, the pick must be pinned. In Go, the shape looks like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s2"&gt;"context"&lt;/span&gt;
    &lt;span class="s2"&gt;"errors"&lt;/span&gt;
    &lt;span class="s2"&gt;"fmt"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;SystemUser&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="no"&gt;ID&lt;/span&gt;        &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="nc"&gt;OrgID&lt;/span&gt;     &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="nc"&gt;LoginCount&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nc"&gt;ErrDuplicateSystemUser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"more than one system user for org"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// pickSystemUser returns the pinned user for an org.&lt;/span&gt;
&lt;span class="c1"&gt;// If no pin exists yet, it pins the user that has actually been used,&lt;/span&gt;
&lt;span class="c1"&gt;// and fails loudly when that is ambiguous instead of guessing.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;pickSystemUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt; &lt;span class="nc"&gt;Store&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;orgID&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;SystemUser&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;pinned&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;PinnedSystemUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;orgID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;SystemUser&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;ok&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;pinned&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="c1"&gt;// once set, never re-choose&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SystemUsers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;orgID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// explicit order, never users[0] on an unsorted search&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;SystemUser&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;switch&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;CreateSystemUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;orgID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// unique constraint on org_id prevents the create race&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;SystemUser&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;PinSystemUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;orgID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;ID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;SystemUser&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;PinSystemUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;orgID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;ID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;SystemUser&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt;
    &lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;// Two or more rows. Keep the one with logins, and only if exactly one has them.&lt;/span&gt;
        &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;used&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nc"&gt;SystemUser&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;LoginCount&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;used&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;used&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;used&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;SystemUser&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Errorf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"%w: org %s has %d candidates"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;ErrDuplicateSystemUser&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;orgID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;PinSystemUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;orgID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;used&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;ID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;SystemUser&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;used&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The numbers and types here are illustrative. What matters is the shape. Zero rows creates and pins. One row pins. Two or more rows never silently picks the first, the oldest, or the most recent. It either finds the one that has been used, or it stops and asks a human. And behind all of it, a unique constraint on the organisation column in the database makes the original create race impossible, because the second insert fails instead of creating a twin.&lt;/p&gt;

&lt;p&gt;The same idea in Python, as a small check you can run after a deploy. This is the second guard: prove that the identity did not change.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;hashlib&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;fingerprint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Log and compare a hash, not the raw id. You can tell two users apart&lt;/span&gt;
    &lt;span class="c1"&gt;# in logs without printing the identifier itself.&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;hashlib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sha256&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hexdigest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;check_minting_users&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;before&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;after&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""before/after map org_id -&amp;gt; minting user id, sampled around a deploy."""&lt;/span&gt;
    &lt;span class="n"&gt;changed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;org_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;after&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;old&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;before&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;org_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;old&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;old&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;changed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;org_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;changed&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"__main__"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;before&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"minting-users-before.json"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;after&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"minting-users-after.json"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;changed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;check_minting_users&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;before&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;after&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;changed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"FAIL: minting user changed for {len(changed)} orgs: {changed}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"OK: minting user unchanged for {len(after)} orgs"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run that before and after any release that touches identity lookup, token minting, or account selection, and fail the deploy when the answer changes. env0's postmortem asks for exactly this check. It would have caught the 10 November change in minutes, because the minting user for four organisations changed at 08:57, while the release was still rolling out.&lt;/p&gt;

&lt;p&gt;There is a test worth writing next to both guards, and it is a boundary test. Feed your selection code zero rows, one row, and two rows. Zero should create. One should return that one. Two should never return a silent guess. Most get-or-create code is tested with zero and one, because those are the cases the author pictured. The duplicate case is the one that pages you two years later.&lt;/p&gt;

&lt;h2&gt;
  
  
  The takeaway
&lt;/h2&gt;

&lt;p&gt;Nothing in this incident required a big platform. A get-or-create with no unique constraint. A search with no sort order, and a &lt;code&gt;users[0]&lt;/code&gt; at the end of it. A tie-break changed from first-result to oldest-row in a release whose own description named the duplicate-user risk, but whose guard only covered the missing-row case. A cache that held the wrong answer for an hour. A log line that masked the one field that would have told the two users apart.&lt;/p&gt;

&lt;p&gt;Each of those is a line you can find in a code review on a quiet day. Is there a unique constraint behind this get-or-create. When this search returns two rows, which one wins, and who decided that. If the answer changes, does anything downstream trust the old answer by name. When we roll back, does the old code read state that the bad release already changed.&lt;/p&gt;

&lt;p&gt;env0 learned those answers on a Tuesday morning, from a customer, seventy-five minutes in. You can learn yours from a test with two rows in it.&lt;/p&gt;

&lt;p&gt;Where in your system does a &lt;code&gt;users[0]&lt;/code&gt;, a first result, or an oldest row decide which identity, account, or record everyone downstream trusts, and what happens on the day a second row appears?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Sources: env0 status postmortem, Failed AWS deployments using OIDC authentication, 10 November 2026, 08:58 to 11:36 UTC, including the detailed postmortem OIDC Tokens Switched to a Duplicate System User and AWS Rejected Them for 2.5 Hours. The postmortem does not publish the affected customers in its public summary, so they are not named here, and the permanent fix was approved but not merged when the postmortem was written. The Go and Python snippets above show the shape of the guards, not env0 source code.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>cicd</category>
      <category>aws</category>
      <category>backend</category>
    </item>
    <item>
      <title>The cache that kept restarting empty: inside ElevenLabs' November 18 outage</title>
      <dc:creator>Kashif Manzer</dc:creator>
      <pubDate>Wed, 25 Nov 2026 14:12:59 +0000</pubDate>
      <link>https://dev.to/kashif_manzer/the-cache-that-kept-restarting-empty-inside-elevenlabs-november-18-outage-2i3l</link>
      <guid>https://dev.to/kashif_manzer/the-cache-that-kept-restarting-empty-inside-elevenlabs-november-18-outage-2i3l</guid>
      <description>&lt;p&gt;Wednesday 18 November 2026, just before three in the afternoon, UTC. ElevenLabs started failing in a way that did not look like one product going down. It looked like almost everything getting slower at once, then failing in different proportions.&lt;/p&gt;

&lt;p&gt;Voices, Creative, Studio, Music, Reader, and the login and workspace routes failed 12% to 50% of requests at the peak. Text to Speech kept working, but slower, with a 3.4% failure rate and a longer wait for the first sound. Some inbound calls to ElevenAgents over SIP and Twilio failed to connect between 15:45 and 17:15 UTC. Other ways of starting the same conversations stayed up. The impact was mostly in the US. Singapore was not affected at all.&lt;/p&gt;

&lt;p&gt;That spread is the first clue. When one feature breaks, you look for a bad deploy. When half the platform breaks at different rates, you look for something they all share. ElevenLabs found it in the cache.&lt;/p&gt;

&lt;p&gt;This is the story of incident INC-465, and it is a story about a cache that kept rebuilding itself, and about application servers that kept opening new connections because nobody had told them when to stop.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a cache is, and what rebuilding means
&lt;/h2&gt;

&lt;p&gt;A cache is a fast copy of data you would otherwise fetch slowly, again and again. Think of it as a whiteboard next to your desk. Instead of walking to the filing cabinet for every fact, you write the facts you use most on the board and read them from there.&lt;/p&gt;

&lt;p&gt;ElevenLabs keeps voice data in a caching cluster. A cluster is just a group of machines working as one store. When a request needs a voice, the application server asks the cache first. If the voice is there, the answer comes back fast. If it is not there, the server has to go and get it the slow way, then write it on the board for next time.&lt;/p&gt;

&lt;p&gt;A full cache rebuild is what happens when the board gets wiped and every entry has to be fetched again at once. One rebuild is expensive but survivable. Repeated full rebuilds, triggered by a burst of concurrent requests, are a different thing. Each rebuild uses memory and client buffers. Client buffers are the small holding areas where a server keeps messages that are waiting to be sent or read. Fill those, and the server has nowhere left to put new work.&lt;/p&gt;

&lt;p&gt;According to the write-up, that is what happened on 18 November. A burst of concurrent requests triggered repeated full cache rebuilds on the voice caching cluster. The rebuilds exhausted its memory and its client buffers.&lt;/p&gt;

&lt;p&gt;On its own, that might have been a slow afternoon. It became an outage because of what the application servers did next.&lt;/p&gt;

&lt;h2&gt;
  
  
  The missing limit
&lt;/h2&gt;

&lt;p&gt;Here is the sentence in the write-up that matters most. Backend services had no upper bound on cache connections.&lt;/p&gt;

&lt;p&gt;A connection is an open line between two machines. To talk to the cache, an application server opens a connection and sends requests down it. One server might hold a handful of connections and reuse them. That is the normal shape.&lt;/p&gt;

&lt;p&gt;Now picture what happens when the cache slows down. Requests take longer. The application server still has new work arriving. If it can open a new connection whenever the old ones are busy, it will. That feels helpful in the moment. More lines, more throughput. But each new connection is also more load on a cache that is already struggling, and more state the cache has to hold.&lt;/p&gt;

&lt;p&gt;ElevenLabs says slowed responses caused application servers to open connections until the cluster hit its maximum client limit. A client limit is a hard cap on how many connections the cache will accept at all. Hit that cap, and new connections get refused. The cluster then failed its health checks. A health check is a small regular probe that asks, are you still able to serve traffic. Fail enough probes, and the system restarts the node to try to recover.&lt;/p&gt;

&lt;p&gt;And here is the trap. The restarted node came back with an empty cache.&lt;/p&gt;

&lt;p&gt;An empty cache means every request misses, every miss triggers a slow fetch, and the slow fetches pile up exactly the way they did before. So the cluster entered what the write-up calls a repeating restart cycle with an empty cache. Restart, empty board, burst of misses, memory pressure, failed health checks, restart again.&lt;/p&gt;

&lt;p&gt;Meanwhile, requests queued up on the application servers. Queued requests are requests that have arrived but have nowhere to go. Those queues then cascaded the same connection exhaustion to other caching clusters. One cluster drowning pulled the others under, because the same application servers talked to all of them with the same missing limit.&lt;/p&gt;

&lt;h2&gt;
  
  
  The second day, and the stale counter
&lt;/h2&gt;

&lt;p&gt;The main incident ran from 14:49 to 20:55 UTC on 18 November, with the peak between 15:45 and 17:15. A smaller related disruption followed on 19 November, from 14:10 to 15:20 UTC.&lt;/p&gt;

&lt;p&gt;On the second day, a server hosting one of the caches reached its limit for new network connections, and connections to that cache timed out. That is a different limit from the client limit on day one. It is the operating system level cap on how many network connections one machine can open.&lt;/p&gt;

&lt;p&gt;The effect was specific. ElevenLabs stores ElevenAgents active call counts in that cache. When a call ends, the count should go down. During the timeout window, ended calls were not consistently removed from the counts. So the counts stayed high, customers hit their concurrency limits, and about 10% of new conversations were refused between 14:10 and 15:20 UTC. The team cleared the stale counts at 15:17 and raised the connection limit on all servers hosting these caches.&lt;/p&gt;

&lt;p&gt;Notice the shape of that second failure. The cache was not even fully down. It was just unreachable for new connections for a while, and that was enough for a counter stored in it to drift away from reality. Any system that keeps a count in a cache and only decrements it on the happy path has this bug waiting inside it. If the decrement fails, the count lies, and the lie blocks real users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this is not just a cache story
&lt;/h2&gt;

&lt;p&gt;It is tempting to file this under cache sizing and move on. ElevenLabs did increase the capacity of its caching clusters, and that is part of the fix. But capacity alone does not explain the cascade. Three separate mechanisms lined up.&lt;/p&gt;

&lt;p&gt;First, rebuilds were not coalesced. When many requests miss at once, they should not each trigger their own rebuild of the same data. One request should do the rebuild while the others wait for its result. Without that, a burst becomes a stampede.&lt;/p&gt;

&lt;p&gt;Second, connections were unbounded. Every slow response made the system open more connections, which made the cache slower, which made the system open more connections. That is a feedback loop, and feedback loops do not settle on their own. They run until something hard stops them. Here, the hard stop was the maximum client limit, followed by health check failures.&lt;/p&gt;

&lt;p&gt;Third, the restart made things worse, not better. Restarting a stateless service usually helps. Restarting a cache throws away the very thing that makes it fast. A health check that restarts a cache under load can turn a slow cache into an empty cache, and an empty cache under load is slower than a slow one.&lt;/p&gt;

&lt;p&gt;None of these needs a big platform to bite. A small service with one Redis instance, one application server, and a cache-aside pattern has all three. Cache-aside is the common pattern where the application checks the cache first, and on a miss, fetches from the database and writes the value back. It is simple, it works, and under a burst it produces exactly the stampede above.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two guards you can add this week
&lt;/h2&gt;

&lt;p&gt;The first guard is a bounded connection pool with a wait limit. A pool is a fixed set of reusable connections. Bounded means the pool has a maximum size, and when all connections are busy, new work waits a short time and then fails fast instead of opening connection number 500. Failing fast sounds bad. It is better than dragging the cache down for everyone.&lt;/p&gt;

&lt;p&gt;In Go, using a Redis client, the shape looks like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s2"&gt;"context"&lt;/span&gt;
    &lt;span class="s2"&gt;"time"&lt;/span&gt;

    &lt;span class="s2"&gt;"github.com/redis/go-redis/v9"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;newCacheClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;addr&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;NewClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Options&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Addr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;         &lt;span class="n"&gt;addr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nc"&gt;PoolSize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;     &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;               &lt;span class="c1"&gt;// hard upper bound on connections&lt;/span&gt;
        &lt;span class="nc"&gt;MinIdleConns&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nc"&gt;DialTimeout&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Second&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nc"&gt;ReadTimeout&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="mi"&gt;500&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Millisecond&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nc"&gt;WriteTimeout&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Millisecond&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nc"&gt;PoolTimeout&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="mi"&gt;200&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Millisecond&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// fail fast when the pool is full&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;getVoice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// A short deadline means a slow cache cannot hold a request forever.&lt;/span&gt;
    &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cancel&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;WithTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Millisecond&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="nf"&gt;cancel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Result&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The numbers here are illustrative. Your right pool size depends on your traffic and your cache. What matters is that a number exists, that waiting has a limit, and that a slow cache returns an error quickly so the caller can fall back, shed load, or serve a stale value instead of piling up.&lt;/p&gt;

&lt;p&gt;The same idea in Python, with the redis library.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;

&lt;span class="n"&gt;pool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ConnectionPool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"cache.internal"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;6379&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;max_connections&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;          &lt;span class="c1"&gt;# hard upper bound&lt;/span&gt;
    &lt;span class="n"&gt;socket_connect_timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;2.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;socket_timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;retry_on_timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;      &lt;span class="c1"&gt;# do not retry into a struggling cache&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;connection_pool&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_voice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;RedisError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# Fail fast. Let the caller decide: stale value, default, or error.&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second guard is request coalescing for rebuilds, often called singleflight. When ten requests miss the same key at the same moment, only one of them should fetch from the database. The other nine wait and share the result. Go has this in the standard extended library as golang.org/x/sync/singleflight.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s2"&gt;"context"&lt;/span&gt;
    &lt;span class="s2"&gt;"time"&lt;/span&gt;

    &lt;span class="s2"&gt;"golang.org/x/sync/singleflight"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;rebuilds&lt;/span&gt; &lt;span class="n"&gt;singleflight&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Group&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;loadVoice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fetch&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Only one caller runs fetch for this key. The rest share its result.&lt;/span&gt;
    &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;rebuilds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Do&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;any&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;fetchCtx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cancel&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;WithTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Background&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Second&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="nf"&gt;cancel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fetchCtx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Python, a per-key lock does the same job in a single process. For multiple processes, the lock needs to live somewhere shared, but the shape is the same. One rebuild at a time per key, everyone else waits or serves stale.&lt;/p&gt;

&lt;p&gt;There is a third small habit worth stealing from the second day of this incident. If you store a counter in a cache, give every increment a way back that does not depend on the happy path. A lease with an expiry time does this well. Instead of incrementing a count when a call starts and decrementing it when the call ends, store a key per active call with a short time to live, and refresh it while the call is alive. If the refresh stops, the key expires on its own and the count corrects itself. No decrement to lose.&lt;/p&gt;

&lt;h2&gt;
  
  
  What ElevenLabs says it changed
&lt;/h2&gt;

&lt;p&gt;The write-up lists four preventative actions. The team has already increased the capacity of its caching clusters and added limits within its services so the clusters are not overloaded the same way. It is reviewing the caching layer across all engineering teams, including isolation between clusters, rate limiting, and health checks. It will review how caching and datastore services are provisioned with its DevOps team. And it will remove EU and India voice dependencies on the US environment, so a US incident cannot reach into those regions through shared voices.&lt;/p&gt;

&lt;p&gt;That list matches the mechanisms. Limits for the unbounded connections. Isolation for the cascade. Health check review for the restart loop. Removing cross-region dependencies for the blast radius. Capacity helps, but notice that capacity is listed first and limits are listed in the same breath. A bigger cache with no limits just takes longer to drown.&lt;/p&gt;

&lt;p&gt;One honest limit on this article. The write-up does not say what the burst of concurrent requests was, or why it triggered full rebuilds rather than ordinary misses. It does not publish pool sizes, client limits, or timings for individual rebuilds. So the code above shows the shape of the guards, not ElevenLabs code, and the numbers in it are starting points to measure against your own traffic, not values copied from the incident.&lt;/p&gt;

&lt;h2&gt;
  
  
  The takeaway
&lt;/h2&gt;

&lt;p&gt;A cache is supposed to absorb load. In this incident, the cache became a load amplifier, because three ordinary defaults lined up. Rebuilds that every request could trigger. Connections that every slow response could multiply. Restarts that wiped the cache clean at the worst possible moment.&lt;/p&gt;

&lt;p&gt;None of those defaults looks dangerous on a quiet Tuesday. All three are visible in code review if you know to look. Is there a maximum on this pool. Is there a timeout on this wait. When this key misses ten times at once, how many fetches run. When this counter goes up, what brings it down if the request dies halfway.&lt;/p&gt;

&lt;p&gt;ElevenLabs learned those answers during a six hour window on a Wednesday afternoon, with a second act the next day. You can learn yours from a config file.&lt;/p&gt;

&lt;p&gt;When did you last check whether your cache client has an upper bound on connections, and what happens in your system when it hits it?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Sources: ElevenLabs, incident INC-465 write-up, Increased Latency and Errors Across Most Products, 18 to 19 November 2026, published on the ElevenLabs status page. The write-up does not publish pool sizes, client limits, or the trigger for the request burst, so the Go and Python snippets above show the shape of the guards, not ElevenLabs source code.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>backend</category>
      <category>devops</category>
      <category>cache</category>
      <category>go</category>
    </item>
    <item>
      <title>One pipeline, one document, and 46 minutes of stalled deploys</title>
      <dc:creator>Kashif Manzer</dc:creator>
      <pubDate>Mon, 23 Nov 2026 14:11:10 +0000</pubDate>
      <link>https://dev.to/kashif_manzer/one-pipeline-one-document-and-46-minutes-of-stalled-deploys-1aa0</link>
      <guid>https://dev.to/kashif_manzer/one-pipeline-one-document-and-46-minutes-of-stalled-deploys-1aa0</guid>
      <description>&lt;p&gt;Friday 13 November 2026, just before six in the evening, UTC. Pipelines on Harness prod3 started hanging.&lt;/p&gt;

&lt;p&gt;Not all of them, and not all at once. Some slowed to a crawl. Some would not start at all. Some sat there long enough that the platform gave up on them, aborting any execution that had been stuck for more than five minutes. Two customers reported the slowdown. The rest of the platform looked fine.&lt;/p&gt;

&lt;p&gt;There had been no deploy to blame. No config change, no bad release, no spike in traffic that anyone could point at. The pipelines were just... stopping. That is the kind of failure that makes an on-call engineer reach for a second coffee, because the usual suspects are all innocent and the clock is running.&lt;/p&gt;

&lt;p&gt;This is the story of what they found, and it is a story about a single document.&lt;/p&gt;

&lt;h2&gt;
  
  
  The clue that narrowed it down
&lt;/h2&gt;

&lt;p&gt;The first useful fact was the boundary. The trouble was confined to prod3, one of Harness's environments, and to the part of the platform that runs pipelines: Continuous Delivery, Next Generation, or CDNG for short. Everything else was healthy.&lt;/p&gt;

&lt;p&gt;The second useful fact was what the slowdown had in common. The pipelines that hung were not the biggest ones, or the newest ones, or the ones from a particular customer. They were the ones whose progress had to be recorded through the same database node, the one that backs pipeline orchestration in prod3. That node was saturated. Its CPU was maxed out and its write capacity was exhausted, so every pipeline that needed it had to wait in line behind work that was never going to finish quickly.&lt;/p&gt;

&lt;p&gt;So the question changed. It was no longer "why are pipelines hanging?" It was "what is hammering this one database node?"&lt;/p&gt;

&lt;p&gt;The answer was a single customer pipeline.&lt;/p&gt;

&lt;h2&gt;
  
  
  One document for the whole pipeline
&lt;/h2&gt;

&lt;p&gt;To understand why one pipeline could do that, you need to know how Harness tracks a pipeline while it runs.&lt;/p&gt;

&lt;p&gt;A pipeline is a set of stages. A stage might build code, run tests, or deploy to a cluster. Stages can run one after another, or side by side. While a pipeline runs, the platform keeps a record of where each stage has got to: started, running, finished, failed. That record is what the user interface shows you, and it is what the platform itself consults to decide what to do next.&lt;/p&gt;

&lt;p&gt;In Harness's design, that record lives in a single internal data structure for the whole execution. One document per pipeline run. Every stage writes its progress into that same document.&lt;/p&gt;

&lt;p&gt;A document, in plain terms, is a single stored record in a database, like one row in a spreadsheet that holds a whole bundle of related fields. When a stage finishes a step, the platform opens that document, updates the field for that stage, and saves it back. Under normal conditions this is cheap. A pipeline has a handful of stages, they mostly take turns, and the document is small.&lt;/p&gt;

&lt;p&gt;On 13 November, one customer's pipeline broke both of those assumptions at once.&lt;/p&gt;

&lt;h2&gt;
  
  
  Too many writers, one page
&lt;/h2&gt;

&lt;p&gt;The triggering pipeline ran with an unusually large number of stages at the same time. The postmortem does not give the exact number, and this article will not guess at one. What matters is the shape: dozens of stages, all live at once, all trying to write their progress into the same single document.&lt;/p&gt;

&lt;p&gt;When two writers try to update the same document at the same moment, their writes conflict. The database can only accept one at a time, so the loser has to try again. That is normal, and a single retry costs almost nothing.&lt;/p&gt;

&lt;p&gt;But here the retries piled up. Each conflicting write had to be retried, and as the queue of pending writes grew, operations started timing out on an internal lock-wait window. A lock-wait window is a time limit: how long a write is allowed to wait its turn before the system gives up waiting politely and resubmits the write to the database directly. Those resubmissions added more load to a node that was already saturated.&lt;/p&gt;

&lt;p&gt;And then the third loop kicked in. As the pipeline grew in size, its state document grew larger too, because there were more stages to record. A larger document takes longer to read, update, and save. So each individual write got slower, which made the queue longer, which made more writes time out, which made more writes get resubmitted.&lt;/p&gt;

&lt;p&gt;Three loops, all feeding each other: conflicts creating retries, retries creating timeouts, and a growing document making every write slower than the last. One pipeline, writing to one document, had turned into a denial of service against its own database node. And because every pipeline in prod3 shared that node, they all paid for it.&lt;/p&gt;

&lt;p&gt;The incident lasted 46 minutes, from 17:56 to 18:42 UTC. It ended the way these things sometimes do: not with a heroic fix, but because the triggering pipeline finished its updates. Its stages completed, the writes stopped, CPU usage fell back to normal, write latency recovered, and the backlog of delayed pipeline events cleared. By the time the responders had isolated the triggering pipeline as the cause, recovery was already under way. No scale-up, no restart, no failover was needed.&lt;/p&gt;

&lt;p&gt;Harness's interim safeguard was to increase the lock-wait window, which lowers the chance of writers piling up, though the postmortem is honest that it does not eliminate it. The permanent fix, in progress at the time the postmortem was published on 18 November, is architectural: split a pipeline execution's state across multiple documents, sharded by stage, so no single execution can concentrate that much write contention on one document or one database primary, whatever its size.&lt;/p&gt;

&lt;h2&gt;
  
  
  The pattern to steal
&lt;/h2&gt;

&lt;p&gt;This failure has a name in database circles: a hot document, or a hot key. It is one record that every writer in the system needs at the same time. It shows up in places you would not expect. A single row that tracks a global counter. One document that holds an entire shopping cart. A status record for a whole job that every worker updates. The shape is always the same: many writers, one record, and a queue that grows faster than it drains.&lt;/p&gt;

&lt;p&gt;If you keep state in one place per job, here is the shape of the fix, in two languages.&lt;/p&gt;

&lt;p&gt;First, shard the state. Instead of one document per execution that every stage writes to, give each stage its own document, and read the full picture by gathering them. In Go, that looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c1"&gt;// One state record per stage, not one per execution.&lt;/span&gt;
&lt;span class="c1"&gt;// Stages write to different keys, so they never queue on each other.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;stageStateKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;executionID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stageID&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"exec:"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;executionID&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;":stage:"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;stageID&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;recordStageProgress&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;store&lt;/span&gt; &lt;span class="nc"&gt;Store&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;executionID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stageID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Put&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;stageStateKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;executionID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stageID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;StageState&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;StageID&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;   &lt;span class="n"&gt;stageID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nc"&gt;Status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;    &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nc"&gt;UpdatedAt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Reading the whole execution means gathering the stage records.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;executionSummary&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;store&lt;/span&gt; &lt;span class="nc"&gt;Store&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;executionID&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nc"&gt;StageState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ListByPrefix&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"exec:"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;executionID&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;":stage:"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The trade is deliberate. Writes get cheaper and never block each other. Reads get slightly more expensive, because you gather several small records instead of opening one big one. That is almost always the right trade, because a hot write path hurts everyone at once, while a slightly slower read hurts one reader.&lt;/p&gt;

&lt;p&gt;Second, bound the retries. A retry is a second attempt at work the system could not complete, and retries without a limit are how a small conflict becomes a flood. In Python, a retry with jittered backoff and a hard cap looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;update_with_retry&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;update_fn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_attempts&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;base_delay&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""Retry a conflicting write a few times, with a random delay
    so competing writers do not all retry in the same instant."""&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_attempts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;update_fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nc"&gt;WriteConflict&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;max_attempts&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;raise&lt;/span&gt;
            &lt;span class="n"&gt;delay&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;base_delay&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uniform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;base_delay&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two details matter here. The delay doubles each time, so a writer that keeps losing backs off further instead of hammering the same document. And the random part, the jitter, stops every loser from retrying at the same instant and colliding again. Without jitter, retries synchronise, and a synchronised retry storm is just the original conflict wearing a different hat.&lt;/p&gt;

&lt;p&gt;Third, watch the write rate per entity, not just the total. Harness's own next steps include monitoring that can spot one execution driving a disproportionate share of database writes. A dashboard that shows total write load would have shown a saturated node and nothing else. A per-execution breakdown would have pointed straight at the one pipeline. If you run a system where many tenants share one store, alert on the single loudest writer, not just on the total volume. The loudest writer is usually the story.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to take away
&lt;/h2&gt;

&lt;p&gt;The pipeline that caused this outage was not broken. It was doing exactly what pipelines are for: running many stages at once. The platform's design assumed that would stay cheap, because one document per execution had always been cheap. It was cheap right up until a pipeline arrived that was big enough to make it expensive, and then it was expensive for everyone sharing that node.&lt;/p&gt;

&lt;p&gt;That is the part worth sitting with. The failure was not a bug in the usual sense. Nobody wrote the wrong code. The design simply had a scaling limit hidden inside it, and the limit was measured in concurrent writers to a single record. Limits like that do not announce themselves. They wait for the first customer big enough to find them.&lt;/p&gt;

&lt;p&gt;So the question is not whether your system has a hot document in it. Most systems do, somewhere, in a counter, a status record, or a per-job summary that every worker updates. The question is whether you know which record it is, and what happens on the day two dozen writers arrive at it at once.&lt;/p&gt;

&lt;p&gt;When did you last check what your busiest single record costs when everyone writes to it at the same time?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Sources: Harness, "Pipeline slowness on prod3", status page postmortem published 18 November 2026. Incident 13 November 2026, 17:56 to 18:42 UTC, 46 minutes. The Go and Python snippets show the shape of the fix, not Harness source code.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>backend</category>
      <category>devops</category>
      <category>database</category>
      <category>cicd</category>
    </item>
    <item>
      <title>The column nobody monitored: how a 32-bit integer stopped Clickpost's orders for 54 minutes</title>
      <dc:creator>Kashif Manzer</dc:creator>
      <pubDate>Sun, 22 Nov 2026 14:11:34 +0000</pubDate>
      <link>https://dev.to/kashif_manzer/the-column-nobody-monitored-how-a-32-bit-integer-stopped-clickposts-orders-for-54-minutes-24gf</link>
      <guid>https://dev.to/kashif_manzer/the-column-nobody-monitored-how-a-32-bit-integer-stopped-clickposts-orders-for-54-minutes-24gf</guid>
      <description>&lt;p&gt;Monday 2 November 2026, just after four in the afternoon, India time. Clickpost's order creation API started returning server errors. Not for every order. Orders for 91 carriers went through as normal. Orders for every other carrier failed with HTTP 5xx errors, the code a server sends when something has gone wrong on its side.&lt;/p&gt;

&lt;p&gt;That split was the first clue, and it is the detail that makes this incident worth sitting with. Two services doing the same job, one failing, one fine. The difference between them was not load, not traffic, and not a bad deploy. It was a single column in a table nobody used any more, holding a number that had quietly run out of room.&lt;/p&gt;

&lt;h2&gt;
  
  
  What broke
&lt;/h2&gt;

&lt;p&gt;Clickpost creates orders through two services. A newer one, written in Kotlin, handles 91 carriers. An older one, written in Python, handles v3 order creation for all the other carriers. After an order is created, a post-processing step does follow-up work, and it used to write a log row into a dedicated logging table, recording the ID of a related record.&lt;/p&gt;

&lt;p&gt;That logging table had been deprecated in a February 2026 release. Deprecated, in plain terms, means the team had decided to stop using it. But deprecating a table and removing every write to it are two different jobs, and only one of them got done. The code that wrote to the table was removed from the Kotlin path, and left in the Python path.&lt;/p&gt;

&lt;p&gt;Meanwhile, the IDs being copied into the logging table kept growing. The related records they came from use IDs with no 32-bit limit. The logging column did have a limit. It was a 32-bit signed integer.&lt;/p&gt;

&lt;h2&gt;
  
  
  A number with a ceiling
&lt;/h2&gt;

&lt;p&gt;A 32-bit signed integer is a whole number stored in 32 binary digits, with one digit reserved for the sign, positive or negative. That leaves 31 digits for the size of the number, so the largest value it can hold is 2,147,483,647. One more than that, and it does not fit. There is no rounding, no overflow into a bigger type. The database simply refuses the write.&lt;/p&gt;

&lt;p&gt;At about 16:08 IST on 2 November, a newly created related record got an ID above 2,147,483,647. The database rejected the log write. And because that write ran synchronously, inside the same request as the order itself, the rejection failed the whole order. Synchronous means the order request waited for the log write to finish before it could answer. The logging step was not essential to the order. It was a note in a table nobody read any more. But because it ran in line, its failure became the order's failure.&lt;/p&gt;

&lt;p&gt;Every order on the Python path got the same treatment. Orders for the 91 carriers on the Kotlin service, which no longer called the legacy logging code at all, went through.&lt;/p&gt;

&lt;p&gt;Monitoring flagged the rise in 5xx errors within a minute. Comparing the two services showed that only the Python side was failing, which pointed the team at the legacy write. They disabled it, and order creation was restored at 17:02 IST. Fifty-four minutes, start to finish.&lt;/p&gt;

&lt;h2&gt;
  
  
  The check that could not see it
&lt;/h2&gt;

&lt;p&gt;Here is the part that should worry you, because Clickpost did have an overflow monitor. Most organisations with a large database already watch for integer columns approaching their limit. Clickpost watched for it too. The problem was which columns it watched.&lt;/p&gt;

&lt;p&gt;In Clickpost's own words from the root cause analysis, published on 3 November: "Our integer capacity checks covered only primary key and foreign key columns." A primary key is the column that identifies each row in a table. A foreign key is a column that holds another table's ID and is formally declared as a reference to it. The column that broke stored another table's ID, but it was never declared as a foreign key, so the check never looked at it.&lt;/p&gt;

&lt;p&gt;That is an easy list to build, which is why it is so common. Primary and foreign keys are written down in the database catalog, the database's own record of its schema. A short query reads them out. On a well-modelled schema, that list finds the columns people usually think of as IDs. But the check is only as good as the schema's declarations. Without a declared constraint, a column holding another table's ID looks like any other integer column.&lt;/p&gt;

&lt;p&gt;And the columns most likely to lack a declared foreign key are the ones in the least-maintained parts of a database. Logging and audit tables often leave foreign keys out on purpose, because a constraint on a high-volume append table costs write performance and blocks deleting the parent rows. Columns added in a hurry leave them out by accident. Tables on their way out get no new constraints and no new reviews. Clickpost's column sat in two of those places at once: a logging table holding a reference without a constraint, in a table already marked deprecated.&lt;/p&gt;

&lt;p&gt;The column also gave no warning of its own. Between February and November, the only change to the logging table was that the numbers in it got larger. A monitor built from declarations had no reason to notice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two more gaps behind the same failure
&lt;/h2&gt;

&lt;p&gt;Clickpost's report names three contributing factors, and the monitoring gap is only one of them.&lt;/p&gt;

&lt;p&gt;The first is incomplete decommissioning. The table was marked deprecated in February, but the code writing to it was removed from only one of the two order creation paths. There was no check confirming that all writes to the table had stopped. A label that says "not in use" is a claim, and claims need evidence. In this case the evidence would have been simple: no writes to the table for some period, or a search of the code for every writer.&lt;/p&gt;

&lt;p&gt;The second is logging in the critical path. The critical path is the chain of steps a request must complete before it can answer. Anything on it can fail the request. A log write is not part of making an order, so it should never have been able to stop one. Had the write been asynchronous, fired off in the background while the order carried on, the overflow would have cost a log row, not an order. Had the decommissioning been complete, the write would have been gone months before the IDs reached the ceiling.&lt;/p&gt;

&lt;h2&gt;
  
  
  The audit you can run this week
&lt;/h2&gt;

&lt;p&gt;The fix Clickpost chose starts with selecting columns by what they hold, not by what they are declared as. You can run the same audit on your own database in an afternoon. The idea is simple: list every integer column, read its current maximum, and compare it with the limit of its type.&lt;/p&gt;

&lt;p&gt;Start with the list. In Postgres, the catalog query looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;table_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;column_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data_type&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;information_schema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;columns&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;data_type&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'smallint'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'integer'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'bigint'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That gives you every integer column, declared keys or not. Then, for each one, find the maximum value it holds and work out how close that is to the ceiling of its type. A small Python script does the arithmetic:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="no"&gt;LIMITS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"smallint"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;32_767&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"integer"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2_147_483_647&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"bigint"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;9_223_372_036_854_775_807&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;usage_percent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;column_type&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;max_value&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="no"&gt;LIMITS&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;column_type&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# flag anything past 80 percent of its limit&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;column_type&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;audit_results&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;used&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;usage_percent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;column_type&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;used&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{column}: {used:.1f}% of its {column_type} limit"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On a very large table, the maximum can come from statistics or a sample rather than a full scan, as long as a column whose maximum is climbing fast still gets flagged well before it reaches the ceiling. The point is not a perfect measurement. The point is that every integer column is in scope, including the ones with no declared key.&lt;/p&gt;

&lt;p&gt;The boundary test is worth writing down, because it is the test Clickpost's monitor could never have run. For a 32-bit signed integer column, check three values: one below the limit, one at it, and one above it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c1"&gt;// illustrative: a guard before an insert, not Clickpost's code&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;MaxInt32&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Errorf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"id %d exceeds the 32-bit limit %d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;MaxInt32&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2,147,483,646 fits. 2,147,483,647 fits, just barely. 2,147,483,648 does not fit, and the database will refuse it. If your code has no guard like this, the first time you learn about the ceiling is the day an order fails.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Clickpost changed
&lt;/h2&gt;

&lt;p&gt;Every contributing factor got at least one corrective action, so the same failure cannot recur through any of the three gaps. Every integer column that stores IDs or user-supplied values is to be found, monitored, and widened to 64 bits where possible, so the limit no longer applies. A logging failure can no longer fail an order creation request. And a table cannot be marked deprecated while any code still writes to it.&lt;/p&gt;

&lt;p&gt;Those three actions are a good template, and they are cheap compared with 54 minutes of failed orders. The audit is the one to do first, because it is the one that finds problems you do not know you have. A decommissioning check only covers tables you already know about. A logging fix only covers writes you already know are synchronous. The column audit covers the whole schema, including the tables nobody has looked at since February.&lt;/p&gt;

&lt;p&gt;So here is the question to take into your next week. If your overflow monitor builds its list from key constraints, how many integer columns in your schema hold IDs and have no declared constraint at all? Those are the columns your alerting cannot see. In Clickpost's case, one of them passed 2,147,483,647 in November, in a table that had been deprecated since February. When did you last check yours?&lt;/p&gt;

</description>
      <category>backend</category>
      <category>database</category>
      <category>python</category>
      <category>devops</category>
    </item>
    <item>
      <title>The disaster-recovery test that took down production: inside Workday's November 13 outage</title>
      <dc:creator>Kashif Manzer</dc:creator>
      <pubDate>Fri, 20 Nov 2026 14:13:42 +0000</pubDate>
      <link>https://dev.to/kashif_manzer/the-disaster-recovery-test-that-took-down-production-inside-workdays-november-13-outage-2122</link>
      <guid>https://dev.to/kashif_manzer/the-disaster-recovery-test-that-took-down-production-inside-workdays-november-13-outage-2122</guid>
      <description>&lt;p&gt;Friday 13 November 2026, just after five in the evening on the east coast of the United States. People were wrapping up the working week. Some tried to clock out. Some tried to check their pay. Some were in the last days of open enrolment for their benefits, trying to finish before the deadline. Workday, the system their employers use for all of that, would not let them in.&lt;/p&gt;

&lt;p&gt;By early evening the reports were piling up. Downdetector logged nearly 3,000 outage reports shortly after 22:00 GMT. Universities and employers started posting the same message to their staff: Workday is down, we do not know when it will be back, write your hours down on paper.&lt;/p&gt;

&lt;p&gt;Then came the detail that turns this from an ordinary outage into a story worth sitting with. Workday was not down because something had broken on its own. It was down because of a safety exercise. The drill meant to prove the system could survive a disaster had become the disaster.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Workday actually said
&lt;/h2&gt;

&lt;p&gt;Workday's public updates ran through its Community status page, which needs a customer login, so the public record was assembled largely by university IT departments reposting the vendor's notice. Washington University in St. Louis reproduced it verbatim:&lt;/p&gt;

&lt;p&gt;"While validating the weekly Maintenance Window for Disaster Recovery tenants, we have identified that tenanted services within the DR Site unexpectedly connected to Production databases. As a result, this has left data in an inconsistent state that can cause errors accessing tenants or jobs/integrations/tasks to fail with missing transaction error messages. Effective immediately, we are placing all WD1 Production tenants into Maintenance while our teams investigate the best recovery path. We will provide updates every 30 minutes while we work to resolve this issue."&lt;/p&gt;

&lt;p&gt;Read that slowly, because every clause matters.&lt;/p&gt;

&lt;p&gt;A disaster recovery site, usually shortened to DR site, is a second copy of a system kept ready in case the first one fails. A tenant is one customer's slice of a shared platform: your employer's payroll, time off and benefits, kept separate from every other employer's. WD1 is the name of one of Workday's production data centre environments. A maintenance window is a scheduled period when a system may be taken offline for updates.&lt;/p&gt;

&lt;p&gt;Workday was validating the maintenance cycle for its DR tenants. During that validation, services running inside the DR site connected to the databases that hold live customer transactions. The data was left in an inconsistent state, which is a careful way of saying that different parts of the system now disagreed about what was true. Jobs and integrations started failing with "missing transaction" errors: a background job would look up a transaction and find that it was not there, or not there in the form it expected.&lt;/p&gt;

&lt;p&gt;Workday's response was to freeze everything. All WD1 production tenants went into maintenance at once. That is the part worth pausing on. They did not restart a few servers and see what happened. They stopped the whole environment. The reason tells you what kind of failure this was.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why inconsistent data is worse than downtime
&lt;/h2&gt;

&lt;p&gt;When a server crashes, you restart it and it comes back with the same data it had before. The data was never in doubt, only the machine running it.&lt;/p&gt;

&lt;p&gt;This was the opposite shape. The machines were fine. The data was suspect. If you restart a service and it loads the same suspect data, you have not fixed anything. You have just reloaded the problem, faster.&lt;/p&gt;

&lt;p&gt;That is why the recovery took the shape it did. Through Friday night and Saturday, Workday was not rebooting. It was validating data, reindexing tenants and releasing them in stages. Reindexing means rebuilding the search indexes a system uses to find things quickly, so that the indexes match the data again instead of pointing at records that no longer line up. A message relayed by Florida Atlantic University on Saturday morning put it plainly: "The weekly Service Update is progressing. Reindexing and tenant release is now expected to complete for the majority of customers by 11 AM EST."&lt;/p&gt;

&lt;p&gt;A spokesperson later told the Associated Press that service was restored by 11 a.m. EST on Saturday, that the disruption had hit two of the company's data centres, and that it had nothing to do with a cybersecurity incident. Some customers came back later. Northeastern University was still describing "limited recovery" on Saturday afternoon, and Washington University was still clearing a backlog of business processes into Sunday. Workday says more than 11,500 organisations use its platform. How many were hit is not clear, and the Associated Press noted that directly.&lt;/p&gt;

&lt;p&gt;So the outage ended at different times for different customers, and "resolved" was a process, not a timestamp. That is the signature of a data problem rather than a machine problem. Machines come back together. Data has to be checked tenant by tenant.&lt;/p&gt;

&lt;p&gt;One honest limit before going further. Workday has not published a technical root cause analysis, and its notice does not say how the DR site's services reached the production databases. This article will not guess at that. What follows is the class of failure the notice describes, and the ways that class of failure is known to happen.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rule was already written down
&lt;/h2&gt;

&lt;p&gt;Here is the part that stings. The rule this drill broke is not obscure knowledge. It is written in the documentation of the same cloud providers whose infrastructure underpins enterprise software.&lt;/p&gt;

&lt;p&gt;Microsoft's Azure Site Recovery documentation describes a test failover as a way to validate a disaster recovery strategy "without any data loss or downtime", and says plainly that a test failover does not affect the production environment. In the same document, it recommends choosing a network for the test that is isolated from the production network. AWS publishes the same rule for its own disaster recovery drills: isolate the drill instances from production systems, so they cannot register with production services, send real notifications, or receive live traffic.&lt;/p&gt;

&lt;p&gt;The rule exists because a drill is a copy of production brought to life. A copy that can reach the original is not a copy. It is a second writer, with the same keys, pointed at the same data.&lt;/p&gt;

&lt;h2&gt;
  
  
  How a recovery environment escapes
&lt;/h2&gt;

&lt;p&gt;Workday's notice does not say which route its DR services took to the production databases. But practitioners have catalogued the ways a restored environment escapes its boundary, and they are worth naming, because each one is a check a team can run this week.&lt;/p&gt;

&lt;p&gt;First, configuration cloned from production. A DR environment is usually built by copying production. If that copy includes connection strings, database addresses or message broker endpoints, the restored services will point at live systems unless someone rewrites those values at boot. The copy is faithful, and that is the problem.&lt;/p&gt;

&lt;p&gt;Second, name resolution. Internal DNS or a service registry can still resolve production database addresses from inside a nominally separate network. A name that means one thing in production means the same thing in the DR site, unless the DR site has its own names.&lt;/p&gt;

&lt;p&gt;Third, a surviving network route. A transit gateway attachment, a peering connection or a legacy VPN tunnel can leave a path open between networks that are supposed to be separate. The firewall rules say no. One forgotten route says yes, and the route wins.&lt;/p&gt;

&lt;p&gt;Fourth, credentials that stay valid. If the service accounts and passwords that work on production also work from the DR site, a network mistake becomes an authenticated write path. The database cannot tell that the connection comes from a drill. It only sees valid credentials.&lt;/p&gt;

&lt;p&gt;Fifth, and quietest of all, the background workers. A restored scheduler or queue consumer that starts polling a production broker will claim live tasks and acknowledge messages without anyone noticing. Nobody opened a dashboard. Nobody ran a command. A worker woke up, found work, and did it.&lt;/p&gt;

&lt;p&gt;None of these is exotic. Each one is a small, ordinary detail: a string in a config file, a DNS entry, a route, a password, a worker that starts on boot. A DR drill touches all five at once, which is why the isolation check has to be a test, not a hope.&lt;/p&gt;

&lt;h2&gt;
  
  
  The code: a guard that refuses to start
&lt;/h2&gt;

&lt;p&gt;The fix that generalises is small. A service should refuse to start if its database address does not belong to its environment. The check runs at boot, before any connection is made, and it fails closed: if the answer is unclear, the service does not start.&lt;/p&gt;

&lt;p&gt;In Go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Guard checks that the database host belongs to this environment&lt;/span&gt;
&lt;span class="c1"&gt;// before the service connects. A mismatch is a startup failure,&lt;/span&gt;
&lt;span class="c1"&gt;// not a warning: a drill must never be able to reach production.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nc"&gt;Guard&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dbHost&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;allowed&lt;/span&gt; &lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;host&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;allowed&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;host&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;dbHost&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Errorf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"environment %s must not connect to database host %s"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dbHost&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same shape in Python:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;guard&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;db_host&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;allowed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""Refuse to start when the database host does not belong
    to this environment. Fail closed: unclear means do not start."""&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;db_host&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;allowed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;SystemExit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"environment {environment} must not connect to database host {db_host}"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The guard only works if the list of allowed hosts is not itself copied from production. That is the trap: a config file cloned from production carries production's answers. So the allowed list should come from the environment's own deployment, not from a shared config, and it should be checked by a test that runs in CI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;test_dr_config_never_names_production&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""Load the DR config and assert no production host appears
    anywhere in it: not in the database URL, not in the broker
    URL, not in any connection string."""&lt;/span&gt;
    &lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;load_config&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"dr"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;prod_hosts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"db-prod-1.internal"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"db-prod-2.internal"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;host&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;prod_hosts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="n"&gt;host&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"DR config names production host {host}"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three cases matter, and the boundary between them is the test. A DR config that names a DR host passes. A DR config that names a production host fails. A config that names a host nobody recognises fails too, because an unknown host is not a safe host. Test all three.&lt;/p&gt;

&lt;p&gt;And the drill itself needs a tripwire. Before a DR test, point the drill environment at a fake production endpoint that logs every connection attempt, and assert that the count is zero. If anything tries to connect, the drill stops before it touches anything real. The tripwire is cheap. It measures exactly the property that failed at Workday: during a drill, nothing in the recovery environment may reach production, not even once.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to take away
&lt;/h2&gt;

&lt;p&gt;A disaster recovery test has one job: prove you can survive a failure without causing one. The test is supposed to be the safest thing a team does all quarter, because it is a rehearsal, and rehearsals are not meant to hurt anyone.&lt;/p&gt;

&lt;p&gt;Workday's drill did the opposite. The safety net reached into the live system and left the data disagreeing with itself, and the recovery took a day of validation, reindexing and staged releases to unwind. Nobody was hacked. Nothing was attacked. A test touched production, and that was enough.&lt;/p&gt;

&lt;p&gt;The lesson is not that DR drills are dangerous. It is that isolation is not a diagram, it is a property you test. A network is isolated when a connection attempt from the drill fails. A config is safe when a test proves it names no production host. A drill is safe when a tripwire counts zero attempts to reach the live system. Anything less is a hope with a network diagram attached.&lt;/p&gt;

&lt;p&gt;When did you last prove your DR environment cannot reach production, rather than assuming it?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Sources: Workday Community status notice of 13 November 2026, quoted verbatim by Washington University in St. Louis IT; Associated Press reporting via UC Today, 14 November 2026 (two data centres affected, service restored by 11 a.m. EST Saturday, not a cybersecurity incident, more than 11,500 organisations use Workday); Florida Atlantic University IT relay of Workday's 14 November update on reindexing and tenant release; Microsoft Learn, "Run a test failover (disaster recovery drill) to Azure in Azure Site Recovery"; AWS Elastic Disaster Recovery drill guidance. Workday has not published a technical root cause analysis, and its notice does not say how DR site services reached the production databases, so this article does not claim a specific route. The escape routes listed are the known ways this class of failure happens. The Go and Python snippets show the shape of the guard, not Workday source code.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>backend</category>
      <category>devops</category>
      <category>database</category>
      <category>cloud</category>
    </item>
    <item>
      <title>The rate limiter that checked the database first: how rejected requests kept 2,100 students out of their exams</title>
      <dc:creator>Kashif Manzer</dc:creator>
      <pubDate>Wed, 18 Nov 2026 14:17:15 +0000</pubDate>
      <link>https://dev.to/kashif_manzer/the-rate-limiter-that-checked-the-database-first-how-rejected-requests-kept-2100-students-out-of-4ndj</link>
      <guid>https://dev.to/kashif_manzer/the-rate-limiter-that-checked-the-database-first-how-rejected-requests-kept-2100-students-out-of-4ndj</guid>
      <description>&lt;p&gt;On Tuesday 21 October 2026, at 12:18 in the afternoon, exams were about to start at several schools and colleges. Students sat down, opened their exam, and nothing happened. The start button did nothing, or the page never loaded. Three institutions were affected, up to 2,100 students in total, and for 19 minutes nobody at those institutions could start an exam.&lt;/p&gt;

&lt;p&gt;The day before, the same thing had happened to one institution, for 13 minutes. A restart fixed it. On the Tuesday, the team restarted the servers twice. Nothing changed. The service came back only when they changed how the servers connected to the database.&lt;/p&gt;

&lt;p&gt;Schoolyear is the platform those students use to take exams. Schools run exams on it, students start their exams through it, and supervisors open a dashboard to watch over them. Other assessment platforms connect to it too, sending requests on behalf of their own users. When Schoolyear stops answering, exams do not start.&lt;/p&gt;

&lt;p&gt;The postmortem, published by Schoolyear itself, is short and unusually honest. It names two flaws, and both of them are the kind of flaw that looks sensible until the worst day arrives.&lt;/p&gt;

&lt;h2&gt;
  
  
  The burst
&lt;/h2&gt;

&lt;p&gt;At the start of an exam, one integration sent a very large burst of requests. How large? Schoolyear does not give a number, but it says the burst was far larger than the number of students taking the exam would explain, and far beyond its fair-use limits. Exam size was not the problem: Schoolyear regularly runs exams with more students than were involved here.&lt;/p&gt;

&lt;p&gt;A burst like that is exactly what rate limiting exists for. A rate limit is a rule that says one sender may make this many requests in this much time, and no more. Go over the limit and your extra requests are turned away, usually with a 429 response, which is the server saying "too many requests, try again later".&lt;/p&gt;

&lt;p&gt;Schoolyear had a rate limit, and the rate limit worked. The extra requests were rejected. So why did the service fall over?&lt;/p&gt;

&lt;p&gt;Because of what the rejection cost.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flaw one: the bouncer that phoned the database
&lt;/h2&gt;

&lt;p&gt;Think of a rate limiter as a bouncer at a door. The bouncer's job is to keep the room from getting overcrowded. People arrive, the bouncer counts, and once the room is full the bouncer turns people away at the door. Turning someone away should be the cheapest thing the bouncer does. No seat, no drink, no service. Just "no".&lt;/p&gt;

&lt;p&gt;Schoolyear's bouncer did something extra before saying no. Before deciding whether to turn a request away, it checked the database.&lt;/p&gt;

&lt;p&gt;That sounds harmless. Checking a limit usually means looking something up: how many requests has this sender made in the last minute? If that count lives in the database, every request, including every rejected request, costs a database lookup. The rejected requests still put load on the database. The protection cost as much as the thing it was protecting against.&lt;/p&gt;

&lt;p&gt;Under normal traffic this does not matter. A few rejected requests, a few extra lookups, nobody notices. But a burst changes the arithmetic. When one sender fires off far more requests than the limit allows, nearly all of them are rejected, and nearly all of them still hit the database. The limiter was doing its job, and the database was paying for every rejection.&lt;/p&gt;

&lt;p&gt;This is the first lesson, and it is worth stating plainly: a rate limiter that consults the database to reject a request is not protecting the database. It is just moving the load from the application to the database, one lookup at a time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flaw two: come back in one second
&lt;/h2&gt;

&lt;p&gt;The second flaw was in the rejection itself. When Schoolyear turned a request away, it told the sender to retry after one second.&lt;/p&gt;

&lt;p&gt;One second sounds reasonable. It is short, polite, and specific. The problem is what happens when thousands of rejected requests all get the same instruction. They all come back one second later, together, in step. The burst that was rejected at 12:18:00 returns at 12:18:01, is rejected again, and is told to come back at 12:18:02. The same crowd, knocking on the same door, once a second, until something gives.&lt;/p&gt;

&lt;p&gt;The postmortem describes the loop in one sentence: retries added load, the load made requests slower, slower requests failed, and the failures produced more retries. The database eventually ran out of connections and the service stopped responding.&lt;/p&gt;

&lt;p&gt;A fixed retry delay synchronises retries. Instead of every client retrying at a random moment, they all retry at the same moment, and the server gets the burst again, once a second, for as long as the clients keep trying.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the restarts did not work
&lt;/h2&gt;

&lt;p&gt;On Monday, a restart fixed it. On Tuesday, two restarts did nothing. That difference is a clue.&lt;/p&gt;

&lt;p&gt;Restarting a server clears whatever is stuck inside that server. It does not stop the requests arriving from outside. On Monday the burst had presumably passed by the time the servers came back, so the restart worked. On Tuesday the burst, and the retries it was generating, were still arriving. Each restarted server woke up to the same flood of rejected requests, each one costing a database lookup, and the database ran out of connections again.&lt;/p&gt;

&lt;p&gt;Service returned at 12:37, after the servers were restarted with a different database connection, one that bypassed the component between the servers and the database that had become overloaded. The postmortem does not name that component, and this article will not guess. The point is the shape of the fix: when the path to the database is the thing that is choking, restarting the servers at the end of that path changes nothing. You have to change the path.&lt;/p&gt;

&lt;p&gt;Exams already in progress were not affected, and no data was lost or exposed. The damage was bounded to exams that could not start. That is small comfort to 2,100 students sitting at a desk waiting for a page to load, but it matters: the failure was a failure to start, not a failure that corrupted anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Schoolyear changed
&lt;/h2&gt;

&lt;p&gt;All four fixes were live by 22 October:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Servers now connect to the database directly, without the component that became overloaded.&lt;/li&gt;
&lt;li&gt;A single source can make fewer requests, so unusually large bursts are cut off sooner.&lt;/li&gt;
&lt;li&gt;The app backs off further after each retry, instead of retrying on a fixed schedule.&lt;/li&gt;
&lt;li&gt;Rate limiting no longer touches the database. The decision to reject a request is made without a lookup first, so excess requests are dropped before they reach the database.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Number 4 is the one that matters most, because it is the one that removes the flaw rather than shrinking it. A lower limit still lets a burst through, just a smaller one. Backoff still lets retries arrive, just spread out. But a limiter that decides without the database cannot be turned into a database load generator, however large the burst gets.&lt;/p&gt;

&lt;h2&gt;
  
  
  The code: a limiter that never touches the database
&lt;/h2&gt;

&lt;p&gt;The fix is a token bucket kept in memory. A token bucket is a simple idea: each sender has a bucket holding a fixed number of tokens. Every request costs one token. Tokens refill at a steady rate. When the bucket is empty, the request is rejected, and the rejection costs nothing but a map lookup in memory.&lt;/p&gt;

&lt;p&gt;In Go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Limiter decides in memory. It never touches the database,&lt;/span&gt;
&lt;span class="c1"&gt;// so rejecting a request costs a map lookup and nothing else.&lt;/span&gt;
&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;Limiter&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;mu&lt;/span&gt;      &lt;span class="n"&gt;sync&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Mutex&lt;/span&gt;
    &lt;span class="n"&gt;buckets&lt;/span&gt; &lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;bucket&lt;/span&gt;
    &lt;span class="n"&gt;rate&lt;/span&gt;    &lt;span class="kt"&gt;float64&lt;/span&gt; &lt;span class="c1"&gt;// tokens refilled per second&lt;/span&gt;
    &lt;span class="n"&gt;burst&lt;/span&gt;   &lt;span class="kt"&gt;int&lt;/span&gt;     &lt;span class="c1"&gt;// maximum tokens in a bucket&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;bucket&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;tokens&lt;/span&gt; &lt;span class="kt"&gt;float64&lt;/span&gt;
    &lt;span class="n"&gt;last&lt;/span&gt;   &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Time&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nc"&gt;Limiter&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nc"&gt;Allow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Lock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Unlock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ok&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;buckets&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;bucket&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;tokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float64&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;burst&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;buckets&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tokens&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rate&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Sub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Seconds&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tokens&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;float64&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;burst&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tokens&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;float64&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;burst&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;last&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tokens&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="c1"&gt;// rejected: no database call, no queue, no work&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tokens&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same shape in Python, using a lock and a dictionary:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;threading&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Limiter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""In-memory token bucket. Allow() never touches the database,
    so a rejected request costs one dict lookup and nothing else."""&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;burst&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rate&lt;/span&gt;      &lt;span class="c1"&gt;# tokens refilled per second&lt;/span&gt;
        &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;burst&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;burst&lt;/span&gt;    &lt;span class="c1"&gt;# maximum tokens in a bucket&lt;/span&gt;
        &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;buckets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lock&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;threading&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Lock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;allow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lock&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;monotonic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;tokens&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;buckets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;burst&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;tokens&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;burst&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tokens&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rate&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;tokens&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;buckets&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tokens&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;  &lt;span class="c1"&gt;# rejected before any database work&lt;/span&gt;
            &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;buckets&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tokens&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And on the client side, the second flaw has a matching fix. When a server says "retry after one second", do not take it literally for every retry. Back off further after each attempt, and add a random spread so clients do not all return at once:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;backoff&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;attempt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cap&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;60.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""Wait longer after each rejection, with jitter so retries
    spread out instead of arriving in step."""&lt;/span&gt;
    &lt;span class="n"&gt;wait&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cap&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;wait&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uniform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The server side of that fix is just as small: send a Retry-After that grows, or let the client back off on its own. Either way, the fixed one-second delay is the thing to remove.&lt;/p&gt;

&lt;h2&gt;
  
  
  The test that would have caught it
&lt;/h2&gt;

&lt;p&gt;One test would have caught the first flaw before it ever reached production: flood the limiter with requests that will be rejected, and watch the database.&lt;/p&gt;

&lt;p&gt;Send ten times the limit from one sender, then check how many database connections the flood used. If the answer is anything above zero, the limiter is not protecting the database. It is billing the database for every rejection. The test is cheap, and it measures exactly the property that failed: rejected requests must cost the database nothing.&lt;/p&gt;

&lt;p&gt;Test the second flaw the same way. Send a burst, count the retries in the next ten seconds, and check whether they arrive in step or spread out. If they arrive in a single spike one second after the rejection, the retry delay is synchronising them.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to take away
&lt;/h2&gt;

&lt;p&gt;The rate limit worked. That is the part of this story that should stay with you. The limit was in place, it rejected the excess, and the service still went down twice, because the rejection itself was expensive and the retry instruction was too precise.&lt;/p&gt;

&lt;p&gt;Protection that costs as much as the thing it protects is not protection. It is a queue with a nicer name. If you run a rate limiter, the question is not whether it rejects the excess. It is what a rejected request costs, and whether a thousand rejections in one second cost a thousand database lookups. If the answer is yes, the limiter is the load, and the next burst will prove it.&lt;/p&gt;

&lt;p&gt;When did you last check what your rate limiter costs when it says no?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Sources: Schoolyear, "Incident Postmortem on 20-10-2026 and 21-10-2026", Schoolyear help centre. Incident windows 20 October 2026, 18:48 to 19:01 CEST, and 21 October 2026, 12:18 to 12:37 CEST. The postmortem does not name the component between the servers and the database, and does not give the size of the request burst, so this article does not guess at either. The Go and Python snippets show the shape of the fix, not Schoolyear source code.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>backend</category>
      <category>devops</category>
      <category>database</category>
      <category>api</category>
    </item>
    <item>
      <title>The deploy that crashed on zero: a counter cache, an empty list, and one hour of 500s</title>
      <dc:creator>Kashif Manzer</dc:creator>
      <pubDate>Mon, 16 Nov 2026 14:12:28 +0000</pubDate>
      <link>https://dev.to/kashif_manzer/the-deploy-that-crashed-on-zero-a-counter-cache-an-empty-list-and-one-hour-of-500s-1dn1</link>
      <guid>https://dev.to/kashif_manzer/the-deploy-that-crashed-on-zero-a-counter-cache-an-empty-list-and-one-hour-of-500s-1dn1</guid>
      <description>&lt;p&gt;On Tuesday 3 November 2026, at 10:25 UTC, the team behind the Open Build Service started a routine deploy to build.opensuse.org. The Open Build Service, usually shortened to OBS, is the system openSUSE uses to build software packages. A deploy there is not a rare event. This one looked small: a schema migration, a data migration, and some new code.&lt;/p&gt;

&lt;p&gt;Six minutes later, the first exceptions landed in the issue tracker.&lt;/p&gt;

&lt;p&gt;Some users saw a 500 error on every page they visited. A 500 error is the server saying something went wrong on its side, with no more detail than that. Other users saw nothing wrong at all. The service was up. The deploy had finished. And yet a slice of users could not use the site.&lt;/p&gt;

&lt;p&gt;Then came the clue that cracked it. The team removed all the requests from one affected user's watchlist, and that user's errors stopped at once. The problem was not the deploy in general. It was the combination of requests and watchlists. That combination pointed straight at the new code.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a counter cache is
&lt;/h2&gt;

&lt;p&gt;To understand the bug, you need one piece of machinery: the counter cache.&lt;/p&gt;

&lt;p&gt;In OBS, a BsRequest is a request, roughly a proposal to change something, and a BsRequestAction is one action inside that request, such as submitting a package. One request can hold several actions. If you want to know how many actions a request has, you can count them each time you need the number. That works, but it means an extra database query on every page that shows the count.&lt;/p&gt;

&lt;p&gt;A counter cache is the shortcut. You add a column to the request that stores the count, and the application keeps that column up to date whenever actions are added or removed. Reading the count becomes reading one number from a row you already have. It is a small optimisation, the kind that appears in thousands of codebases, and it is exactly the kind of change that looks too boring to break anything.&lt;/p&gt;

&lt;p&gt;The deploy introduced a counter cache for the number of actions each request has. It did this in three parts: a schema migration that added the count column, a data migration that filled in the real count for every existing request, and new code that read the cached count.&lt;/p&gt;

&lt;h2&gt;
  
  
  The assumption hiding inside the code
&lt;/h2&gt;

&lt;p&gt;The postmortem states the root cause in two sentences. The cache count defaulted to 0 in the schema migration. The code assumed that every request has at least one action.&lt;/p&gt;

&lt;p&gt;Read those two sentences together, because the bug lives in the gap between them.&lt;/p&gt;

&lt;p&gt;When the schema migration ran, every existing request got a cached count of 0. Not because those requests had no actions, but because the count had not been calculated yet. Zero was a placeholder, a "not filled in yet" value wearing the clothes of a real number. The data migration that would fill in the true counts started at 10:32, seven minutes after the deploy began, and it had not finished.&lt;/p&gt;

&lt;p&gt;Meanwhile the new code was already live, reading the cached count and trusting it. And it trusted something else too: that a request always has at least one action. A request with a cached count of 0 broke that assumption, and the application crashed.&lt;/p&gt;

&lt;p&gt;That is why only some users were affected. The crash needed the request-watchlist combination. A user whose watchlist contained requests with a stale zero count hit the new code path and got a 500 on every page. A user whose watchlist held no such requests never touched the code path and saw a perfectly healthy site. The service was not half broken. It was broken for exactly the users who walked into the one place the new code ran.&lt;/p&gt;

&lt;p&gt;There is a second detail in the timeline worth pausing on. At 10:46, the team stopped the running data migration, suspecting it was causing the degradation. It was the wrong suspect. The data migration was the fix, not the cause: it was the job that would replace the placeholder zeros with true counts. The root cause was identified at 11:20, almost an hour in. At 11:26 they ran an adjusted data migration by hand. By 11:36 the crashes had stopped, and by 11:45 the corrective migration had finished and the incident was resolved.&lt;/p&gt;

&lt;p&gt;So the team lost about half an hour to a reasonable-looking wrong turn. When a migration and a crash arrive together, the migration looks guilty. Here the migration was the only thing that could clear the fault, and stopping it kept the fault in place.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why zero is the most dangerous number in a deploy
&lt;/h2&gt;

&lt;p&gt;Zero is a value, not an absence. That sentence is the whole lesson, and it is worth saying slowly.&lt;/p&gt;

&lt;p&gt;A count of 0 makes a claim: this request has no actions. But during a deploy, 0 can also mean something entirely different: this count has not been calculated yet. The database cannot tell those two meanings apart. Nothing in the number itself says "I am a placeholder." The code that reads it has to know.&lt;/p&gt;

&lt;p&gt;This is a pattern that shows up far beyond counter caches. A timestamp of zero can mean "never happened" or "not recorded yet." An empty list can mean "nothing here" or "not loaded yet." A flag set to false can mean "no" or "nobody has answered yet." Every one of these is a value that does double duty as a missing value, and every one of them will eventually be read by code that believes the first meaning.&lt;/p&gt;

&lt;p&gt;The OBS postmortem does not publish the exact line of code that crashed, so what follows is the shape of the bug, not a quote of their code. The shape is familiar to anyone who has written it: code that takes the first item from a list without checking whether the list has anything in it.&lt;/p&gt;

&lt;p&gt;In Go, the unsafe version looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;first&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Actions&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="c1"&gt;// panics when the list is empty&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The guarded version costs two lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c1"&gt;// FirstAction returns the first action of a request, or false&lt;/span&gt;
&lt;span class="c1"&gt;// when the request has none. Never assume the list is non-empty.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nc"&gt;FirstAction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;actions&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nc"&gt;Action&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Action&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;Action&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same guard in Python:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;first_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""Return the first action, or None when there is none.

    A request with no actions is a real state, not an error.
    Treat it as one.
    """&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two lines of defence, and neither is clever. That is the point. The fix for this class of bug is not a smarter cache. It is code that treats zero as a value it must handle, because zero is the first value any new counter holds, and the first value any backfill writes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploy in the safe order
&lt;/h2&gt;

&lt;p&gt;The deeper fix is about ordering, not code. The OBS team's own lesson says it plainly: deploying code that immediately depends on a data migration finishing deserves special attention, including planning around a maintenance window and knowing the size of the affected tables.&lt;/p&gt;

&lt;p&gt;There are two safe orders, and the deploy used neither.&lt;/p&gt;

&lt;p&gt;The first safe order is backfill first, code second. Run the data migration, wait until every row has a true count, and only then ship the code that reads the count. The code never sees a placeholder, because the placeholders are gone before it arrives.&lt;/p&gt;

&lt;p&gt;The second safe order is code that tolerates the old state. Ship code that handles a count of 0, or that falls back to counting for real when the cache looks unfilled, and then run the backfill whenever you like. The code never breaks, because it never trusted a number it had not verified.&lt;/p&gt;

&lt;p&gt;What broke OBS was the third order: ship the code first, and let the backfill catch up. For a few minutes, or an hour, the code reads numbers that are not true yet. If the code assumes those numbers are true, the deploy is broken from the moment it lands, and the only question is which users walk into it first.&lt;/p&gt;

&lt;p&gt;This is the same shape as the expand and contract pattern used for schema changes: first add the new thing without depending on it, then move the data, then remove the old thing. The order is the safeguard. Skip a step and the safeguard is gone.&lt;/p&gt;

&lt;h2&gt;
  
  
  The test that would have caught it
&lt;/h2&gt;

&lt;p&gt;One test would have caught this before the deploy: a request with no actions.&lt;/p&gt;

&lt;p&gt;Test three cases, and test them at the boundary. A request with zero actions, a request with one action, and a request with two. Zero is the case that matters, because zero is the value the schema migration writes for every existing row. If the code cannot handle a request with no actions, it cannot handle a deploy either, because during the deploy every request briefly has no actions, as far as the cache is concerned.&lt;/p&gt;

&lt;p&gt;It is a cheap test to write and an easy one to skip, because a request with no actions looks like a case that cannot happen in real life. That is exactly why it happens in production. The cases that cannot happen are the ones nobody guards, and a deploy is very good at making them happen.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to take away
&lt;/h2&gt;

&lt;p&gt;The deploy was small. A column, a backfill, and some code that read a number. Nothing in it looked dangerous, and nothing in it was exotic. The fault was an assumption so ordinary it was never written down: that every request has at least one action, and that a cached count of 0 means the same thing as a true count of 0.&lt;/p&gt;

&lt;p&gt;If you run a counter cache, or any stored number that a migration fills in, the question is not whether your code reads the number. It is whether your code can tell a placeholder from a real value, and whether your deploy order guarantees it never has to. Backfill first, or code that tolerates zero. One of the two, every time.&lt;/p&gt;

&lt;p&gt;When did you last deploy code that trusted a number your database had not finished writing?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Sources: Open Build Service team, "Post-mortem: Errors for Users with Requests on their Watchlist", published 13 November 2026, incident 3 November 2026, 10:25 to 11:45 UTC. The postmortem does not publish the exact crashing line of code, so the Go and Python snippets above show the shape of the bug, not OBS source code.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>backend</category>
      <category>devops</category>
      <category>database</category>
      <category>postgres</category>
    </item>
    <item>
      <title>New connections failed, old ones worked: the failover that sent writes to a read-only database</title>
      <dc:creator>Kashif Manzer</dc:creator>
      <pubDate>Sun, 15 Nov 2026 14:11:31 +0000</pubDate>
      <link>https://dev.to/kashif_manzer/new-connections-failed-old-ones-worked-the-failover-that-sent-writes-to-a-read-only-database-m5b</link>
      <guid>https://dev.to/kashif_manzer/new-connections-failed-old-ones-worked-the-failover-that-sent-writes-to-a-read-only-database-m5b</guid>
      <description>&lt;p&gt;On Wednesday 28 October 2026, the RIPE Database started failing updates. Not all of them. Some went through fine. Others were refused. The same service, the same hour, the same kind of request, and nobody could tell from the outside which ones would fail.&lt;/p&gt;

&lt;p&gt;That is the worst kind of outage. A service that is fully down is easy to understand. A service that works for some people and not others, with no pattern you can see, makes everyone doubt their own code first.&lt;/p&gt;

&lt;p&gt;The people who run the RIPE Database are the RIPE NCC, the registry that hands out IP addresses across Europe, the Middle East and parts of Central Asia. Their database, usually called Whois, is the record of who holds which block of addresses. If you want to change who owns a block, or set up reverse DNS for it, you send an update to this database. Reverse DNS is the record that maps an IP address back to a name, and mail servers use it to check that the server sending them email is who it claims to be. So when updates to this database fail, address records stop changing, and reverse DNS changes stop going through.&lt;/p&gt;

&lt;p&gt;The failure ran from 11:42 to 19:40 UTC, just under eight hours, and it was intermittent the whole time. The postmortem, published on 3 November, is short. Three sentences of cause, and they are worth reading slowly, because the bug is not where you would expect it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The clue that did not fit
&lt;/h2&gt;

&lt;p&gt;Start with what the operators could see. Updates were failing intermittently. Not every update, and not in a steady pattern. If the database had been down, everything would have failed. If the update service had been down, everything would have failed. Intermittent failure, spread across eight hours, points somewhere else: something in the path between the application and the database was different for different requests.&lt;/p&gt;

&lt;p&gt;The postmortem gives the answer in one sentence. There had been a short interruption on the network link to the primary load balancer, and the system failed over to the standby load balancer. Because of a misconfiguration, new Whois update connections that went through the newly elected load balancer were sent to the read-only database instead of the primary database. Existing connections from the application stayed connected to the primary database and were unaffected.&lt;/p&gt;

&lt;p&gt;Read that again, because it contains the whole story. Two groups of connections, two different destinations, one working and one not.&lt;/p&gt;

&lt;h2&gt;
  
  
  A short glossary, because the jargon hides the mechanism
&lt;/h2&gt;

&lt;p&gt;A load balancer is a machine whose job is to stand in front of a service and hand each incoming connection to a server behind it. You run two of them, a primary and a standby, so that if one dies the other takes over. That takeover is called a failover, and it is supposed to be the boring part of the system, the part that works without anyone thinking about it.&lt;/p&gt;

&lt;p&gt;A database primary is the one copy that accepts writes. A read-only replica is a copy that keeps itself up to date by copying from the primary, and exists so that read queries can be spread across machines without loading the primary. It can answer questions. It cannot accept changes. Sending a write to a read-only replica is like posting a letter to a library: the building is real, the address is correct, and nothing you send there will ever be filed.&lt;/p&gt;

&lt;p&gt;So the failover did its job. Traffic moved to the standby balancer. The standby balancer then sent new connections to the wrong database. And the old connections, the ones opened before the failover, were still sitting on the primary, happily accepting writes. That is why the failure was intermittent. It depended on when your connection was opened, and nobody looking at the service from the outside could see that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the old connections masked the fault
&lt;/h2&gt;

&lt;p&gt;This is the part that should worry you, because it is the part that repeats in other systems.&lt;/p&gt;

&lt;p&gt;Every check the operators had would have looked reassuring. The standby balancer was up and answering. The database was up and answering. The application was connected and processing some updates. If your monitoring asks "is the balancer alive" and "is the database alive", both answers were yes. The system was green on every dashboard that measured liveness, and broken on the one thing that mattered: could a new update actually land?&lt;/p&gt;

&lt;p&gt;The old connections made it worse. They were proof, visible to anyone watching, that the system worked. An operator seeing successful updates would reasonably conclude the problem was elsewhere, maybe with the people submitting the updates, maybe with a bad batch of requests. The healthy connections were not just unaffected. They were camouflage.&lt;/p&gt;

&lt;p&gt;There is a second quiet detail in the postmortem. On 30 October, two days after the incident, RIPE NCC reported that none of the failed requests would have changed a reverse delegation anyway, because they either contained no changes or failed their pre-delegation checks. That is good news for the internet, and it is worth stating plainly: no valid reverse DNS change was lost, as far as the published evidence shows. It is also luck. The mechanism did not care what was in the requests. The next time a misrouted write path fails, the requests it drops might be the ones that matter.&lt;/p&gt;

&lt;p&gt;RIPE NCC has not published how many updates failed, or which configuration setting was wrong, or a trace through the standby path. So this article does not guess at those numbers. The mechanism is enough.&lt;/p&gt;

&lt;h2&gt;
  
  
  The test that would have caught it
&lt;/h2&gt;

&lt;p&gt;Here is the uncomfortable question. The standby balancer existed for exactly this moment, and the misconfiguration in its path had presumably been sitting there since it was set up. How do you catch a fault in a path that only runs during a failover?&lt;/p&gt;

&lt;p&gt;You test the failover the way the system will actually use it: with a write.&lt;/p&gt;

&lt;p&gt;Most health checks do not do this. A typical database health check opens a connection and runs &lt;code&gt;SELECT 1&lt;/code&gt;, which is a read. A read succeeds on a read-only replica. A read succeeds on a primary. It tells you the database is alive and says nothing about whether it can accept a write. It is the exact check that would have passed on both sides of this incident.&lt;/p&gt;

&lt;p&gt;A write-path check is different. It writes a small probe row to a scratch table, reads it back, and deletes it. If the connection is pointed at a read-only replica, the write fails at once, and you learn the truth in milliseconds. Here is the idea in Go, using the standard database package and Postgres:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ProbeWrite checks that this connection can actually write,&lt;/span&gt;
&lt;span class="c1"&gt;// not just that the database answers. Run it against the&lt;/span&gt;
&lt;span class="c1"&gt;// connection your application will use for updates, including&lt;/span&gt;
&lt;span class="c1"&gt;// after a failover.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nc"&gt;ProbeWrite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;sql&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;DB&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ExecContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sb"&gt;`INSERT INTO write_probe (id, checked_at) VALUES (1, now())
         ON CONFLICT (id) DO UPDATE SET checked_at = now()`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Errorf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"write probe failed: %w"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the same check in Python:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;probe_write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""Fail fast if this connection cannot write.
    A read-only replica will reject the INSERT at once."""&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;cur&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;cur&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="s2"&gt;"INSERT INTO write_probe (id, checked_at) VALUES (1, now()) "&lt;/span&gt;
            &lt;span class="s2"&gt;"ON CONFLICT (id) DO UPDATE SET checked_at = now()"&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;commit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is also a cheaper check that belongs in any code that opens a database connection and assumes it can write. Postgres can tell you whether the connection you hold is on a replica:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="nf"&gt;pg_is_in_recovery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If that returns true, you are talking to a replica, and any write you attempt will fail. In Go or Python, run it once when a connection is opened for writes, and refuse to proceed if the answer is not what you expect. It costs one query. It catches exactly this class of mistake: the connection is healthy, the database is healthy, and the role is wrong.&lt;/p&gt;

&lt;p&gt;The third guard is a habit, not code. When you test a failover, do not test that traffic moves. Test that a write lands. Fail over, submit a real update through the new path, read it back from the authoritative record, and only then call the test a pass. A balancer that answers pings is not a balancer that routes writes correctly. The RIPE incident is a case study in the difference.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to take away
&lt;/h2&gt;

&lt;p&gt;The failover worked. The standby took over, the traffic moved, and the system stayed up. Every part of the safety machinery did its job except the one line that said where the writes go. And because the old connections kept working, the fault hid behind partial success for eight hours.&lt;/p&gt;

&lt;p&gt;If you run a primary and a replica, the question is not whether your failover works. It is whether you have ever watched a write travel the standby path and land. If the answer is no, you have the same untested configuration RIPE NCC had: a spare route that has never carried a real update, waiting for the day it has to.&lt;/p&gt;

&lt;p&gt;When was the last time you failed over on purpose and proved a write landed on the other side?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Sources: RIPE NCC status page, "Intermittent RIPE Database update failures", postmortem posted 3 November 2026, incident window 28 October 2026, 11:42 to 19:40 UTC. The 30 October update on failed reverse-delegation requests is from the same incident record.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>backend</category>
      <category>devops</category>
      <category>database</category>
      <category>dns</category>
    </item>
    <item>
      <title>The health check that took down Outlook: inside the Microsoft 365 outage of November 12</title>
      <dc:creator>Kashif Manzer</dc:creator>
      <pubDate>Fri, 13 Nov 2026 14:13:05 +0000</pubDate>
      <link>https://dev.to/kashif_manzer/the-health-check-that-took-down-outlook-inside-the-microsoft-365-outage-of-november-12-1ld4</link>
      <guid>https://dev.to/kashif_manzer/the-health-check-that-took-down-outlook-inside-the-microsoft-365-outage-of-november-12-1ld4</guid>
      <description>&lt;p&gt;On Thursday lunchtime, Outlook stopped opening. Not for one company, and not in one country. People clicked their inbox and got nothing. They refreshed. They restarted the app. They tried their phone. Nothing worked, and the usual fixes did nothing at all, because the problem was not on their side of the screen.&lt;/p&gt;

&lt;p&gt;By 1:09 p.m. Eastern time, Downdetector had logged 128,874 problem reports for Outlook. Independent traffic measurements put Exchange Online, the service behind Outlook mailboxes, at about 89 percent below its normal level for more than nine hours. Teams, SharePoint, Copilot and the Microsoft 365 admin centre broke along with it, because they all lean on the same mail service.&lt;/p&gt;

&lt;p&gt;This is the story of what happened next, told from Microsoft's own incident log. It is worth reading closely, because the villain of this outage was not a hacker, a traffic spike, or a bad deploy. It was the safety system that was supposed to protect the service.&lt;/p&gt;

&lt;h2&gt;
  
  
  The day, hour by hour
&lt;/h2&gt;

&lt;p&gt;All times are Eastern, Thursday November 12, 2026, unless stated otherwise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;11:17 a.m.&lt;/strong&gt; Microsoft opens the incident internally. Almost nobody outside the company notices anything yet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;12:25 p.m.&lt;/strong&gt; Outlook problem reports start climbing on Downdetector.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;12:35 p.m.&lt;/strong&gt; Kentik, a company that watches internet traffic, sees Exchange Online traffic fall off a cliff.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;12:54 p.m.&lt;/strong&gt; Microsoft's first public post. It talks about users "in the Americas", as if this is a regional problem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1:07 p.m.&lt;/strong&gt; The wording changes to "users in any region". It is not regional.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1:09 p.m.&lt;/strong&gt; Downdetector peaks at 128,874 Outlook reports.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2:18 p.m.&lt;/strong&gt; Microsoft corrects its own first theory. The elevated load, it writes, "isn't driven by an overall increase in traffic, but by a large number of servers being unexpectedly unavailable, which is shifting load onto the remaining infrastructure." Read that sentence twice. The traffic did not grow. The fleet shrank.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2:43 p.m.&lt;/strong&gt; The missing servers have a cause: they are failing automated health checks, and the load balancer is pulling them out of service because of it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2:57 p.m.&lt;/strong&gt; The suspect narrows. The failed health checks "may originate from a specific component on the affected servers that's responsible for processing them." Microsoft starts deploying a change to bypass that component, and takes steps to stop more servers being removed from service.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3:56 p.m.&lt;/strong&gt; An alternative health check method works on a subset of servers, and those servers come back. Progress, at last.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5:00 p.m.&lt;/strong&gt; The setback. The fixes so far "have not provided the anticipated relief." Servers that were returned to service "can become unresponsive again once they begin receiving traffic."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8:06 p.m.&lt;/strong&gt; A sharper finding: "a process on the affected servers responsible for establishing secure connections becomes overwhelmed, causing the servers to stop processing requests." In the same update, Microsoft starts reverting "a recent network configuration change that correlates with the start of impact."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Overnight.&lt;/strong&gt; A patch to an upstream authentication and routing component starts showing positive results. Microsoft extends the window for delayed email from 24 hours to 48 hours, so messages sitting in queues are not bounced while recovery continues.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Friday morning.&lt;/strong&gt; Recovery moves region by region, Asia first, then Europe, then North America. At 8:00 a.m. Eastern on Friday, the incident is still open. Some users are still seeing intermittent problems and delayed mail. Microsoft says there is no evidence of malicious activity, and promises a full post-incident report with root cause once the service is fully restored.&lt;/p&gt;

&lt;p&gt;That report has not been published yet. Everything above comes from Microsoft's incident log as it stood on Friday morning, and the details may change when the report lands. The lesson does not depend on the details.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a health check is, and how it can turn on you
&lt;/h2&gt;

&lt;p&gt;A load balancer is a traffic cop. It stands in front of a fleet of servers and hands each incoming request to a server that is ready for it. To know which servers are ready, it asks them, every few seconds, a simple question: are you okay? That question is a health check, and a server answers it by running a small check and replying yes or no.&lt;/p&gt;

&lt;p&gt;If a server answers no, or does not answer at all, the load balancer stops sending it traffic. That is the whole point. A sick server should not get more work.&lt;/p&gt;

&lt;p&gt;Now imagine the part of the server that answers that question is itself broken. The server is fine. It could handle mail. But it cannot say so, because the component that processes the health check is the thing that failed. The load balancer hears silence, concludes the server is dead, and pulls it out of rotation.&lt;/p&gt;

&lt;p&gt;That is what Microsoft's log describes. And here is where it turns into a cascade, which is the word engineers use when one failure causes the next failure, which causes the next.&lt;/p&gt;

&lt;p&gt;Every server that gets pulled hands its share of the work to the servers still standing. Those servers now carry more load than they were built for. Their processors run hotter. They slow down. Some of them start failing their own health checks, and get pulled too. Each removal makes the next one more likely. The fleet does not fail all at once. It fails one server at a time, faster and faster, like a row of dominoes that leans a little harder with each fall.&lt;/p&gt;

&lt;p&gt;Microsoft saw this happening in real time. At 2:18 p.m. it wrote that load was shifting onto the remaining infrastructure. That is the cascade, described in Microsoft's own words.&lt;/p&gt;

&lt;h2&gt;
  
  
  The second trap: bringing servers back
&lt;/h2&gt;

&lt;p&gt;Fixing a cascade is not as simple as fixing the broken part and turning the servers back on. Microsoft learned that at 5:00 p.m., when servers it had returned to service went unresponsive again as soon as traffic reached them.&lt;/p&gt;

&lt;p&gt;Think about what happens the moment a server comes back. Every client that has been retrying for hours, every phone that has been polling for new mail, every app that has been hammering refresh, all rush in at once. The server is healthy, but it is healthy in the same way a shop is healthy at the moment the doors open after a crowd has waited outside all day. The first minute is the hardest minute it will ever have.&lt;/p&gt;

&lt;p&gt;There is a second reason that first minute is so hard, and it is the detail Microsoft found at 8:06 p.m., that a process for establishing secure connections was getting overwhelmed. When your app connects to a mail server, the first thing that happens is a handshake, a short exchange that sets up an encrypted connection. That handshake is the most processor hungry part of accepting a connection, far more expensive than sending the mail itself. During normal operation, handshakes are spread out across the day. After an outage, millions of them arrive in the same minute, because every client is reconnecting at the same time. The server spends all of its processor time saying hello, and has none left to do any work.&lt;/p&gt;

&lt;p&gt;So the recovery has to be slow on purpose. Microsoft did exactly that: traffic limits in specific locations, a narrower set of connections allowed through, then gradually widening. Let a few servers prove they are stable under a little traffic before you give them a lot. It feels slow. It is the only thing that works.&lt;/p&gt;

&lt;h2&gt;
  
  
  The guard you can build this week: separate alive from ready
&lt;/h2&gt;

&lt;p&gt;Most small services have one health endpoint, and it answers one question: is the process running? That is a liveness check, and it is the wrong question to ask a load balancer. A process can be alive and still unable to take traffic. What the load balancer needs is a readiness check: is it safe to send this server real work right now?&lt;/p&gt;

&lt;p&gt;Here is the difference in Go. Two endpoints, two different questions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c1"&gt;// /healthz answers one question: is this process alive?&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;healthz&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;WriteHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;StatusOK&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"ok"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;gate&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;sem&lt;/span&gt; &lt;span class="k"&gt;chan&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;// one slot per request we are willing to run&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;newGate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;limit&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;gate&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;gate&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;sem&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;make&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;chan&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// /readyz answers a different question: is it safe to send&lt;/span&gt;
&lt;span class="c1"&gt;// this server more work right now?&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;gate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;readyz&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// If the server is 90 percent full, say not ready.&lt;/span&gt;
    &lt;span class="c1"&gt;// The load balancer will wait. It will not pull the&lt;/span&gt;
    &lt;span class="c1"&gt;// server out of rotation, and the server gets a chance&lt;/span&gt;
    &lt;span class="c1"&gt;// to drain instead of being declared dead.&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sem&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="nb"&gt;cap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sem&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;WriteHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;StatusServiceUnavailable&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;WriteHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;StatusOK&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"ok"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pair that with a shedder, a piece of middleware that refuses new work fast when the server is full, instead of accepting it and dying slowly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;gate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;shed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;next&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Handler&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Handler&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;HandlerFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sem&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sem&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ServeHTTP&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="c1"&gt;// Full. Refuse in microseconds, with a 503 the&lt;/span&gt;
            &lt;span class="c1"&gt;// client can retry, instead of queueing work&lt;/span&gt;
            &lt;span class="c1"&gt;// that will time out anyway.&lt;/span&gt;
            &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"busy, try again"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;StatusServiceUnavailable&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The threshold matters, and it is worth testing at the boundary. Run a load test that fills the server to 89 percent of its limit, then 90, then 100. At 89 it should still report ready. At 90 it should report not ready. At 100 it should refuse fast. If those three numbers do not behave, the guard is decoration.&lt;/p&gt;

&lt;h2&gt;
  
  
  The guard on the other side: retry like a polite guest, not a crowd
&lt;/h2&gt;

&lt;p&gt;The cascade also had a client side. Every Outlook app, every phone, every integration kept retrying, and when the servers came back, all of those retries landed at once. You cannot fix Microsoft's clients. You can fix yours.&lt;/p&gt;

&lt;p&gt;A retry that waits the same amount of time every time is a crowd that knocks on the door in unison. A retry with backoff waits longer after each failure, and jitter, a small random amount added to the wait, spreads the retries out so they do not all land in the same second.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_with_backoff&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tries&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;delay&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;  &lt;span class="c1"&gt;# start by waiting half a second&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tries&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;  &lt;span class="c1"&gt;# a 4xx is our mistake, not the server's&lt;/span&gt;
        &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;RequestException&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;pass&lt;/span&gt;  &lt;span class="c1"&gt;# network error: treat it like a 5xx and retry&lt;/span&gt;
        &lt;span class="c1"&gt;# Wait longer each time, and add jitter so every client&lt;/span&gt;
        &lt;span class="c1"&gt;# does not retry at the same instant.&lt;/span&gt;
        &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;delay&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uniform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;delay&lt;/span&gt; &lt;span class="o"&gt;*=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;RuntimeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"service still down after retries"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And one step further, a circuit breaker: a small counter that stops calling a service entirely after a few failures in a row, and only tries again after a cooling off period. It is the client side version of the same idea: when something is struggling, the kindest thing you can do is stop hitting it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three questions to take back to your own systems
&lt;/h2&gt;

&lt;p&gt;First, what does your health check actually measure? If the check runs through the same component that does the real work, a failure in that component looks like a dead server, and your load balancer will do exactly what it did to Microsoft: remove healthy capacity in the middle of a crisis. Check the check.&lt;/p&gt;

&lt;p&gt;Second, do you separate alive from ready? A server that is alive but full should shed load, not be declared dead. A server that is dead should be declared dead. One endpoint cannot answer both questions.&lt;/p&gt;

&lt;p&gt;Third, have you tested the return to service, not just the failure? Kill a server in staging, bring it back, and watch what happens in the first minute under real traffic. If it falls over again the moment traffic reaches it, you have the same second trap Microsoft hit at 5:00 p.m., and you can fix it before your users find it for you.&lt;/p&gt;

&lt;p&gt;The uncomfortable part of this outage is how ordinary each piece was. A component that answers health checks. A load balancer doing its job. Clients retrying, as clients do. None of it was exotic. That is the point. The systems that take down a whole service are rarely exotic. They are ordinary parts, arranged so that the safety system itself can become the failure.&lt;/p&gt;

&lt;p&gt;So here is the question to take back to your own systems: which of your health checks is measuring the thing that checks, instead of the thing itself, and how would you know?&lt;/p&gt;

&lt;p&gt;Sources: Microsoft incident log for EX1550543 and MO1550821, as published in the Microsoft 365 admin centre and mirrored publicly by the University of Pennsylvania; Downdetector and Kentik figures as reported in the Enrow write-up of the outage. Microsoft has not yet published a root cause; it has promised a full post-incident report once the service is fully restored.&lt;/p&gt;

</description>
      <category>backend</category>
      <category>devops</category>
      <category>cloud</category>
      <category>microsoft</category>
    </item>
    <item>
      <title>The two-line cleanup that crashed iOS apps on launch</title>
      <dc:creator>Kashif Manzer</dc:creator>
      <pubDate>Wed, 11 Nov 2026 14:11:49 +0000</pubDate>
      <link>https://dev.to/kashif_manzer/the-two-line-cleanup-that-crashed-ios-apps-on-launch-3297</link>
      <guid>https://dev.to/kashif_manzer/the-two-line-cleanup-that-crashed-ios-apps-on-launch-3297</guid>
      <description>&lt;p&gt;On Monday evening, September 28, 2026, iPhone apps started crashing the moment people opened them. Not one app. Not a flaky update. App after app, open, crash, gone. If you were an iOS developer that night, your phone was a crime scene and your users were the witnesses.&lt;/p&gt;

&lt;p&gt;The first suspect was obvious. Apple had shipped iOS 27.0.1 that same day. A new OS release plus apps dying on launch is a story every developer has seen before, and the blame wrote itself.&lt;/p&gt;

&lt;p&gt;It was the wrong suspect. The apps were not crashing because of the OS. They were crashing because of a two-line change made on a server a thousand miles away, a change nobody on the app teams had ever heard of, in a system they never think about.&lt;/p&gt;

&lt;p&gt;This is a detective story about that change, and about the three small checks that would have stopped it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clue one: it was not every app
&lt;/h2&gt;

&lt;p&gt;The first thing that did not fit the Apple theory was the pattern. Plenty of apps opened fine. The ones crashing all had something in common: they used Google Analytics for Firebase, the analytics SDK that sits inside a huge share of iOS apps. One developer counted 56 crashes in the first 18 minutes, all in apps carrying that SDK.&lt;/p&gt;

&lt;p&gt;Within minutes, developers were piling into a GitHub issue on Firebase's own repository. The crash reports were eerily identical. Every one of them ended the same way, on the Analytics experiment worker queue, with the same error: &lt;code&gt;NSInvalidArgumentException: key cannot be nil&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That is a strange error to see in production. It means the code tried to put something into a dictionary under a key that did not exist. Not a bad value. A missing name. And the reports all traced back to the same moment: right after the SDK received a reply from Google's server at &lt;code&gt;app-analytics-services.com/sdk-exp&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So the OS was innocent. The server had sent something the SDK could not swallow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clue two: the two-line change
&lt;/h2&gt;

&lt;p&gt;Google published its postmortem four days later, on October 2. The timeline in it is short enough to read in one breath, and that is what makes it sting.&lt;/p&gt;

&lt;p&gt;At 17:38 Pacific time, an engineer cleaned up a stale, legacy configuration flag. A two-line change. At 17:41, three minutes later, the malformed configuration payload began rolling out globally. At 17:59, crash alerts spiked and the first external bug reports landed on GitHub. At 19:16, responders traced the problem to the cleanup change and started a rollback. At 19:52, the rollback was fully deployed. The bad configuration was served for 2 hours and 11 minutes.&lt;/p&gt;

&lt;p&gt;To understand what went wrong, you need to know what a remote configuration flag is, and why Google uses them.&lt;/p&gt;

&lt;h2&gt;
  
  
  The kill switch that ships to everyone
&lt;/h2&gt;

&lt;p&gt;When you ship an SDK inside millions of apps, you cannot push a fix the way you push a server deploy. If a new feature in the SDK has a bug, you cannot reach into every phone and patch it. So you build a kill switch: a remote flag the SDK checks when it starts up. If the flag says the feature is off, the SDK turns the feature off, no app update needed.&lt;/p&gt;

&lt;p&gt;That is a good design. But it has a consequence that matters here. Kill switches have to work even when everything else is broken, so they ship globally, to every app, all at once. There is no staged rollout for the thing that exists to stop a bad rollout.&lt;/p&gt;

&lt;p&gt;Over time, an SDK like this accumulates flags. Features come and go, and the flags for dead features pile up. Teams mark the dead ones for cleanup, and now and then someone does the tidying.&lt;/p&gt;

&lt;p&gt;On September 28, someone did the tidying. They removed a flag that was no longer needed. Two lines. But they did not remove a pointer to that flag that still lived in the SDK. When the SDK fetched the new configuration, it went looking for a flag that was no longer there. The flag's name came back as nothing, nil, and the SDK tried to use that nothing as a dictionary key. In Objective-C, that is a fatal error. The app crashed on launch.&lt;/p&gt;

&lt;p&gt;The crash was a one-time event per app, and after it the SDK fell back to its previous configuration, so phones did not get stuck in a permanent crash loop. But a one-time crash on launch, for every user, across a huge population of apps, at the same time, is still an outage. And because of caching, some apps kept crashing for up to four hours after the fix went out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clue three: the dashboards were green
&lt;/h2&gt;

&lt;p&gt;Here is the part that should worry you most, because it is the part that has nothing to do with Firebase.&lt;/p&gt;

&lt;p&gt;While apps were crashing on millions of phones, the Firebase status dashboard stayed green. So did the Google Ads dashboard. The postmortem says why, plainly: those dashboards rely mostly on server-side health metrics, and this was a client-side crash. The servers were fine. They were serving the bad payload perfectly well. Nothing on the server side looked broken, because from the server's point of view, nothing was.&lt;/p&gt;

&lt;p&gt;There was another gap. Google Analytics for Firebase does not have its own entry on the Firebase status dashboard. It links out to the Ads dashboard instead, and updating both dashboards needed manual work that took several hours. So while developers were watching their apps die in real time, the official status pages said everything was fine, and the Firebase team ended up keeping people informed on GitHub instead.&lt;/p&gt;

&lt;p&gt;Your monitoring has the same blind spot unless you have checked. A dashboard that only watches your servers cannot see your users. If your failure mode lives on the client, your green dashboard is not evidence that things are fine. It is evidence that you are looking in the wrong place.&lt;/p&gt;

&lt;h2&gt;
  
  
  The tests passed
&lt;/h2&gt;

&lt;p&gt;The postmortem has one more sentence worth sitting with: the existing tests passed on the change that caused the outage.&lt;/p&gt;

&lt;p&gt;Of course they did. The tests checked the cleanup itself, and the cleanup was correct. The flag was stale, and removing it was the right call. What no test checked was the thing the cleanup left behind: a reference to a flag that no longer existed. The failure was not in the line that was deleted. It was in the line that was not deleted with it.&lt;/p&gt;

&lt;p&gt;That is a pattern worth naming, because it shows up everywhere. A rename that misses one call site. A deleted column that one old query still selects. A removed environment variable that one script still reads. The change is correct and the tests pass, and the system breaks on the reference nobody remembered.&lt;/p&gt;

&lt;h2&gt;
  
  
  The three checks that would have stopped it
&lt;/h2&gt;

&lt;p&gt;Google committed to four fixes: stricter SDK validation, better dashboard coverage, automated pipeline checks for orphaned identifiers, and slower, phased configuration rollouts. The first two of those are things you can build for yourself this week, in any language, for any configuration your service consumes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check one: never trust a payload from the server.&lt;/strong&gt; The SDK's real bug was not the missing flag. It was that it trusted the payload. A name field that can be nil must be treated as a field that will be nil, one day, in production, at the worst moment. The fix Google promised is exactly this: validate every incoming payload strictly, ignore a corrupt flag, and fall back to cached defaults. The bad flag gets skipped. The app keeps running.&lt;/p&gt;

&lt;p&gt;Here is that guard in Go, for a service that loads feature flags from a remote configuration endpoint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;flags&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s2"&gt;"encoding/json"&lt;/span&gt;
    &lt;span class="s2"&gt;"log"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;Flag&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Name&lt;/span&gt;    &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="sb"&gt;`json:"name"`&lt;/span&gt;
    &lt;span class="nc"&gt;Enabled&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;   &lt;span class="sb"&gt;`json:"enabled"`&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Load validates every flag in a remote payload. A corrupt entry is&lt;/span&gt;
&lt;span class="c1"&gt;// skipped and the last known good value is kept, so one bad flag can&lt;/span&gt;
&lt;span class="c1"&gt;// never take down the whole service.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nc"&gt;Load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cached&lt;/span&gt; &lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;incoming&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nc"&gt;Flag&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Unmarshal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;incoming&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// The whole payload is unreadable. Keep the cached flags&lt;/span&gt;
        &lt;span class="c1"&gt;// and serve from those until the next good payload arrives.&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;cached&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;next&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nb"&gt;make&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cached&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;cached&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;incoming&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Name&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// A flag with no name is corrupt, not a flag.&lt;/span&gt;
            &lt;span class="c1"&gt;// Log it, skip it, keep serving the cached value.&lt;/span&gt;
            &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"flags: skipping entry with empty name"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Enabled&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;next&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The rule is simple: a missing name is a corrupt entry, and a corrupt entry is skipped, never trusted. The cached defaults are the safety net. If the payload is garbage, you serve the last good configuration and log loudly, instead of crashing or serving nothing.&lt;/p&gt;

&lt;p&gt;The same guard in Python is ten lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;load_flags&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cached&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""Merge a remote flag payload over cached flags.

    Corrupt entries are skipped, never trusted. If the payload
    itself is unreadable, the cached flags are served unchanged.
    """&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;incoming&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;JSONDecodeError&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;TypeError&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;cached&lt;/span&gt;

    &lt;span class="n"&gt;next_flags&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cached&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;flag&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;incoming&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;flag&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;warning&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"flags: skipping entry with missing name"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;
        &lt;span class="n"&gt;next_flags&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;flag&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"enabled"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;next_flags&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And a test that would have caught the Firebase bug is even shorter. Feed your loader a payload with a missing name and assert that it does not crash and does not lose the cached flags:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="s2"&gt;"testing"&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nc"&gt;TestLoadSkipsNamelessFlag&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;testing&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;T&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;cached&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"new_checkout"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`[{"name": "new_checkout", "enabled": false}, {"enabled": true}]`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;got&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nc"&gt;Load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cached&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;got&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"new_checkout"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Errorf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"expected flag to update, got %v"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;got&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"new_checkout"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That test is the whole lesson in one function. The second entry has no name at all. A loader without the guard would crash or store a broken entry. A loader with the guard updates the good flag and skips the bad one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check two: block cleanups that leave orphans behind.&lt;/strong&gt; Deleting a flag, a column, a variable, or an endpoint is half a change. The other half is every reference to it. Google's fix is an automated pipeline check: if a cleanup leaves an orphaned identifier, the release is blocked before it can merge. You can build the cheap version today with a search in your deploy pipeline. Before a config change ships, grep the codebase for the identifier being removed. If anything still references it, the deploy stops. It is not elegant. It would have stopped this outage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check three: roll out configuration the way you roll out code.&lt;/strong&gt; The kill switch shipped globally in three minutes because it had to be able to. But most configuration is not a kill switch, and it does not need to reach everyone at once. Phase it: a small slice of traffic first, watch the client-side error rate, then widen. And watch the client side, not just the server. If your alerting only fires when your servers are unhealthy, add one alert that fires when your clients start crashing. That is the alert that would have caught this one in minutes instead of leaving developers to find it on GitHub.&lt;/p&gt;

&lt;h2&gt;
  
  
  The question underneath it
&lt;/h2&gt;

&lt;p&gt;Every system you run has a version of that stale flag. A configuration value that was set years ago and never cleaned up. A reference to a service that no longer exists, sitting quietly in a file nobody opens. A kill switch whose own mechanism has never been tested, because the day you need it is the day you find out whether it works.&lt;/p&gt;

&lt;p&gt;The Firebase outage is a story about a two-line change. But the two lines were not the problem. The problem was a system that trusted its own configuration, tested the change but not the references, and watched its servers while its users crashed.&lt;/p&gt;

&lt;p&gt;So here is my question for you. What is the stale flag in your system, the cleanup you have been putting off, the reference you assume is gone because the thing it points to is gone? And what happens the first time your code goes looking for it?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;All facts in this article come from Google's own postmortem, "Google Analytics for Firebase iOS SDK outage on September 28, 2026," published October 2, 2026: &lt;a href="https://firebase.blog/posts/2026/10/firebase-analytics-outage/" rel="noopener noreferrer"&gt;https://firebase.blog/posts/2026/10/firebase-analytics-outage/&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>backend</category>
      <category>devops</category>
      <category>firebase</category>
      <category>ios</category>
    </item>
    <item>
      <title>Four domains and one wrong type: the 54 minutes Control D's paid DNS went dark</title>
      <dc:creator>Kashif Manzer</dc:creator>
      <pubDate>Mon, 09 Nov 2026 14:11:07 +0000</pubDate>
      <link>https://dev.to/kashif_manzer/four-domains-and-one-wrong-type-the-54-minutes-control-ds-paid-dns-went-dark-4jm0</link>
      <guid>https://dev.to/kashif_manzer/four-domains-and-one-wrong-type-the-54-minutes-control-ds-paid-dns-went-dark-4jm0</guid>
      <description>&lt;p&gt;On a Sunday afternoon in October, paying customers of Control D lost the internet. Not some of it. All of it, on every device, in every location, for about 54 minutes.&lt;/p&gt;

&lt;p&gt;Their phones showed no connection. Their laptops showed no connection. Even phones on mobile data, using a persistent Control D profile, looked dead. To most of the people affected, it felt like the internet itself had gone down.&lt;/p&gt;

&lt;p&gt;It had not. The free service kept working the whole time. No query was answered wrongly, and no customer data was touched. What stopped was much smaller and much stranger: four domain names, saved with one wrong data type, in a configuration file that every paid DNS server read at the same moment.&lt;/p&gt;

&lt;p&gt;This is a story about a type mismatch. It is also a story about the two design choices that turned a type mismatch into a global outage, and the three checks that would have stopped it.&lt;/p&gt;

&lt;h2&gt;
  
  
  First, what DNS actually does for you
&lt;/h2&gt;

&lt;p&gt;Almost everything you do online starts with a DNS lookup. DNS is the directory of the internet. You type a name like &lt;code&gt;example.com&lt;/code&gt;, and a DNS resolver turns that name into an address your computer can connect to. If the resolver stops answering, nothing loads. Your browser cannot even start the conversation.&lt;/p&gt;

&lt;p&gt;Control D runs that resolver as a service. Paying customers point their devices at it, and it answers lookups while applying their filtering rules: block this category, allow that service. The filtering rules live in profiles, and profiles contain services. A service is a ready-made entry for something like a streaming platform, backed by a list of domains that Control D maintains. Each domain in a service can carry an optional override, such as "allow" or "block", that changes how that one domain is treated.&lt;/p&gt;

&lt;p&gt;That override is the whole story.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bug that waited 25 days
&lt;/h2&gt;

&lt;p&gt;On 16 September 2026, Control D released an API update. It added validation for the optional per-domain override in services. As part of that update, the API began saving the override as an integer, a whole number, instead of as text.&lt;/p&gt;

&lt;p&gt;The DNS software that reads those services expects the override as a string, as text. A number is not a string. To the reader, the saved value was unreadable.&lt;/p&gt;

&lt;p&gt;But nothing broke on 16 September, because the new code only ran when a domain was saved with an explicit override. Ordinary additions to a service never touched it. Services were edited in the following weeks without incident. The bug sat in production for 25 days, waiting for someone to save a domain with an explicit override for the first time.&lt;/p&gt;

&lt;p&gt;That first save happened at 16:40 UTC on Sunday 11 October. A member of the team made a routine change in the admin tools to resolve a customer request, adding four domains to one service with an explicit "allow" override. The API stored the four overrides as numbers and told every DNS server for paid plans to reload that service.&lt;/p&gt;

&lt;p&gt;Two minutes later, at 16:42, no DNS queries from paying customers were being answered anywhere.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why every server fell at once
&lt;/h2&gt;

&lt;p&gt;There were two separate failures here, and it matters to keep them apart, because each one has its own fix.&lt;/p&gt;

&lt;p&gt;The first failure was the type mismatch itself. The API wrote a number. The DNS software expected text. A writer and a reader disagreed about the format of a shared value, and nobody had a test that checked the writer's output against the reader's expectations. Control D said so plainly in its report: "Our tests did not check that data saved by our API stayed in the format our DNS software reads."&lt;/p&gt;

&lt;p&gt;The second failure was what the DNS software did when it met the unreadable value. It stopped. It did not log the bad entry and move on to the rest of the service. It stopped the whole process. And because a service's domain list is shared configuration, delivered to every DNS server for paid plans at the same moment, all of them stopped at once.&lt;/p&gt;

&lt;p&gt;The failover system made it worse in the way failovers do when the fault is everywhere at once. As locations went offline, a safeguard kicked in that moves traffic to healthy locations. But every location had the same problem, so there was nowhere healthy to send it.&lt;/p&gt;

&lt;p&gt;Then the automatic restarts made it worse still. The DNS software restarted on its own, as designed. But it was also designed not to start if it could not read all of its configuration, so that it would never serve a half-loaded filtering policy. Every restart therefore failed on the same four stored numbers, over and over, until a person corrected them.&lt;/p&gt;

&lt;p&gt;Think about that for a moment. The safeguard that was supposed to protect customers from a half-loaded policy is what kept the service down. The system chose to serve nothing rather than serve something incomplete, and the incomplete thing was four values out of thousands.&lt;/p&gt;

&lt;h2&gt;
  
  
  The timeline, in numbers
&lt;/h2&gt;

&lt;p&gt;The report Control D published on 20 October gives the whole sequence:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;16:40 UTC: the routine change is saved. Every DNS server for paid plans stops.&lt;/li&gt;
&lt;li&gt;16:42: no paid DNS queries are answered anywhere.&lt;/li&gt;
&lt;li&gt;16:46 to 16:47: the first automated alerts fire, but they report individual servers and locations failing. None of them says that DNS for paying customers is down.&lt;/li&gt;
&lt;li&gt;16:51: failures across multiple locations are reported internally, and the on-call engineer is paged.&lt;/li&gt;
&lt;li&gt;16:55: on-call acknowledges and starts triage.&lt;/li&gt;
&lt;li&gt;17:05 to 17:16: the outage is acknowledged publicly on Reddit and Discord.&lt;/li&gt;
&lt;li&gt;17:16: the cause is traced to the 16:40 change and the September API update.&lt;/li&gt;
&lt;li&gt;17:30: the affected service is saved again with the four overrides removed, so no number is stored.&lt;/li&gt;
&lt;li&gt;17:31 to 17:35: DNS starts returning, and is fully restored at every location by 17:35.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Fifty-four minutes from the save to full restoration. Thirty-six minutes from the first alert to the cause being found. And the fix itself took five minutes once the cause was known: remove four values, let the servers restart cleanly.&lt;/p&gt;

&lt;p&gt;There is a second timeline hidden inside this one. The alerting gap is its own lesson. The system knew servers were failing within six minutes. But it reported the failures one server at a time, and nobody's alert said the one sentence that mattered: "DNS for paying customers is down." Control D now pages on-call when answered DNS queries for paying customers drop to zero in any region for more than two minutes. That single alert would have paged someone within two to four minutes on 11 October.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this looks like in your own code
&lt;/h2&gt;

&lt;p&gt;You probably do not run a DNS service. But you almost certainly have a writer and a reader that share a format, and a process that loads configuration at startup. Here is the pattern, in Go, with the two mistakes and their fixes side by side.&lt;/p&gt;

&lt;p&gt;First, the reader that stops on one bad entry. This is the shape of the Control D failure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;loadServices&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="n"&gt;Service&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ReadFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;services&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="n"&gt;Service&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Unmarshal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="c"&gt;// one bad entry kills the whole load&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One unreadable entry, and the caller gets nothing. If this runs at startup, the process refuses to start. If it runs on a config reload, the process stops. The fix is to read entry by entry, set aside the ones you cannot read, and log them loudly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;loadServices&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="n"&gt;Service&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ReadFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RawMessage&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Unmarshal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;services&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nb"&gt;make&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="n"&gt;Service&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;svc&lt;/span&gt; &lt;span class="n"&gt;Service&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Unmarshal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;svc&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"skipping unreadable service entry %d: %v"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;services&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;svc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The difference is a design decision, not a trick. The first version treats configuration as all or nothing. The second treats each entry as independent, so one bad entry costs you one service instead of the whole system. That is exactly the fix Control D shipped: an entry it cannot read is now set aside and logged, during reloads and at startup, instead of stopping the software.&lt;/p&gt;

&lt;p&gt;Second, the writer. The bug was not only in the reader. The API wrote a number where the reader expected text, and nothing checked the writer's output. The cheapest test in the world catches this: save through the real code path, then read the stored value back with the real reader, and compare the format. In Python, the shape of that check is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;test_override_round_trip&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;saved&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;save_service_override&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;domain&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;example.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;override&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;allow&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;stored&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_raw&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;saved&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="nf"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;stored&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;override&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;override stored as &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;stored&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;override&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]).&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;, &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;reader expects str&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="n"&gt;reader&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load_service&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;saved&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]).&lt;/span&gt;&lt;span class="n"&gt;domains&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;override&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;allow&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That test runs the writer and the reader against each other, which is the point. A unit test of the writer alone would have passed, because the writer did exactly what its new code told it to do. The failure lived in the gap between two components, so the test has to live in that gap too. Control D's own report says that tests of this shape, run against the code that was live on 11 October, reproduce the failure.&lt;/p&gt;

&lt;p&gt;Third, the rollout. Control D rolls out software updates gradually, a few servers at a time. Configuration changes were not staged at all: the bad config reached every paid server at the same moment. The fix in progress is to roll out configuration changes gradually too, the way software updates already are. The same principle applies at any scale. If a change can break every instance at once, it should reach a small set first, with a check that it loaded cleanly, before it reaches the rest. A canary for config is worth as much as a canary for code, and it is usually easier to build.&lt;/p&gt;

&lt;h2&gt;
  
  
  The lesson that is easy to miss
&lt;/h2&gt;

&lt;p&gt;It is tempting to file this one under "type error" and move on. That misses the interesting part. The type error was a small, ordinary bug, the kind any team ships. What made it an outage was everything around it: a shared config with no staging, a reader that stopped instead of skipping, a startup guard that turned a bad value into a restart loop, and alerts that described symptoms instead of the service-level fact.&lt;/p&gt;

&lt;p&gt;Each of those is a choice you can make differently this week, in a system you already run:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Validate what you write with the reader that will read it, not with a separate schema that can drift.&lt;/li&gt;
&lt;li&gt;Never let one bad entry kill a whole load. Skip it, log it loudly, and keep serving the rest.&lt;/li&gt;
&lt;li&gt;Stage configuration changes the way you stage code changes.&lt;/li&gt;
&lt;li&gt;Alert on the customer-facing fact, not on the individual server. "Queries answered dropped to zero" is an alert. "Server 14 is down" is a footnote.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The four domains were removed at 17:30, and by 17:35 everything was back. The fix took five minutes. Finding it took thirty-six. The bug had been live for twenty-five days. Every one of those numbers is a reminder that the expensive part of an incident is almost never the fix. It is the time between "something is wrong" and "we know what it is", and the distance between the change that caused it and the system that felt it.&lt;/p&gt;

&lt;p&gt;What is the shared format in your system that a writer and a reader could disagree about, and is there a test that runs them against each other?&lt;/p&gt;

</description>
      <category>backend</category>
      <category>devops</category>
      <category>dns</category>
      <category>go</category>
    </item>
    <item>
      <title>The sensor that said the power was fine while a whole cloud zone went dark</title>
      <dc:creator>Kashif Manzer</dc:creator>
      <pubDate>Sun, 08 Nov 2026 14:12:27 +0000</pubDate>
      <link>https://dev.to/kashif_manzer/the-sensor-that-said-the-power-was-fine-while-a-whole-cloud-zone-went-dark-2llg</link>
      <guid>https://dev.to/kashif_manzer/the-sensor-that-said-the-power-was-fine-while-a-whole-cloud-zone-went-dark-2llg</guid>
      <description>&lt;p&gt;At 06:53 on Tuesday 20 October 2026, an underground power cable failed outside a data centre in London. The building lost one of its two power feeds. That should have been a non-event. The site had a second feed, a bank of diesel generators, and batteries to cover the gap while the generators started.&lt;/p&gt;

&lt;p&gt;Six hours later, an entire Google Cloud zone was still dark. Forty services were affected. Banks could not process payments properly. And the generators, which had fuel and were ready to run, never received the order to start.&lt;/p&gt;

&lt;p&gt;The reason is the kind of bug that should make every backend developer uncomfortable, because most of us have written its smaller cousin. A sensor was measuring the wrong thing, and the system that trusted it had no way to know.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the site was supposed to work
&lt;/h2&gt;

&lt;p&gt;The facility hosts europe-west2-b, one of three availability zones in Google Cloud's London region. An availability zone is a physically separate data centre building, or part of one, with its own power and cooling, so that a failure in one zone does not take down the others.&lt;/p&gt;

&lt;p&gt;The site used what engineers call 2N power. That means two complete, independent power paths for every critical load. If one path fails, the other carries everything. Two utility feeders, called A and B, brought power in from the grid. Behind them sat a bank of diesel generators, run by a small industrial computer called a PLC, a programmable logic controller. The PLC's job was simple: watch for a loss of grid power, start the generators, and hand the load over to them.&lt;/p&gt;

&lt;p&gt;Between the grid failing and the generators taking over, batteries covered the gap. The UPS, the uninterruptible power supply, gave the site about five minutes of runtime. Five minutes is not much. It is exactly enough, if the PLC notices the failure and starts the generators at once.&lt;/p&gt;

&lt;p&gt;But the site was not in its normal state that morning. Six days earlier, on 14 October, a quarterly generator load test had turned up problems on the B feeder path. The feed B breaker, the big switch connecting feeder B to the building, had been physically opened so repairs could be done. The site was running on a single feed, feeder A, carrying the whole load while B was out for maintenance. Google calls this a temporary single-feed maintenance posture. In plain words: the backup power path was already switched off when the remaining path failed.&lt;/p&gt;

&lt;p&gt;None of that was secret or sloppy. Maintenance postures like this are normal. They are also the moment when the next failure hurts most, because the redundancy you are counting on is the thing already taken apart.&lt;/p&gt;

&lt;h2&gt;
  
  
  The sensor on the wrong side of the breaker
&lt;/h2&gt;

&lt;p&gt;At 06:53 BST, the underground cable fault killed feeder A. At that moment, the PLC should have seen the voltage disappear and ordered the generators to start.&lt;/p&gt;

&lt;p&gt;It did not, because of where its sensors were wired.&lt;/p&gt;

&lt;p&gt;A breaker has two sides. The line side faces the utility grid. The load side faces the building. The PLC's undervoltage sensors were wired on the line side of the feed B breaker, upstream of the switch. Feeder B was still live on the utility side of that breaker. The breaker was open, so no power could flow from B into the building, but the sensor could not see the breaker. It could only see voltage, and voltage was present.&lt;/p&gt;

&lt;p&gt;So the PLC asked its one question, "is there voltage on the feeder?", and got the answer "yes". Its logic did not also check the second fact that mattered: is the breaker actually closed, so that voltage can reach the building? Google's report puts it plainly. The PLC logic did not verify both an undervoltage condition and physical breaker position. Both the active and the standby controller ran identical logic and shared the same upstream sensors, so the redundancy that was supposed to protect the site had the same blind spot twice. Two controllers, one mistake.&lt;/p&gt;

&lt;p&gt;The batteries ran out at about 07:00. Servers, storage, and network hardware in the zone lost power. When the on-site team tried a remote load transfer through the PLC, the system refused, because the same live voltage reading told it there was nothing wrong to fix. The team eventually moved the load to a standby utility source by hand, and power to the data hall came back at 08:20. But the damage was done. The main impact lasted 6 hours and 8 minutes. By 13:08, 99.5 percent of Compute Engine virtual machines were healthy again, and new virtual machines could be created. The full incident ran 6 hours and 10 minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  The blast radius was bigger than one zone
&lt;/h2&gt;

&lt;p&gt;The physical outage was confined to zone b. The impact was not. When workloads failed over into zones a and c, the sudden demand saturated the available capacity there, and control plane calls, the calls services make to ask the platform to do things, kept timing out against components in the dead zone. The result was elevated errors and slow responses across the whole London region.&lt;/p&gt;

&lt;p&gt;One detail deserves its own paragraph, because it is the same bug wearing a different coat. Apigee X, Google's API management service, is designed to survive losing one zone, because its datastore keeps a copy in each of the region's three zones. But a scheduling misconfiguration had placed two of the three copies in zone b. When the zone went dark, the datastore lost quorum, the minimum number of copies needed to agree before it will answer, and the service returned errors for 7 hours and 19 minutes. The design said three zones. The reality was two copies in one zone. Same shape of failure: the check that was supposed to guarantee spread was not measuring spread.&lt;/p&gt;

&lt;p&gt;Google's full root cause went up on its status page on 4 November. It is worth reading in full. The report also lists what changed afterwards: the PLC logic was reprogrammed and retested, generator load transfer tests were run, and Google is validating PLC configurations at other sites with similar layouts. The utility cable itself was located on 26 October, with repair targeted for 13 November.&lt;/p&gt;

&lt;h2&gt;
  
  
  The version of this bug in your codebase
&lt;/h2&gt;

&lt;p&gt;Here is why this story belongs in a backend article and not just a data centre one. The PLC's failure was a health check that checked the wrong signal. It asked "is there voltage?" when the question that mattered was "can power reach the building?" The answer to the first question was correct and useless.&lt;/p&gt;

&lt;p&gt;Almost every service has a version of this. The most common is the health endpoint that only proves the process is alive:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;healthHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WriteHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusOK&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"ok"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This handler answers 200 while the database it depends on is down, while the disk is full, while the queue it writes to is unreachable. It is the voltage sensor on the line side of the breaker. It measures something true, and it tells you nothing about whether the service can do its job.&lt;/p&gt;

&lt;p&gt;The fix is to check the real dependency, with a timeout so a dead dependency cannot hang the check forever:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;healthHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;sql&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DB&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandlerFunc&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cancel&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WithTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Second&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;cancel&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;PingContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"database unreachable"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusServiceUnavailable&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WriteHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusOK&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"ok"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;PingContext&lt;/code&gt; opens a real connection and waits for the database to answer. Two seconds is the budget: if the database cannot answer in two seconds, the service is not healthy, and saying so is the whole point. The same shape works in Python:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@app.get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/health&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;health&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SELECT 1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;status&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;unavailable&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;503&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;status&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ok&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep the check cheap. &lt;code&gt;SELECT 1&lt;/code&gt; is enough. You are testing that the path is open, not running a report. And only put a dependency in the check if losing it really means the service cannot serve traffic. A health check that fails because an optional analytics sink is slow is the same mistake in reverse: a check that cries wolf, which teaches everyone to ignore it.&lt;/p&gt;

&lt;p&gt;The second lesson is about the handover, not the backup. Google had generators. The generators worked. What failed was the handover from grid to generator, the exact step the five minute battery existed to cover. Backups fail this way all the time: the backup file exists, but nobody has ever restored from it. The replica is running, but nobody has ever failed over to it. The test that matters is not "does the backup exist" but "does the handover finish inside the buffer".&lt;/p&gt;

&lt;p&gt;That test can be small. Here is the shape of it, as a sketch for a staging environment, not production:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;TestFailoverCompletesInsideBuffer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;testing&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;stopPrimary&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c"&gt;// Your battery: the buffer you actually have. Five minutes&lt;/span&gt;
    &lt;span class="c"&gt;// for Google, maybe thirty seconds for you. Measure it.&lt;/span&gt;
    &lt;span class="n"&gt;deadline&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;30&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Second&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Before&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;deadline&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;probeBackup&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="c"&gt;// the handover worked inside the buffer&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;100&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Millisecond&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fatal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"backup did not take over inside the buffer"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run it on a schedule, and run it after every change to the failover path. A handover that worked six months ago is a claim, not a fact. Google's own fix list includes exactly this: full generator load transfer tests, run after the outage, with the automatic startup checked against the battery timer.&lt;/p&gt;

&lt;p&gt;The third lesson is about redundant pairs that share a failure mode. Two PLCs running identical logic from the same sensor are not two independent checks. They are one check with a spare. The same trap shows up in software: two database replicas in the same availability zone, like the Apigee copies. Two health checks that both call the same function. A primary and a standby that both read the same configuration file, so the bad config takes them both down. Redundancy only counts when the two sides can fail independently. If they share a sensor, a config, a zone, or a code path, you have one system with a costume change.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three questions to take back
&lt;/h2&gt;

&lt;p&gt;First, does your health check touch the real dependency, or does it measure a proxy for it? Open a connection. Run the trivial query. Check the thing, not the shadow of the thing.&lt;/p&gt;

&lt;p&gt;Second, have you tested the handover, not just the backup? Kill the primary in staging and watch the clock. If the takeover takes longer than your buffer, your buffer is a wish, not a plan.&lt;/p&gt;

&lt;p&gt;Third, do your redundant pairs share a failure mode? Look for the shared sensor: the same config, the same zone, the same code path, the same person who has to approve the failover. Shared failure modes are invisible until the day they are not.&lt;/p&gt;

&lt;p&gt;The uncomfortable part of the London outage is how ordinary each piece was. A cable fault outside the building. Maintenance on the backup path. A sensor wired to the wrong side of a switch. A controller that checked one fact instead of two. None of it was exotic. That is the point. The systems that take down a whole zone are rarely exotic. They are ordinary parts, arranged so that a single wrong measurement can silence the alarm that was supposed to save them.&lt;/p&gt;

&lt;p&gt;So here is the question to take back to your own systems: which of your health checks is measuring voltage on the wrong side of the breaker, and how would you know?&lt;/p&gt;

&lt;p&gt;Source: Google Cloud Service Health, incident report for the europe-west2-b power disruption of 19 to 20 October 2026, updated 4 November 2026. &lt;a href="https://status.cloud.google.com/incidents/Xs2XTHzAVC9YnafnPyzj" rel="noopener noreferrer"&gt;https://status.cloud.google.com/incidents/Xs2XTHzAVC9YnafnPyzj&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>backend</category>
      <category>cloud</category>
      <category>go</category>
    </item>
  </channel>
</rss>
