Today I was unable to start apache on one of the VPS servers. Here is the error_log output.
[Thu Aug 28 16:45:02 2008] [warn] pid file /var/run/apache2.pid overwritten — Unclean shutdown of previous Apache run?
[Thu Aug 28 16:45:02 2008] [notice] Apache/2.2.3 (Debian) configured — resuming normal operations
[Thu Aug 28 16:45:02 2008] [alert] (12)Cannot allocate memory: apr_thread_create: unable to create worker thread
[Thu Aug 28 16:45:02 2008] [alert] (12)Cannot allocate memory: apr_thread_create: unable to create worker thread
[Thu Aug 28 16:45:04 2008] [alert] No active workers found… Apache is exiting!
As a sysadmin first you should check the user_beancounters information on the hardware node get more inputs about the resource usage of the VPS to understand what might be causing the memory issue. This is how you can find the user_beancounters
cat /proc/user_beancounters
Normally you will find the failure counts for privvmpages.
privvmpages 4052 49146 49152 53575 20
In the above line last column shows the number of times VPS crossed the limit set for privvmpages.
You can change this value if you have the access to hardware node as follows:
vzctl set –privvmpages 100000 –save
VEID is the VPS number allocated on hardware node.
vzlist | grep
will get you that number.
Now, take a scenario where in you have no access to VPS hardware node and you stilll want this issue to be fixed from your end.
Here is the fix:
You can force Apache to use far less memory than what ever it is using now by installing apache2-mpm-prefork instead of apache2-mpm-worker.
All that I did on the console of my Debian server to get this fix this issue is running the following command:
#aptitude install apache2-mpm-prefork
I restarted apache and it started working just fine.