Unable to allocate shared memory

yoali luque

Registered
Jul 14, 2017
2
0
1
venezuela
cPanel Access Level
Root Administrator
stackoverflow.com/questions/31620082/apache-memory-error


Code:
Fatal Error Unable to allocate [B]shared memory segment
Use ipcs -lm to determine current shared memory limits. And use ipcs -ma to determine how much shared memory is currently in use.

UPDATE you have added the comment to show "max seg size (kbytes) = 32768". So max segment size is 32MB. Original error is "Unable to allocate shared memory segment of 67108864 bytes". So unable to allocate segment of 64MB.

Increase your maximum shared memory segment size from 32MB to 128MB.

echo "134217728" >/proc/sys/kernel/shmmax
echo "134217728" >/proc/sys/kernel/shmall
And then retry. If apache2 then works ok, make the change survive reboots, by placing an entry in /etc/sysctl.conf as below:

kernel.shmmax=134217728
kernel.shmall=134217728
in my server

Code:
# ipcs -lm

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 32768
max total shared memory (kbytes) = 8388608
min seg size (bytes) = 1

# ipcs -ma

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status     

------ Semaphore Arrays --------
key        semid      owner      perms      nsems   
0x00000000 0          root       600        1       
0x00000000 5275649    nobody     600        1       
0x00000000 5046274    nobody     600        1       
0x00000000 5079043    nobody     600        1       
0x00000000 5308420    nobody     600        1       
0x00000000 5341189    nobody     600        1       
0x00000000 5373958    nobody     600        1       

------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages
What appears as modify in syst file is commented,

I do not see any meaning to it, then where the values are really modified so I can put the shared memory I need


File: /etc/sysctl.conf
Code:
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 0

# Controls source route verification
# net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
# net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
# kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
# kernel.core_uses_pid = 1

# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

# Controls the default maxmimum size of a mesage queue
# kernel.msgmnb = 65536

# Controls the maximum size of a message, in bytes
# kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes
# kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages
# kernel.shmall = 4294967296
[/quote]
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,229
463
Hello,

Can you verify if you are using CloudLinux on this system?

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,229
463
Hello,

Could you open a support ticket using the link in my signature so we can take a closer look at the system?

Thank you.