Skip to content

fix(memory_pressure): don't warn on expected EAGAIN from memory.reclaim#154

Merged
max-tet merged 2 commits into
mainfrom
fix/clayde/reclaim-eagain-log
Jul 13, 2026
Merged

fix(memory_pressure): don't warn on expected EAGAIN from memory.reclaim#154
max-tet merged 2 commits into
mainfrom
fix/clayde/reclaim-eagain-log

Conversation

@ClaydeCode

Copy link
Copy Markdown
Contributor

What

The PAUSED+PAGED page-out (_reclaim_container) writes a container's full RSS to cgroup v2 memory.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:

WARNING memory.reclaim incomplete for container <id>: [Errno 11] write could not complete without blocking

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 EAGAIN as expected → log.debug. Keep log.warning for genuine errors (ENOENT, EPERM, …). No behavior change — same write, same best-effort semantics.

Tests

test_memory_pressure.py: EAGAIN → no warning (debug); other OSError → warning. 10 passed, ruff clean.

🤖 Generated with Claude Code

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>
@ClaydeCode
ClaydeCode requested a review from max-tet July 13, 2026 17:49
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>
@max-tet
max-tet merged commit e870ba2 into main Jul 13, 2026
7 checks passed
@max-tet
max-tet deleted the fix/clayde/reclaim-eagain-log branch July 13, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants