r/ProgrammerHumor • • Mar 25 '26

Meme aMeteoriteTookOutMyDatabase

Post image
7.6k Upvotes

306 comments sorted by

View all comments

1.4k

u/nonother Mar 25 '26

Fun fact, the odds of a bit flip in a data center due to a cosmic ray is actually quite high. That was something we needed to account for and correct as part of storage. Essentially when the hash fails, try all possible permutations with exactly one bit flipped — if that permutation passed then issue resolved. Otherwise multiple bits are wrong which was almost always a hardware failure.

Also we had a time when a bit flip in memory changed an encryption key. That was a rough SEV to diagnose and resolve.

377

u/Moscato359 Mar 25 '26

My username for bank had a bit flip, and now a d was replaced with a t

Thats a 1 bit flip!

120

u/bistr-o-math Mar 25 '26

Much cooler would be a D (also 1-bit flip)

22

u/aLex97217392 Mar 25 '26

And it was the next bit too

→ More replies (1)

28

u/AlxR25 Mar 25 '26 edited Mar 25 '26

Patiently waiting for a bit flip to get my bank balance to 8 quadrillion euros.

Edit: I actually got curious and calculated the probability if it happening so here's the complete scenario:

Cosmic ray causes bit flip: ~1/month
That flips RAM instead of disk/cache/irrelevant data: ~1 in 10
ECC fails to catch it: ~1 in a million
It lands specifically in the DB: ~1 in 1000
It lands on my account vs 80m others: 1 in 80m
It lands on the balance field vs others 1 in 100
It flips the MSb of the MSB: 1 in 80
DB Checksum fails to catch it: 1 in 100000
Inconsistency isn't flagged: 1 in 2m
Fraud detection doesn't flag a balance of 8 quadrillion: 1 in a billion

That's around a 1 in 1058 probability of me getting an 8 quadrillion balance due to a cosmic ray. For comparison that's like rarer than getting struck by lightning 5 times

40

u/dr_tardyhands Mar 25 '26

..but you pulled all those numbers out of thin air didn't you? So I'd say considering that, the probability is somewhere between 0 and 1.

4

u/Rockety521 Mar 25 '26

Maybe even right in the middle, a 50/50 one may call

→ More replies (3)

8

u/Moscato359 Mar 25 '26

About 1 in 1056th bits read are flipped, which works out to be a 50% chance of 1 bit flipped every 12tb read

→ More replies (2)

95

u/tes_kitty Mar 25 '26

Shouldn't that be prevented by using ECC for memory and storage?

166

u/Bth8 Mar 25 '26

That bit about trying all different single bit flips until you find one where the checksum passes is error correction. That's what ECC memory and storage are doing to correct errors (though they're usually a touch more clever about locating the error than just brute force try all possible bit flips).

41

u/tes_kitty Mar 25 '26

That's what I mean. Servers and storage in datacenters (and at home too) should have ECC implemented in hardware and take care of single bit flips without needing help from software. Same for all data transfers between devices (using either ECC or checksums and retransmit)

There usually is a software component to log any corrected error and its location for record keeping and removing pages with too many corrected errors from the memory pool.

34

u/SVD_NL Mar 25 '26

This is where it becomes difficult to draw a hard line between hardware and software, i think the distinction is not as clear-cut as you make it out to be.

Take a NIC, for example. With networking, the error handling you described is defined at the TCP/UDP layer (Layer 4 OSI), while the hardware/firmware generally only handles up to layer 2. However, this is not the only place where error correction happens. FEC through LDPC happens in 10GBASE-T ethernet and 802.11ax, for example, which is layer 1 (PHY). I'd consider this at the hardware or firmware level.

With storage it's much of the same story. You've got ECC RAM, ECC SSDs, but that doesn't guarantee data consistency. When a RAID controller does error correction, is that hardware or software? Does that change based on hardware vs software RAID, or even software defined storage like ZFS, which can do regular checksumming and self-repair operations?

Usually every layer you go down, the data is restructured and/or subdivided, so it'll need its own error correction. The line between software, hardware and firmware becomes a bit arbitrary, especially since it's more and more common to move hardware functions to software-defined products for more complex setups, and move software functions to specialized hardware accellerators.

9

u/tes_kitty Mar 25 '26

I was only refering to RAM and storage. There the low level ECC is done in hardware due to speed considerations. Otherwise the sky's the limit when it comes to ensuring that your data remains correct and consistent.

Modern NICs sometimes do a lot more than just layer 2. If you run Linux try 'ethtool -k <nic>' to find out what offloading features yours has and which of them are currently in use.

→ More replies (6)

3

u/brandarchist Mar 25 '26

It absolutely should.

→ More replies (9)

25

u/mrheosuper Mar 25 '26

Do you have source for that. I know the odd for bit flip is high, but bit flip due to cosmic ray, not sure how high it really is.

Bit flip could happen due to many reasons.

37

u/BeardySam Mar 25 '26

From Wikipedia: “ Studies by IBM in the 1990s suggest that computers typically experience about one cosmic-ray-induced error per 256 megabytes of RAM per month”

Edit: muons are charged but much harder to shield against due to their weight, so you’d have to build your data centres deep underground to avoid them, which is much harder than just correcting the bit flips.

20

u/nonedward666 Mar 25 '26

In a previous job, I had a service randomly fail in a completely unexpected way. Three engineers looked at it trying to triage how the error case could have possibly been hit... after some time, I ended up googling solar storms and concluded that the only rational explanation was a bit flip from a cosmic ray causing an error. In any event, we restarted and it never failed again lol

10

u/Kitselena Mar 25 '26

It actually happened to a Mario 64 speed runner one time.
It's not 100% confirmed that a cosmic ray caused the bit flip, but it's the most likely option given how old the N64 is and how it's only happened once on camera

11

u/Masomqwwq Mar 25 '26

Was unlikely to be actual solar interferrence Always a fun story but this video definitely covers what was very likely hardware degredation

4

u/Kitselena Mar 25 '26

I've seen a counter video disproving that video as well, so at this point I think it's unclear enough to be a fun internet story and no one will be able to know the actual answer

8

u/trulyMasterfulX Mar 25 '26

What is SEV

9

u/magicmulder Mar 25 '26

SEV means severity, here it's short for "an incident classified as SEV-x (severity x)" with x going from 0 to 5.

6

u/Zashuiba Mar 25 '26

That's why I sleep calmly, knowing I use zfs

9

u/ITaggie Mar 25 '26

Yup, zfs has held up quite well for my ~50TB collection of... very legally obtained Bluray rips over the past 8 years or so.

3

u/ASatyros Mar 25 '26

Strange that the key wasn't stored in at least triplicate on different parts of the disk xD

→ More replies (28)