bash: fork: Not enough space

By Alasdair Lumsden on 12 Oct 2010

Quite a lot of our clients email asking if they have run out of disk space when they get this error:

bash: fork: Not enough space

Not so – the “space” referred to here means memory (RAM). So in basic terms, it means your server has run out of free memory and can’t start new programs.

Resolving this requires stopping running services or restarting your server. Unfortunately, given you have no free memory to launch new programs, doing this might be quite hard. But thankfully if you get this error in a Solaris Zone with capped memory usage, you can fix the issue from the Global Zone. (If you’re an EveryCity managed hosting customer, we can do this for you).

How do you stop it from happening? Well you need to identify what is gobbling all your memory. If it’s an Apache web server, chances are you just received an influx of visitors, as Apache (by default) has to spawn a new process for each connection, and each process uses RAM. The fix is to buy more memory, or optimise Apache (to use less RAM per process), or optimise your site so that requests take less time (so fewer Apache processes are needed to handle the same throughput).