dockerrosfedora

Problem with Docker image ROS noetic on Fedora-40


After installing Fedorа-40 OS on the workstation and running roscore in Docker container, I get a problem. After a few seconds, the RAM and swap are 90% occupied. The Gnome's graphical interface does not respond. After stopping (Ctrl+C) roscore, the memory is released and the system performance is restored. ROS - noetic version, image based on Ubuntu Focal 20.04

I tried changing the type of the ROS image - the result is the same.


Solution

  • This is related to the number of open file descriptors.

    Already reported and resolved here.

    On Fedora 40 Workstation, roslaunch was opening a lot more files than what was allowed leading to RAM + Swap running out and crashing GNOME.

    Resolved this by setting hard and soft limits for allowed file descriptors in /etc/docker/daemon.json.

    {
        "default-ulimits": {
            "nofile": {
                "Name": "nofile",
                "Hard": 524288,
                "Soft": 1024
            }
        }
    }
    

    Hard limit: The absolute maximum number of open file descriptors allowed.
    Soft limit: The threshold at which the kernel will start sending warnings to discourage opening more files.

    This is a global change for all containers, you can also pass it as docker run arguments:
    docker run --ulimit nofile=1024:524288 <image-name>