innodb - mysql Fatal error: cannot allocate memory for the buffer pool -


hi have error log mysql, idea. website works time , mysql shutdown after couple of hours.

140919 10:48:27 [warning] using unique option prefix myisam-recover instead of myisam-recover-options deprecated , removed in future release. please use full name instead. 140919 10:48:27 [note] plugin 'federated' disabled. 140919 10:48:27 innodb: innodb memory heap disabled 140919 10:48:27 innodb: mutexes , rw_locks use gcc atomic builtins 140919 10:48:27 innodb: compressed tables use zlib 1.2.3.4 140919 10:48:28 innodb: initializing buffer pool, size = 128.0m innodb: mmap(137363456 bytes) failed; errno 12 140919 10:48:28 innodb: completed initialization of buffer pool 140919 10:48:28 innodb: fatal error: cannot allocate memory buffer pool 140919 10:48:28 [error] plugin 'innodb' init function returned error. 140919 10:48:28 [error] plugin 'innodb' registration storage engine failed. 140919 10:48:28 [error] unknown/unsupported storage engine: innodb 140919 10:48:28 [error] aborting  140919 10:48:28 [note] /usr/sbin/mysqld: shutdown complete  140919 10:48:28 [warning] using unique option prefix myisam-recover instead of myisam-recover-options deprecated , removed in future release. please use full name instead. 140919 10:48:28 [note] plugin 'federated' disabled. 140919 10:48:28 innodb: innodb memory heap disabled 140919 10:48:28 innodb: mutexes , rw_locks use gcc atomic builtins 140919 10:48:28 innodb: compressed tables use zlib 1.2.3.4 140919 10:48:28 innodb: initializing buffer pool, size = 128.0m innodb: mmap(137363456 bytes) failed; errno 12 140919 10:48:28 innodb: completed initialization of buffer pool 140919 10:48:28 innodb: fatal error: cannot allocate memory buffer pool 140919 10:48:28 [error] plugin 'innodb' init function returned error. 140919 10:48:28 [error] plugin 'innodb' registration storage engine failed. 140919 10:48:28 [error] unknown/unsupported storage engine: innodb 140919 10:48:28 [error] aborting  140919 10:48:28 [note] /usr/sbin/mysqld: shutdown complete 

tldr;

mysql can't restart because it's out of memory, check have appropriate swapfile configured.

didn't help? if that's not issue, more qualified questions continue research are:

background

i had problem on first system set on ec2, characterised wordpress site hosted there going down on occasion "error establishing database connection".

the logs showed same error op posted. reading of error (timestamps removed) is:

  • out of memory error: innodb: fatal error: cannot allocate memory buffer pool
  • innodb can't start without enough memory [error] plugin 'innodb' init function returned error. [error] plugin 'innodb' registration storage engine failed. [error] unknown/unsupported storage engine: innodb [error] aborting
  • mysqld shutting down, in context, means failing restart! [note] /usr/sbin/mysqld: shutdown complete

checking /var/log/syslog , searching mysql yields:

out of memory: kill process 15452 (mysqld) score 93 or sacrifice child killed process 15452 (mysqld) total-vm:888672kb, anon-rss:56252kb, file-rss:0kb init: mysql main process (15452) killed kill signal init: mysql main process ended, respawning type=1400 audit(1443812767.391:30): apparmor="status" operation="profile_replace" name="/usr/sbin/mysqld" pid=21984 comm="apparmor_parser" init: mysql main process (21996) terminated status 1 init: mysql main process ended, respawning init: mysql post-start process (21997) terminated status 1 <repeated> 

note: may have gunzip , search through archived logs if error occurred before logs rotated cron.

solution

in case underlying issue i'd neglected configure swapfile.

you can check see if have 1 configured running free -m.

total used free shared buffers cached mem: 604340 587364 16976 0 29260 72280 -/+ buffers/cache: 485824 118516 swap: 0 0 0

in example above, swap: 0 indicates no swapfile.

tutorials on setting 1 up:

note bigger not better! ubuntu guide:

the "diminishing returns" means if need more swap space twice ram size, you'd better add more ram hard disk drive (hdd) access 10³ slower ram access, something take 1 second, takes more 15 minutes! , still more minute on fast solid state drive (ssd)...


regarding other answers here...

the innodb memory heap disabled

this isn’t error, indication innodb using system’s internal memory allocator instead of own. default yes/1, , acceptable production.

according docs, command deprecated, , removed in mysql versions above 5.6 (and assume mariadb):

http://dev.mysql.com/doc/refman/5.6/en/innodb-performance-use_sys_malloc.html

thanks to: ruben schade comment

[note] plugin 'federated' disabled.

the message federated disabled not error. meant federated engine not on mysql server. it's not used default. if don't need it, don't care message.

see: https://stackoverflow.com/a/16470822/2586761


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -