Repository navigation
fix(memstats): Leave reclaimable page cache out of the OOM warning - #963
Merged
Merged
Conversation
The 85% warning compared memory.current with memory.max. That counts the page cache, which the pipeline's mmap'd tables and downloads keep at the limit by design. So the 2026-11-15 production run warned 21 times, starting in fetch_inputs with 3 MB of anonymous memory, while anonymous RSS never went above 0.14 GB. The warning now leaves out the page cache the kernel can drop: `file` minus `shmem` from memory.stat. shmem still counts, so a workdir that landed on tmpfs still warns. Without memory.stat, it falls back to the whole usage. Both numbers are now logged with every snapshot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ttfb2JuvbLtNhvRsMwuK9e
Owner
Author
|
Verified in production. Generated by Claude Code |
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.
Requested by Sascha · project thread
The "memory usage at N% of the cgroup limit -- at risk of being OOM-killed" warning compared
memory.currentwithmemory.max. That figure includes the page cache, which the mmap'd tables and the input downloads keep at the limit by design, so the warning fired on nearly every step. In the 2026-11-15 production run (logs/osmdiffs-weekly-rerun-20261115.log) it fired 21 times. The first one came infetch_inputs, with 3 MB of anonymous memory, andrss_anon_bytesnever went above 0.14 GB.docs/PRODUCTION.mdalready told readers to ignore the warning.Changes
MemStatsnow also readsfileandshmemfrom the cgroup'smemory.stat, ascgroup_file_bytesandcgroup_shmem_bytes, and every step snapshot logs them.MemStats::cgroup_unreclaimable_fraction: usage minus the page cache the kernel can drop (file − shmem), divided by the limit. shmem still counts, so a workdir on tmpfs still warns. Withoutmemory.stat, it falls back to the whole usage.cgroup_usage_fractionnext to it.scripts/test-on-hetzner/validate.pyreports the new fraction when a record has it.docs/PRODUCTION.mdgets a note on the change.Testing
memory.statparsing and for the new fraction: page cache, shmem, nomemory.stat, zero limit.cargo test --libpasses (457), and so does clippy.tests/integration_test.rsfails here both with and without this change, because this machine has no tippecanoe. CI has it.Generated by Claude Code