Skip to content

[Bug]: ReplayBuffer cannot detect the real memory constraints in Kubernetes. #2185

@LarryLiZimo

Description

@LarryLiZimo

🐛 Bug

In stable_baselines3/common/buffers.py, around line 200, it uses psutil to determine available memories, which fails to detect the actually available memory.

# in the `__init__` of `ReplayBuffer`
if psutil is not None: 
    mem_available = psutil.virtual_memory().available

My server has over 700G memory but only 64 G available in my k8s container. I ran a training script, which is estimated to require 30 G memory. As a consequence, it is terminated silently. If warned earlier by StableBaslines3, other users may be spared of this potential problem.

To Reproduce

No response

Relevant log output / Error message

System Info

No response

Checklist

  • My issue does not relate to a custom gym environment. (Use the custom gym env template instead)
  • I have checked that there is no similar issue in the repo
  • I have read the documentation
  • I have provided a minimal and working example to reproduce the bug
  • I've used the markdown code blocks for both code and stack traces.

Metadata

Metadata

Assignees

No one assigned

    Labels

    check the checklistYou have checked the required items in the checklist but you didn't do what is written...documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions