MySQL crashes periodically: Out of memory

Created:

2017-04-28 10:57:53 UTC

Modified:

2017-08-16 15:56:52 UTC

0

Was this article helpful?


Have more questions?

Submit a request

MySQL crashes periodically: Out of memory

Applicable to:

  • Plesk for Linux

Symptoms

  • Plesk and websites are down from time to time.

  • Server becomes unresponsive.
  • High CPU usage.

  • In the file /var/log/mariadb/mariadb.log the following error messages can be found:

    InnoDB: Fatal error: cannot allocate memory for the buffer pool
    [ERROR] Plugin 'InnoDB' init function returned error.
    [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
    [ERROR] mysqld: Out of memory (Needed 128917504 bytes)
    [ERROR] mysqld: Out of memory (Needed 96681984 bytes)
    [ERROR] Unknown/unsupported storage engine: InnoDB
    [ERROR] Aborting
    [Note] /usr/libexec/mysqld: Shutdown complete
  • Executing dmesg shows:

    Out of memory in UB 103: OOM killed process 1008 (mysqld) score 0 vm:1631980kB, rss:174104kB, swap:154444kB
    
  • There is no free swap space:

    # free -h
        total used free shared buff/cache available
    Mem: 3,7G 3,5G 132M 3,5M 91M 35M
    Swap: 2,0G 2,0G 0K
  • The following can be found in /var/log/messages :

    kernel: Free swap  = 0kB
    kernel: Total swap = 2097148kB
    ...
    kernel: Out of memory: Kill process 21770 (mysqld) score 17 or sacrifice child
    kernel: Killed process 21770 (mysqld) total-vm:2698392kB, anon-rss:24616kB, file-rss:0kB, shmem-rss:0kB

Cause

Insufficient amount of RAM and swap space on the server.

When the system runs out of memory, it starts to kill processes that use RAM to free up space.

Resolution

Increase RAM on the server.

Have more questions? Submit a request
Please sign in to leave a comment.