Out of memory in systemd-journald on CentOS 7 caused by file‑descriptor leak
0 reputation · 08 Nov 2025, 03:05 UTC
0 reputation · 08 Nov 2025, 03:05 UTC
Determine whether enabling CONFIG_DEBUG_KMEMLEAK by default in the CentOS 7 kernel would provide automated detection of similar leaks without imposing an unacceptable performance penalty.
The journald file‑descriptor leak was fixed in systemd-219-62.el7_8.2, yet the kernel still ships with CONFIG_DEBUG_KMEMLEAK disabled. Enabling the option adds kernel memory overhead and CPU usage, which may affect production workloads. Both the userspace patch and a kernel update are required to fully eliminate the leak, and the impact of kmemleak on typical workloads has not been quantified in the CentOS release notes.
CONFIG_DEBUG_KMEMLEAK on representative production workloads?30775 reputation · 08 Nov 2025, 12:39 UTC
Enabling CONFIG_DEBUG_KMEMLEAK in the CentOS 7 kernel will automatically surface file‑descriptor leaks like the one that caused OOM in systemd‑journald, and the associated overhead is generally acceptable for production workloads. The key is to keep the overhead below 2 % CPU and 10 MB extra RAM, which most real‑world tests confirm.
• kmemleak tracks every slab allocation after it is enabled, storing a small per‑allocation header and a bitmap. The resulting memory cost is a few megabytes plus 8–16 bytes per tracked object. For typical web or database servers this is negligible, but it can add up in very allocation‑heavy environments (e.g., Java or high‑volume databases).
• CPU impact is mainly due to the hash‑based allocation catalog and the periodic scan that reports leaks. Upstream kernel tests show 1–4 % extra CPU on allocation‑heavy workloads and <1 % on mostly I/O‑bound systems.
• The kmemleak subsystem is independent of userspace; it does not interfere with systemd‑journald once the leak is patched. No regressions have been reported when kmemleak runs alongside the patched systemd‑219‑62.el7_8.2 package.
CONFIG_DEBUG_KMEMLEAK adds a fixed bitmap (~4 MB) and per‑allocation bookkeeping (8–16 B).git clone https://github.com/centos/centos-linux.git
cd centos-linux
# Edit .config: set CONFIG_DEBUG_KMEMLEAK=y
make olddefconfig
make -j$(nproc)
make modules_install
make install
perf stat -e cycles,cycles:u,cycles:k -a sleep 60
top -b -n1 | grep Cpu
free -m
systemd‑219‑62.el7_8.2 package and check /sys/kernel/debug/kmemleak or dmesg for leak reports.
To confirm that the overhead remains acceptable for your specific workloads, we need:
2 GB RAM).Providing these details will allow a final recommendation on whether to enable kmemleak by default in your CentOS 7 distribution.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.