Z
Z
zvzz2013-11-15 11:48:01
LAMP
zvzz, 2013-11-15 11:48:01

Ubuntu 12.04 / LAMP / out of memory / can't fork?

Good afternoon.
There is a virtual machine on the subject, which sometimes gives an error "Out of memory" either in php , or in mysql, or simply in the shell does not start anything with the error "can not fork" / "out of memory". Wait a little - and the symptom goes away. Launched a load test - some % of requests really fell off with a 500 error. I assembled the same setup cleanly on another (small) droplet, ran the same load test - everything is clean.
From dopsoft on the virtual server there is only exim4. Googling gives answers for old years, or irrelevant, or doesn't help. It looks like processes are limited in maximum memory per process, even though the total used memory is 340 MB out of 1.5 GB.
I would be very grateful for the direction of the search, which conf files to dig / post here.

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 255607
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 255607
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

thank you very much in advance

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vlad Zhivotnev, 2013-11-15
@zvzz

You have openvz with badly configured memory limits. http://habrahabr.ru/post/53236/ here they wrote about something similar (although not entirely true - the memory management system there is much more complicated than just limiting virtual memory). Look in /proc/user_beancounters - there, most likely, some kmemsize ends.

The way out is to move to KVM / Xen or look for a hoster with normally configured memory limits, for example, like this - http://hastebin.com/doyuhesosu (here the limits are set through physpages and lockedpages, which is also far from ideal from the point of view of the guest OS, but at least it gives an honest gigabyte of memory (after which, however, there will still be cannot fork).

G
garreth, 2013-11-15
@garreth

Do you have a 32-bit or 64-bit system? If 32, then it may be Low memory starvation.

V
Vlad Zhivotnev, 2013-11-16
@inkvizitor68sl

I’ll write better as a separate answer, because in the discussion it turned out there in a dead format:
In /etc/fstab:

# for chroot 
proc /chroot/proc proc rw,relatime 0 0 
sysfs /chroot/sys sysfs rw,relatime 0 0 
udev /chroot/dev devtmpfs rw,relatime,size=10240k,nr_inodes=4112034,mode=755 0 0 
devpts /chroot/dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0

Well, then chroot / chroot and run the necessary demons. True, you will have to take care of their start after reboot (at least even /etc/rc.local). Something like this. You can knock on the gabber-mail, I'll tell you more.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question