Repository navigation
Description
Bug description
On Linux, docker/frontend-mem-nag.sh reads available memory from /proc/meminfo but does not account for memory limits imposed on the container through cgroups.
When the host has more than 3 GB of available memory but the container is limited to less than 3 GB, the script may report sufficient memory and omit the warning. This can leave developers unaware that the frontend build is running with less memory than the script's stated minimum.
Steps to reproduce
- Run the frontend container on a Linux host with more than 3 GB of available memory.
- Set the container's memory limit below 3 GB.
- Run
docker/frontend-mem-nag.shinside the container. - Observe that the script reports host memory instead of warning about the lower container limit.
Expected behavior
The script should account for the memory available to the container. When a cgroup memory limit is configured, it should use the lower of the host's available memory and the container's remaining memory limit when deciding whether to display the warning.
Actual behavior
The script reads MemAvailable (or MemFree as a fallback) from /proc/meminfo. This value may reflect host memory and can be higher than the memory available under the container's cgroup limit.
Proposed solution
On Linux, detect the cgroup version and read the container memory limit and usage:
- For cgroups v2, use
memory.maxandmemory.current. - For cgroups v1, use
memory.limit_in_bytesandmemory.usage_in_bytes.
When a finite cgroup limit is available, calculate the container's remaining memory and compare it with the host's available memory. Use the lower value for the 3 GB threshold check. If cgroup information is unavailable or indicates no finite limit, retain the existing /proc/meminfo behavior.
Additional context
This affects Docker-based frontend development when the container has a lower memory limit than the host. Checking the container's effective memory would make the warning more accurate.
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.11
Node version
16
Browser
Chrome
Additional context
I would be interested in contributing a fix for this issue. Could a maintainer please review the report and let me know if this is a valid issue and whether I can work on a PR for it? I’m happy to submit a proposed fix with tests.
Checklist
- I have searched Superset docs and Slack and didn't find a solution to my problem.
- I have searched the GitHub issue tracker and didn't find a similar bug report.
- I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Activity
zhengdaodeguL commentedon Nov 19, 2026
Fixed in #46375:
frontend-mem-nag.shnow reads the cgroup memory limit and usage (v2memory.max/memory.current, v1memory.limit_in_bytes/memory.usage_in_bytes) and usesmin(host available, container remaining)for the 3 GB check, falling back to the previous host-only behavior when no finite cgroup limit is available. Includes a newfrontend-mem-nag-test.shregression test (34 checks against fake meminfo/cgroup fixtures, fails before / passes after);bash -nandgit diff --checkpass. Real-Docker-container behavior and the full frontend build are left to CI.