fix(hw): discard impossible cgroup v2 CPU samples - #7103
Open
Alphaxiaoteng wants to merge 3 commits into
Open
Conversation
Prefer the process cgroup cpu.stat, divide by measured elapsed time, drop non-monotonic/oversized deltas, and clamp to [0, 1] like v1 so an idle worker cannot flip to FULL on a torn root-cgroup read. Fixes livekit#7102.
|
|
Alphaxiaoteng
force-pushed
the
fix/cgroup-v2-impossible-cpu-samples
branch
from
September 3, 2026 06:47
d902abd to
6f14da7
Compare
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.
Summary
Fixes #7102.
cpu.maxlimits along that same cgroup's ancestor chain. A child withmaxcan still inherit a restricted parent.[0, 1].NUM_CPUSoverride precedence and unavailable-affinity fallbacks.pytest.mark.unitcategory, addressing the failed hosted collection gate.Verification
099dcbbwith only the new tests retained: 4 failed, 4 passed. The failures reproduce both full/fractional quota bursts, nested cgroup normalization, and escaping-path behavior.2e81a70, archived with only the first additional edge-case tests overlaid, produced 4 failed, 9 passed. These reproduce delayed first reads, quotas exceeding host capacity, tighter affinity, and unknown host capacity with known affinity.--unitselection: 30 passed, 1 warning. This includes 19 CPU regression cases. The test fixture also emitted an unretrievedSystemExit(0)task diagnostic. Unchanged baseline worker tests passed 11 tests with the same synthetic short-JWT-key warning; the output is not claimed to be warning-free.git diff --checkpassed. Focused Linux-target mypy passed for the changed module (--follow-imports=silent).make checkin the isolated environment passed formatting/lint but could not complete all-plugin type checks: optional plugin packages/typing dependencies are absent. Fresh hosted CI and tests passed for final commit6f14da7: full Python 3.10/3.13 type checks, all three blockguard platforms, and 2457 passed / 5 skipped / 34 warnings in the unit-test job. This hosted result was verified from the actual job log.Limits and disclosure
The tests use tiny local file/time mocks plus actual package imports and repository test configuration. I have not run the reporter's Xen guest or an overnight production experiment. CLA confirmation still belongs to the account owner.
The initial patch was made with Cursor. Codex performed the follow-up repairs and tests, with independent agent review and main-agent reruns. This updates the same PR rather than creating a duplicate.