Failed to fork: Cannot allocate memory

    El otro día me encontré un error en el que no me dejaba prácticamente ejecutar ni una actualización en el sistema y al ver el log del propio sistema me encontré lo siguiente:

    Apr  1 17:27:42 node01 dnf[165165]: Rocky Linux 8 - AppStream                        33 kB/s | 4.8 kB     00:00
    Apr  1 17:27:42 node01 dnf[165165]: Rocky Linux 8 - BaseOS                           32 kB/s | 4.3 kB     00:00
    Apr  1 17:27:42 node01 dnf[165165]: Rocky Linux 8 - Extras                           22 kB/s | 3.1 kB     00:00
    Apr  1 17:27:42 node01 dnf[165165]: Extra Packages for Enterprise Linux 8 - x86_64  332 kB/s |  28 kB     00:00
    Apr  1 17:27:43 node01 dnf[165165]: Out of memory allocating 335544320 bytes!
    Apr  1 17:27:43 node01 systemd[1]: [email protected]: Failed to fork: Cannot allocate memory
    Apr  1 17:27:43 node01 systemd[1]: [email protected]: Failed to run 'start' task: Cannot allocate memory
    Apr  1 17:27:43 node01 systemd[1]: [email protected]: Failed with result 'resources'.
    Apr  1 17:27:43 node01 systemd[1]: Failed to start Process Core Dump (PID 165174/UID 0).
    Apr  1 17:27:43 node01 systemd[1]: dnf-makecache.service: Main process exited, code=dumped, status=6/ABRT
    Apr  1 17:27:43 node01 systemd[1]: dnf-makecache.service: Failed with result 'core-dump'.

    Fué curioso porque no me dejó tampoco desmontar la swap

    [root@node01 ~]# swapoff -a
    swapoff: /dev/sdb: swapoff failed: Cannot allocate memory

    Verificando el estado del sistema tampoco se apreciaba nada relevante…

    [root@node01 ~]# top -c d1
    top - 19:44:44 up 6 days,  9:58,  1 user,  load average: 0.00, 0.01, 0.00
    Tasks: 124 total,   2 running, 122 sleeping,   0 stopped,   0 zombie
    %Cpu0  :  0.0 us,  1.0 sy,  0.0 ni, 99.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
    %Cpu1  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
    MiB Mem :   3909.7 total,   3069.8 free,    654.7 used,    185.3 buff/cache
    MiB Swap:    512.0 total,    245.0 free,    267.0 used.     37.5 avail Mem
    
        PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
     165571 apache    20   0 1789572  23328   9424 S   1.0   0.6   0:00.12 /usr/sbin/httpd -DFOREGROUND
     165894 root      20   0  264140   4156   3516 R   1.0   0.1   0:00.07 top -c d1
          1 root      20   0  249552  11396   6296 S   0.0   0.3   0:56.17 /usr/lib/systemd/systemd --switched-root --system --deserialize 18
          2 root      20   0       0      0      0 S   0.0   0.0   0:00.11 [kthreadd]
          3 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 [rcu_gp]
          4 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 [rcu_par_gp]
          5 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 [slub_flushwq]

    En cualquier caso, se solucionó ejecuntando el siguiente comando:

    sysctl -w vm.overcommit_memory=1

    Indagando en varios posts, estos fueron los mas óptimos.

    Leave a Reply

    Your email address will not be published. Required fields are marked *