MySQL shutting down without warning, out of memory?

LeviXC asked:

I’m scratching my head on this. I have New Relic tracking, and my log files on the server, but MySQL keeps stopping, and all I have is this when I check logs, New Relic has nothing. Only thing I’m seeing is the “Initializing buffer pool, size = 128.0M”, am I just running out of memory?

root@ps1:/var/log/mysql# cat error.log
140619 23:12:10 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
140619 23:12:10 [Note] Plugin 'FEDERATED' is disabled.
140619 23:12:10 InnoDB: The InnoDB memory heap is disabled
140619 23:12:10 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140619 23:12:10 InnoDB: Compressed tables use zlib 1.2.3.4
140619 23:12:10 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
140619 23:12:10 InnoDB: Completed initialization of buffer pool
140619 23:12:10 InnoDB: Fatal error: cannot allocate memory for the buffer pool
140619 23:12:10 [ERROR] Plugin 'InnoDB' init function returned error.
140619 23:12:10 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140619 23:12:10 [ERROR] Unknown/unsupported storage engine: InnoDB
140619 23:12:10 [ERROR] Aborting

140619 23:12:10 [Note] /usr/sbin/mysqld: Shutdown complete

140619 23:12:11 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
140619 23:12:11 [Note] Plugin 'FEDERATED' is disabled.
140619 23:12:11 InnoDB: The InnoDB memory heap is disabled
140619 23:12:11 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140619 23:12:11 InnoDB: Compressed tables use zlib 1.2.3.4
140619 23:12:11 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
140619 23:12:11 InnoDB: Completed initialization of buffer pool
140619 23:12:11 InnoDB: Fatal error: cannot allocate memory for the buffer pool
140619 23:12:11 [ERROR] Plugin 'InnoDB' init function returned error.
140619 23:12:11 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140619 23:12:11 [ERROR] Unknown/unsupported storage engine: InnoDB
140619 23:12:11 [ERROR] Aborting

140619 23:12:11 [Note] /usr/sbin/mysqld: Shutdown complete

140620  0:37:36 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
140620  0:37:36 [Note] Plugin 'FEDERATED' is disabled.
140620  0:37:36 InnoDB: The InnoDB memory heap is disabled
140620  0:37:36 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140620  0:37:36 InnoDB: Compressed tables use zlib 1.2.3.4
140620  0:37:36 InnoDB: Initializing buffer pool, size = 128.0M
140620  0:37:36 InnoDB: Completed initialization of buffer pool
140620  0:37:36 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 1072329170
140620  0:37:36  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 1072330346
140620  0:37:36  InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 
InnoDB: Apply batch completed
140620  0:37:37  InnoDB: Waiting for the background threads to start
140620  0:37:38 InnoDB: 5.5.35 started; log sequence number 1072330346
140620  0:37:38 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
140620  0:37:38 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
140620  0:37:38 [Note] Server socket created on IP: '127.0.0.1'.
140620  0:37:38 [Note] Event Scheduler: Loaded 0 events
140620  0:37:38 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.35-0ubuntu0.12.04.2'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
140620  0:37:39 [ERROR] /usr/sbin/mysqld: Table './2mbetterfutures/wp_options' is marked as crashed and should be repaired
140620  0:37:39 [Warning] Checking table:   './2mbetterfutures/wp_options'
140620  0:37:39 [ERROR] /usr/sbin/mysqld: Table './2mbetterfutures/wp_postmeta' is marked as crashed and should be repaired
140620  0:37:39 [Warning] Checking table:   './2mbetterfutures/wp_postmeta'
140620  0:37:39 [ERROR] /usr/sbin/mysqld: Table './2mbetterfutures/wp_posts' is marked as crashed and should be repaired
140620  0:37:39 [Warning] Checking table:   './2mbetterfutures/wp_posts'
140620  0:37:39 [ERROR] /usr/sbin/mysqld: Table './2mbetterfutures/wp_rg_form_view' is marked as crashed and should be repaired
140620  0:37:39 [Warning] Checking table:   './2mbetterfutures/wp_rg_form_view'
140620  0:37:39 [ERROR] /usr/sbin/mysqld: Table './delawarebasindrinkingwater/asd235_options' is marked as crashed and should be repaired
140620  0:37:39 [Warning] Checking table:   './delawarebasindrinkingwater/asd235_options'
140620  0:37:39 [ERROR] /usr/sbin/mysqld: Table './delawarebasindrinkingwater/asd235_rg_form_view' is marked as crashed and should be repaired
140620  0:37:39 [Warning] Checking table:   './delawarebasindrinkingwater/asd235_rg_form_view'
140620  0:37:39 [ERROR] /usr/sbin/mysqld: Table './delawarebasindrinkingwater/asd235_rpf_log' is marked as crashed and should be repaired
140620  0:37:39 [Warning] Checking table:   './delawarebasindrinkingwater/asd235_rpf_log'
140620  0:37:39 [ERROR] /usr/sbin/mysqld: Table './realmenrealfires/z_answers' is marked as crashed and should be repaired
140620  0:37:39 [Warning] Checking table:   './realmenrealfires/z_answers'
140620  0:37:39 [ERROR] /usr/sbin/mysqld: Table './realmenrealfires/z_events' is marked as crashed and should be repaired
140620  0:37:39 [Warning] Checking table:   './realmenrealfires/z_events'
140620  0:37:39 [ERROR] /usr/sbin/mysqld: Table './realmenrealfires/z_my_users' is marked as crashed and should be repaired
140620  0:37:39 [Warning] Checking table:   './realmenrealfires/z_my_users'
140620  0:37:39 [ERROR] /usr/sbin/mysqld: Table './realmenrealfires/z_options' is marked as crashed and should be repaired
140620  0:37:39 [Warning] Checking table:   './realmenrealfires/z_options'
140620  0:37:39 [ERROR] /usr/sbin/mysqld: Table './realmenrealfires/z_rg_form_view' is marked as crashed and should be repaired
140620  0:37:39 [Warning] Checking table:   './realmenrealfires/z_rg_form_view'
140620  0:37:39 [ERROR] /usr/sbin/mysqld: Table './smc_tbep_befloridian/asd235_options' is marked as crashed and should be repaired
140620  0:37:39 [Warning] Checking table:   './smc_tbep_befloridian/asd235_options'
140620  0:37:39 [ERROR] /usr/sbin/mysqld: Table './smc_tbep_befloridian/asd235_rg_form_view' is marked as crashed and should be repaired
140620  0:37:39 [Warning] Checking table:   './smc_tbep_befloridian/asd235_rg_form_view'

My answer:


errno 12 does indeed mean Cannot allocate memory, so you are running out of memory somehow. You should reduce your virtual machine’s memory consumption or give it more memory.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.