Bug #35713 InnoDB cannot allocate memory anymore after increasing RAM
Submitted: 31 Mar 2008 18:52 Modified: 4 Apr 2008 10:12
Reporter: Eugene Turkestanov Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.0.51a OS:Linux
Assigned to: Sveta Smirnova CPU Architecture:Any
Tags: allocated, innodb, Memory

[31 Mar 2008 18:52] Eugene Turkestanov
Description:
We upgraded system memory to 6 GB, installed a new kernel (2.6.18-53.1.e15PAE) - CentOS and we upgraded MySQL from version 5.0.22 to 5.0.51a.
After that I changed configuration in my.cnf file to: 

[mysqld]
datadir=/data/mysql
socket=/data/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

skip_locking
max_allowed_packet = 16M
table_cache        = 128
sort_buffer_size   = 4M
read_buffer_size   = 4M
thread_cache       = 8
query_cache_size   = 8M
max_connections    = 50
tmp_table_size     = 32M
key_buffer         = 256M
default_table_type = InnoDB

log_warnings

innodb_data_file_path = ibdata1:10M:autoextend

innodb_buffer_pool_size         = 4000M
innodb_additional_mem_pool_size = 20M
innodb_log_file_size            = 256M
innodb_log_buffer_size          = 8M

innodb_file_per_table

[mysql.server]
user=mysql
#basedir=/var/lib

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[client]
port = 3306
[mysqldump]
quick
max_allowed_packet = 16M

[myisamchk]
key_buffer = 64M
sort_buffer_size = 64M
read_buffer = 2M
write_buffer = 2M

But when I wanted to restart the server I got the error message in error log:

080331 10:08:53  mysqld started
080331 10:08:53  InnoDB: Error: cannot allocate 4194320384 bytes of
InnoDB: memory with malloc! Total allocated memory
InnoDB: by InnoDB 39688400 bytes. Operating system errno: 12
InnoDB: Check if you should increase the swap file or
InnoDB: ulimits of your operating system.
InnoDB: On FreeBSD check you have compiled the OS with
InnoDB: a big enough maximum process size.
InnoDB: Note that in most 32-bit computers the process
InnoDB: memory space is limited to 2 GB or 4 GB.
InnoDB: We keep retrying the allocation for 60 seconds...
InnoDB: Fatal error: cannot allocate the memory for the buffer pool
080331 10:09:53 [ERROR] Default storage engine (InnoDB) is not available
080331 10:09:53 [ERROR] Aborting

080331 10:09:53 [Note] /usr/sbin/mysqld: Shutdown complete

080331 10:09:53  mysqld ended

I changed innodb_buffer_pool_size = 2000M and server started. But according to formula 
innodb_buffer_pool_size + key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections + max_connections * 2 MB = 2000M + 256M + (4M + 4M) * 50 + 50 * 2M = 2756MB. Why can't I use 4756MB? There is nothing else but MySQL only.

Thanks

How to repeat:
No idea
[31 Mar 2008 19:24] Sveta Smirnova
Thank you for the report.

Please provide output of ulimit -a
[31 Mar 2008 20:30] Eugene Turkestanov
Here you are:
# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
max nice                        (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 106496
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
max rt priority                 (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 106496
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
[4 Apr 2008 10:12] Susanne Ebrecht
Many thanks for writing a bug report.
This is not a bug when you use a 32bit system.
In a Linux 2.4 kernel usually the memory space it split into 2GB for kernel and 2GB for user space.
In a Linux 2.6 kernel you can configure this during kernel compilation most times usually its the same as in 2.4.

Your problem here is that your system isn't able to handle more then 2GB.

Please feel free to open this bug again when your system is 64bit.