Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Unable to allocate shared memory segment error #134
I currently see these errors in the logfile:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/gd.so' - libjpeg.so.62: failed to map segment from shared object: Cannot allocate memory in Unknown on line 0
This error repeats every couple of seconds:
Sun Sep 22 12:22:21 2013 (8554): Fatal Error Unable to allocate shared memory segment of 205520896 bytes: shmat: Cannot allocate memory (12)
I have noticed these errors first last Monday, Tuesday evening they stopped and reapeared yesterday afternoon. The weird thing is, everything seems to work. No 500 internal server errors or something, nobody complains.
I don't understand why I get these errors. My config:
Server is CentOS5.9 with PHP 5.4.19
Maybe I don't understand correctly what Zend optimizer does. I thought that it allocates the cache once at startup and later just reattaches. Why should it try to allocate that amout again? Or is the error message misleading?
According to phpinfo Zend seems to work: (I just restarted, it usually caches about 1500 files after a couple of days)
Any ideas how I could find out what happens?
What I found interesting about this one is that your info report gives
However looking at the code, this is because the
In my case if use this configuration
I have the same error. But is the same if I use APC, so I don't think is a problem of OpCache.
I also incresed memory_limit of PHP and linux shared memory limit.
but nothing.... Now I'm thinking that is a problem of OpenVZ.
php -i give the follow error:
Thu Nov 14 01:53:43 2013 (1864): Fatal Error Unable to allocate shared memory segment of 134217728 bytes: mmap: No space left on device (28)
kernel.sem=250 256000 32 1024
------ Limiti della memoria condivisa --------
------ Limiti di semaforo --------
------ Messaggi: limiti --------
@Neo1975, the issue that you have is that you are trying to allocate an OPcache SMA of 132Mb in an OpenVZ container where your max shmpages is just over 22K (= 88 Mb). VMs still have limits. You've hit one. You need to change them or live within them.
This really belongs on a support forum and not an OPcache issue, though perhaps some advisory in the OPcache docs might help others.
I had some time now to look into the matter (in case somebody wonders: Not so important application and no problems except those log file entries). In my case the problem was not related to a virtual server or something:
Please note that: opcache.enable_cli=1 was enabled
In my case, the problem was basically "fixed" by setting opcache.enable_cli=0
Could you tell me how to solve the problem?