Skip to content

frontend-mem-nag.sh does not account for Docker container memory limits #46368

Closed

Description

@shubhamjrd4559-sudo

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

  1. Run the frontend container on a Linux host with more than 3 GB of available memory.
  2. Set the container's memory limit below 3 GB.
  3. Run docker/frontend-mem-nag.sh inside the container.
  4. 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.max and memory.current.
  • For cgroups v1, use memory.limit_in_bytes and memory.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

  1. zhengdaodeguL commented on Nov 19, 2026

    @zhengdaodeguL
    Contributor

    Fixed in #46375: frontend-mem-nag.sh now reads the cgroup memory limit and usage (v2 memory.max/memory.current, v1 memory.limit_in_bytes/memory.usage_in_bytes) and uses min(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 new frontend-mem-nag-test.sh regression test (34 checks against fake meminfo/cgroup fixtures, fails before / passes after); bash -n and git diff --check pass. Real-Docker-container behavior and the full frontend build are left to CI.

  2. added
    review:checkpoint
    and removed
    review:checkpoint
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions