Skip to content

OOM allocating and ZERO RANDOM FD errors#

Issue:

When running the services in a Docker container on RHEL 8 or RHEL 9, you may encounter errors related to file descriptor allocation such as "OOM allocating" and "ZERO RANDOM FD". This issue does not occur on other distributions.

Cause:

This problem is linked to how the container runtime handles file descriptor limits (nofile). By default, the container runtime may set LimitNOFILE to infinity, which can cause the application to attempt to allocate an excessive number of file descriptors, leading to these errors.

Workaround:

To mitigate this issue, you can set explicit file descriptor limits (ulimit) for the container.

This can be done by adding the following configuration to your Docker Compose file or equivalent container runtime configuration for the corresponding service:

licenses:
    ...
    network_mode: host
    container_name: luna-licenses
    ulimits:
      nofile:
        soft: 200000
        hard: 200000
    environment:
    ...

Or by launching the container with the appropriate parameters:

docker run --ulimit nofile=200000:200000

This sets a reasonable limit for the number of file descriptors that can be opened by the process, preventing the allocation errors.

Note: This workaround is specific to RHEL 8 and RHEL 9. The issue has not been observed on other distributions.