cpuload/netlink: report the real error and skip the reader on cgroup v2#3896
Merged
Conversation
verifyHeader passed errno to binary.Read by value instead of by pointer, so binary.Read always failed with "invalid type int32" and masked the actual netlink error code the kernel returned. Signed-off-by: Davanum Srinivas <davanum@gmail.com>
CGROUPSTATS_CMD_GET (cgroupstats) is implemented only for cgroup v1: the kernel's cgroupstats_build() rejects a cgroup v2 dentry with EINVAL, and there is no v2 equivalent. Detect the unified hierarchy in New() and fail with a clear message. The manager already logs that and runs without the reader, so -enable_load_reader no longer aborts every container's stats update on a v2 host (where /metrics previously served only container_scrape_error). Signed-off-by: Davanum Srinivas <davanum@gmail.com>
7f8b0c2 to
f229c97
Compare
SergeyKanzhelev
approved these changes
Jun 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
--enable_load_readerbreaks all container stats on cgroup v2 —CGROUPSTATS_CMD_GETis cgroup-v1-only, so the kernel returns EINVAL for every cgroup andupdateStatsaborts, leaving/metricswith onlycontainer_scrape_error. Root-cause analysis in #3137.verifyHeader: pass&errnoso anNLMSG_ERRORreports the real netlink error instead of masking it as "invalid type int32".netlink.New(): detect the cgroup v2 unified hierarchy and fail cleanly, so the manager skips the reader instead of breaking all container stats.This doesn't make cpu-load work on v2 (no
cgroupstatsequivalent; PSI is the path noted in #3137) — it removes the footgun. Verified on a v2 host:--enable_load_readerno longer drops/metricsto scrape-error-only.