Memory errors: the ones fixed and the ones that are not
Video 086 of 140 in Virtualization Foundations, in the unit “Hardware failure and health”. 4:09, with English and Hindi audio.
Memory holds what every program is working on, and a single flipped bit can change a value with no warning. Most servers use memory that repairs one bad bit on the spot, and the server counts each repair. This article explains the difference between correctable and uncorrectable errors, how ECC memory handles them, and how to read the Linux error counters and kernel log.
What you will learn
- A memory bit can flip, from a weak memory cell or a stray particle.
- ECC memory repairs one bad bit and counts the repair, and it flags two bad bits in one word.
- A rising corrected error count is the warning, and it often comes before a failure.
- An uncorrectable error needs action at once, because the data in that word cannot be trusted.
- A machine without ECC memory shows no error counter at all.
How one bit goes wrong
Memory stores billions of bits. Sometimes a tiny fault flips one of them, and the value changes with no warning. A flip can come from a weak memory cell, or from a charged particle from space that hits the chip. For one bit this is rare, but a big server holds a great many bits.
Correctable and uncorrectable errors
Most servers use ECC memory, which stands for error-correcting code. It stores extra check bits, so one flipped bit can be found and fixed on the spot.
- Correctable error: the memory fixes the bit itself, and the program never sees it. The server still counts it.
- Uncorrectable error: the damage is detected but cannot be repaired, usually because two bits flipped in the same word. The server must treat that data as unsafe.
Reading the error counters on Linux
The kernel's EDAC layer counts memory errors for each memory controller. Each count is a small file, and you read it with cat. The file ce_count holds corrected errors, and the file ue_count holds uncorrectable ones.
cat /sys/devices/system/edac/mc/mc0/ce_countcat /sys/devices/system/edac/mc/mc0/ue_countThe kernel log keeps the machine check messages. When the hardware reports a memory slot, those messages can name it.
sudo journalctl -k | grep -i -E 'mce|edac'Why a climbing count is the warning to watch
A count that climbs over days often points to one bad memory stick. In the example, a single cell starts to flip bits, ECC fixes each one, and the counter climbs while the database runs normally. Soon two bits can flip in the same word, and then the kernel log records the damage.
The safe response is to move the work to another host, and replace the stick.
What goes wrong, and how you notice it
- Ignoring the counter: a slow climb in corrected errors often comes before a failure.
- Uncorrectable errors: the machine can crash, or a process can be stopped to protect the data.
- Memory without ECC: some desktop memory has no ECC, so a flip goes unseen and no counter exists.
Note: Check which memory your servers have before you trust them, and read the counters regularly.
Read the memory error counters
You need a Linux server with sudo rights. Read the counts again over several days, because a count that climbs over time is the signal.
Show the corrected errors counted by the first memory controller.
cat /sys/devices/system/edac/mc/mc0/ce_countWhat you should see: Corrected errors, counted by this memory controller. A count that keeps climbing is the warning.
Show the uncorrectable errors counted by the same controller.
cat /sys/devices/system/edac/mc/mc0/ue_countWhat you should see: Uncorrectable errors, counted by the same controller. Any rise needs action at once.
Show the kernel messages about machine checks and EDAC.
sudo journalctl -k | grep -i -E 'mce|edac'What you should see: The messages about machine checks can name the memory slot that reported the error.
Terms
- ECC
- Error-correcting code: extra check bits stored with memory, so that one flipped bit can be found and repaired.
- EDAC
- The Linux layer that counts memory errors for each memory controller.
- Correctable error
- A memory error that the memory repairs itself, so the program never sees it. The server still counts it.
Check yourself
What does ECC do with one flipped bit?
It finds the wrong bit and repairs it, so the program never notices, and the server counts the repair.
What does ECC do when two bits flip in the same word?
It flags the word as damage. The data in that word cannot be trusted.
Why is a memory error count a useful early warning?
A count that climbs over days often points to one bad memory stick, and it can appear long before a failure.
Previous: How disks fail, and how SMART warns you. Next: Sensors, fans and the BMC's event log.