Friday, September 30, 2011

fork: resource temporarily unavailable ???

January 21, 2010 by  
Filed under cPanel, General

Leave a Comment

If you are getting Linux error message, Resource temporarily unavailable, it’s because your system is limiting the number of files / processes / CPU that your particular user ID can use.

If you use WHM/Cpanel, enabling the “Shell fork bomb protection” can make the “Resource temporarily unavailable” message appear more often. You may get rid of this message by disabling Shell Fork Bomb Protection.  However, that is a major security issue. Enabling it is a good thing. After all, do you want any jackass user to be able to write a perl script containing the line “while (fork());” and bring your system to its knees?

Instead, consider raising the limits for individual trusted users using ulimit. (You will need root access to do this.)

Make the following changes in the system shell init files.

These files:
/etc/profile
/etc/bashrc
/etc/profile.d/limits.sh

if [ "$LIMITUSER" = "root" ]; then
ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
elif [ "$LIMITUSER" = "YOUR USER NAME" ]; then
ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
else
ulimit -n 100 -u 20 -m 200000 -d 200000 -s 8192 -c 200000 -v 200000 2>/dev/null
fi


Alternate Solution

To fix this, first you have to turn off cPanel’s built in ‘Prevent Shell Fork Bomb Protection’. Then, edit the /etc/security/limits.conf.  Increase the limit by by putting/changing the following line:

*             soft     nproc     20
someone        soft     nproc     40
root          soft     nproc     unlimited

It will limit to 20 processes for all users except someone and root. User someone and root will enjoy maximum of 40 and unlimited simulteneous processes.

The key is turning off cPanel’s internal protection so your box will use this file.

GD Star Rating
a WordPress rating system
fork: resource temporarily unavailable ??? , 10.0 out of 10 based on 1 rating
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Related posts:

  1. How do I find out Linux Resource utilization to detect system bottlenecks?
  2. License File Expired : Solution
  3. Secure and Optimize your Virtual Private Server (VPS)
  4. Clean/Flushing Exim mail queue
  5. How to install Webmin on CentOS, RHEL, Fedora, Mandriva, SuSE

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!
Click here to cancel reply.