Skip to content

fix(memguardian): respect Linux cgroup memory limits - #798

Draft
knakul853 wants to merge 5 commits into
mainfrom
codex/memguardian-cgroup
Draft

knakul853 wants to merge 5 commits into
mainfrom
codex/memguardian-cgroup

Conversation

@knakul853

Copy link
Copy Markdown
Contributor

Problem

Linux workers with a cgroup memory cap can report host RAM to memguardian. In an isolated 256 MiB container, Nuclei saw 23.1% and kept low-memory mode off while cgroup usage was 78.4%.

Change

Use effective cgroup v1/v2 working-set usage and the most restrictive ancestor when below host RAM. Preserve host behavior for unlimited groups.

Proof

With this branch, the same Nuclei container entered low-memory mode at 80.0% actual cgroup use. Linux cgroup fixture tests passed in a network-disabled container; Linux arm64 vet and diff check passed.

This is a memory-safety prerequisite, not a measured scan-speed improvement. No production or DEV deployment is included.

Open in Codex: codex://threads/01a07d91-20ab-7a33-81ae-cfd2520595f4
Resume from CLI: codex resume 01a07d91-20ab-7a33-81ae-cfd2520595f4

@knakul853

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

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.

1 participant