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

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.

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.

Show the corrected errors of one memory controller
cat /sys/devices/system/edac/mc/mc0/ce_count
Show the uncorrectable errors of the same controller
cat /sys/devices/system/edac/mc/mc0/ue_count

The kernel log keeps the machine check messages. When the hardware reports a memory slot, those messages can name it.

Show kernel messages about machine checks and EDAC
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

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.

  1. Show the corrected errors counted by the first memory controller.

    cat /sys/devices/system/edac/mc/mc0/ce_count

    What you should see: Corrected errors, counted by this memory controller. A count that keeps climbing is the warning.

  2. Show the uncorrectable errors counted by the same controller.

    cat /sys/devices/system/edac/mc/mc0/ue_count

    What you should see: Uncorrectable errors, counted by the same controller. Any rise needs action at once.

  3. 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.