Search code examples
pythondjangoapachemod-wsgipopen

Cannot allocate memory on Popen commands


I have a VPS server with Ubuntu 11.10 64bit and sometimes when I execute a subprocess.Popen command I get am getting too much this error:

OSError: [Errno 12] Cannot allocate memory

Config details: For each site I have an apache site like this: http://pastebin.com/mcew79sH And also a settings and a wsgi file (both on same folder than project) like this: http://pastebin.com/hrrV4WTM

I am passing the arguments to Popen constructor as a list and using close_fds=True, I am also using and stdin/stdout to communicate with PIPE for the ones which I need reading the response.

Finally this is the traceback I get when the error appears http://pastebin.com/FqXPHwhq

The server is serving about 25 sites with small traffic (probably 5 of them has a considerable daily use) my VPS RAM size is 1024MB all of them execute PostgreSQL databases.

All this started when we migrated the sites from a VPS running Ubuntu Server 10.10 32 Bit to 11.10 64Bit.

Any idea how to solve this?

---- EDIT ----

ps aux --> http://synsa.synsa.com/site_media/process.txt


Solution

  • Well that's easy. Sounds like it's time to upgrade your vps or scale back the memory settings of postgres/apache/etc and take the resulting performance hit.