fix(memory_pressure): don't warn on expected EAGAIN from memory.reclaim#154
Merged
Conversation
Pausing an app writes its full RSS to cgroup v2 memory.reclaim to page it out. The full RSS can never be reclaimed (some pages are always resident), so once the kernel has paged out what it can it returns EAGAIN — the expected terminal signal, not a failure. Because we always request the full RSS, that fired a WARNING on essentially every pause: memory.reclaim incomplete for container <id>: [Errno 11] write could not complete without blocking which reads like a fault when the page-out actually worked (swap fills as expected). Log EAGAIN at debug; keep the warning for genuine errors (missing file, EPERM, ...). Behavior is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The full suite configures logger levels above DEBUG, so caplog.at_level on the root logger dropped the memory_pressure debug record (CI-only failure; passed in isolation). Scope at_level to the module logger. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
The PAUSED+PAGED page-out (
_reclaim_container) writes a container's full RSS to cgroup v2memory.reclaim. The full RSS can never be reclaimed in whole (some pages are always resident), so the kernel pages out what it can and returns EAGAIN — the expected terminal signal, not a failure. Since we always request the full RSS, that logged a WARNING on essentially every pause:Observed live on a shard where pause + page-to-swap is working correctly (swap fills as expected). The warning reads like a fault when nothing is wrong.
Change
Treat
EAGAINas expected →log.debug. Keeplog.warningfor genuine errors (ENOENT,EPERM, …). No behavior change — same write, same best-effort semantics.Tests
test_memory_pressure.py: EAGAIN → no warning (debug); otherOSError→ warning. 10 passed, ruff clean.🤖 Generated with Claude Code