Skip to content

fix: clamp memory reported in cgroup v1 reports#8841

Merged
dmadisetti merged 1 commit intomainfrom
dm/mo-5447
Mar 24, 2026
Merged

fix: clamp memory reported in cgroup v1 reports#8841
dmadisetti merged 1 commit intomainfrom
dm/mo-5447

Conversation

@dmadisetti
Copy link
Copy Markdown
Collaborator

📝 Summary

closes #8639

On cgroup v1 (common in older WSL2), memory.limit_in_bytes reports a value near LONG_MAX ~9.2×10^18. This PR clamps the total reported memory to 1 exabyte.

NB cgroup v2 seems to report just max. Unable to directly reproduce the reported issue, but this seems like a reasonable work around.

Copilot AI review requested due to automatic review settings March 23, 2026 23:02
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Mar 23, 2026 11:02pm

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Addresses incorrect container memory reporting on cgroup v1 systems (e.g., older WSL2) where memory.limit_in_bytes can be a near-LONG_MAX sentinel value, by treating extremely large limits as “unlimited” and adding targeted tests around cgroup v1/v2 memory parsing.

Changes:

  • Add an “unlimited” threshold check for cgroup v1 memory.limit_in_bytes and return None when the sentinel/oversized value is detected.
  • Introduce unit tests that mock cgroup v1/v2 files to validate unlimited vs. real-limit behavior.
  • Export/use cgroup file path constants in tests for consistent mocking.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
marimo/_utils/health.py Adds a cgroup v1 “unlimited” threshold and short-circuits to None when the reported limit is unrealistically large.
tests/_utils/test_health_utils.py Adds mocked-file tests for cgroup v1 sentinel limits, real limits, and cgroup v2 max.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dmadisetti dmadisetti added the bug Something isn't working label Mar 23, 2026
@dmadisetti dmadisetti requested a review from mscolnick March 23, 2026 23:15
@dmadisetti dmadisetti merged commit 612f94c into main Mar 24, 2026
48 of 49 checks passed
@dmadisetti dmadisetti deleted the dm/mo-5447 branch March 24, 2026 00:06
@github-actions
Copy link
Copy Markdown

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.21.2-dev43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Container memory usage numbers are wrong

3 participants