Skip to content

fix(docker): handle unlimited cgroup v2 memory - #2132

Open
nightcityblade wants to merge 1 commit into
unclecode:developfrom
nightcityblade:fix/issue-2123
Open

fix(docker): handle unlimited cgroup v2 memory#2132
nightcityblade wants to merge 1 commit into
unclecode:developfrom
nightcityblade:fix/issue-2123

Conversation

@nightcityblade

Copy link
Copy Markdown
Contributor

Summary

Fixes #2123.

Handle cgroup v2's memory.max sentinel before integer conversion. Unlimited cgroup-v2 containers now report their own memory usage as a percentage of host capacity instead of falling through to the unrelated host-wide usage percentage. The existing finite-limit and cgroup-v1 paths remain unchanged.

List of files changed and why

  • deploy/docker/utils.py - parse the cgroup-v2 max sentinel explicitly and preserve numeric cgroup limit handling.
  • deploy/docker/tests/test_utils_memory.py - add a focused regression test for an unlimited cgroup-v2 container.

How Has This Been Tested?

  • Installed the Docker test dependencies from deploy/docker/requirements.txt into a Python 3.12 environment.
  • .venv/bin/python -m pytest deploy/docker/tests/test_utils_memory.py -q — 1 passed.
  • uvx ruff check --select E9,F63,F7,F82 --ignore F821 deploy/docker/utils.py deploy/docker/tests/test_utils_memory.py — passed.
  • uvx ruff format --check deploy/docker/tests/test_utils_memory.py — passed.
  • .venv/bin/python -m compileall -q deploy/docker/utils.py deploy/docker/tests/test_utils_memory.py — passed.
  • git diff --check — passed.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas — N/A; no complex logic was introduced.
  • I have made corresponding changes to the documentation — N/A; this corrects behavior already described by the existing docstring.
  • I have added/updated unit tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

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