Skip to content
DevMeme
157 of 7435
Race Condition in the Real World: The Case of the Out-of-Sync Cat
DistributedSystems Post #194, on Mar 3, 2019 in TG

Race Condition in the Real World: The Case of the Out-of-Sync Cat

Why is this DistributedSystems meme funny?

Level 1: The Echo Cat

Imagine shouting into a canyon and hearing your own voice come back a few seconds later — for a moment it sounds like there are two of you, but there's really just one, plus a delayed copy. That's the whole joke: the kid already rescued the kitty, but the tree is still playing the "echo" of the cat that used to be there. The grandma panics because she sees two cats; the kid stays calm because he knows one of them is just the world being a little slow to update. Wait a moment, look again — one cat, happy ending.

Level 2: Why the Computer Shows You Old Stuff

A few terms doing the heavy lifting: a replica is a copy of data kept on another machine so reads are fast and the system survives failures. Replication lag is the delay before a change made on one copy shows up on the others. A stale read is what happens when you ask a copy that hasn't caught up — you get the old answer, like the tree still "showing" a cat that's already been rescued. Eventual consistency is the promise that all copies will agree eventually, with no promise about how soon.

You've already lived this comic even if you've never deployed a database: you change your profile picture and it updates on your phone but not your laptop for a minute; you get a "package delivered" email while the tracking page still says "in transit." Early in your career you'll hit it in production — you'll INSERT a row, immediately SELECT it from a read replica, get nothing back, and spend an hour convinced the database ate your data. It didn't. It was in the tree and in your arms. Check again.

Level 3: The Replica in the Tree

The senior-engineer laugh here comes from recognizing the shape of the conversation. The woman is every stakeholder who has ever filed a ticket titled "data is wrong"; the kid is every engineer who has typed, with dead eyes, "it's replication lag, refresh the page." Notice he never climbs the tree — "No need" — he bends down and produces the cat from somewhere closer, the way a smart client reads from the nearest replica instead of paying the latency cost of the authoritative source. Then the meowing continues ("MEW" from the branches, "?! Huh?! Wait... what... ?!" below) and we're in the incident channel.

What makes it "too real" is that this anomaly is normal operation, not a bug — yet it generates bug reports forever. Real systems produce this constantly: a user posts a comment and doesn't see it (write went to the primary, read hit a lagging replica); a dashboard shows yesterday's totals next to today's (cache not invalidated); two support agents see different versions of the same ticket. Teams burn weeks chasing "duplicates" that are just one entity observed at two points in its propagation. The industry's two famous hard problems — cache invalidation and naming things — are both present: the stale cat is a cache entry, and even the cat's identity ("there's two") is a naming crisis.

The deeper satire is in the resolution. Nothing is repaired. No code changes. The system was designed to behave this way because synchronous replication everywhere would make the world unbearably slow — you'd be stuck waiting for every tree on the street to acknowledge the cat before you could hold it. We trade correctness-right-now for availability and speed, then spend the savings explaining the trade-off to confused observers, one "check again" at a time.

Level 4: Convergence Is Not Optional, Only Eventual

What this comic dramatizes — a cat simultaneously in the tree and in the old woman's arms — is the textbook condition of a replicated system between updates and convergence. In distributed systems terms, the kid performed a write (cat retrieved) against one replica, while the woman continued reading from another replica that hadn't received the update. Her observation "Wait... there's two..." is not an error; it's a stale read, and the kid's answer is the formal truth of every eventually consistent store: "Yes, but no. It's just a bit out of sync. Check again."

The theoretical backbone here is the tension formalized in the CAP theorem: when a system is partitioned (the tree and the yard are, briefly, separate views of the world), you choose between refusing reads (consistency) or serving possibly-stale data (availability). The universe in this comic is clearly an AP system — it never blocks the woman's perception, it just lets her see an outdated state and converge later. Eventual consistency, as defined in the literature on replicated data, guarantees only this: if no new writes occur, all replicas will eventually return the same value. It says nothing about when. The comic's final panel — empty tree, "Well, I'll be! You're right!" — is the convergence event, and "check again" is the only protocol available to a client: retry the read until the anti-entropy machinery catches up.

There's even a precise name for what the woman lacked: read-your-writes consistency (and its sibling, monotonic reads). Session guarantees like these exist exactly because humans find the two-cats state intolerable — the same reason your app pins a user to the primary database right after they update their profile, lest they see their old avatar and file a bug. The deadpan brilliance of the strip is that the kid doesn't fix the anomaly. He just explains the consistency model and waits. Which, honestly, is the entire job.

Description

A six-panel comic strip illustrates a classic tech problem through a superhero analogy. In the first panel, an elderly woman points to a cat in a tree, exclaiming, 'Kitty is stuck in the tree!'. A superhero in a yellow and black costume stands nearby. In the second panel, she asks, 'Do you think you can climb all the way up there?!', to which the hero replies, 'No need.' He then reaches down and picks up an identical cat from the base of the tree. The third panel shows the woman overjoyed, saying 'KITTY! THANKS INVINCIBLE!', as the hero hands her the cat. However, in the fourth panel, she looks back at the tree in confusion ('?!! HUH?! WAIT... WHAT...'), as the original cat is still there. In the fifth panel, she points out, 'WAIT... there's two...', and the hero calmly explains, 'Yes, but no. It's just a bit out of sync. Check again.' In the final panel, the cat in the tree has vanished, and the woman, now holding her cat, remarks, 'Well, I'll be! You're right!'. This comic cleverly visualizes a race condition or an eventual consistency issue, where for a brief moment, two states of the same entity exist due to processing delays or synchronization lags. It's a perfect metaphor for the strange, transient bugs that appear in distributed systems, which often resolve themselves upon a 'refresh' or re-check

Comments

8
Anonymous ★ Top Pick That's not a bug; it's eventual consistency. Just tell the old lady to refresh her cache or wait for the next garbage collection cycle to resolve the duplicate
  1. Anonymous ★ Top Pick

    That's not a bug; it's eventual consistency. Just tell the old lady to refresh her cache or wait for the next garbage collection cycle to resolve the duplicate

  2. Anonymous

    Don’t worry, Grandma - your vision just hit a stale read replica; once Raft reaches consensus the phantom cat will garbage-collect itself

  3. Anonymous

    When you fix the race condition but now you have to explain to the PM why there are two cats in prod and neither of them should exist

  4. Anonymous

    The cat was both in the tree and in her arms - not quantum physics, just a read replica with lag

  5. Anonymous

    This comic perfectly captures the nightmare of eventual consistency: when your distributed system confidently returns two cats because the rescue operation replicated before the 'cat already rescued' tombstone propagated. The real question is whether you need strong consistency for cat rescues or if BASE semantics are acceptable - though explaining to stakeholders why they temporarily have Schrödinger's duplicate cat might require a blameless postmortem

  6. Anonymous

    Grandma's Grafana dashboard: cat hits 95th percentile branch height, boom - SEV1, ladder inbound before the query completes

  7. Anonymous

    Cat stuck in a tree? I don’t climb; I just write the cat to the ground and let the branch replica converge - if you saw two, that’s a read-after-write anomaly

  8. Anonymous

    Schrödinger’s Cat-as-a-Service: he wrote to the primary while grandma read a lagging replica - two cats until eventual consistency kicked in

Use J and K for navigation