While I am connecting to my server I get,
And I try following commands also, then the result is same.
Why this comming ? And how can I resolve it ?


3 Answers 3
This could be due to some resource limit, either on the server itself (or) specific to your user account. Limits in your shell could be checked via ulimit -a . Esp check for ulimit -u max user processes, if you have reached max processes, fork is unable to create any new and failing with that error. This could also be due to swap/memory resource issue
fork: Resource temporarily unavailable
The error means that the current shell resource is limited (check the limits by ulimit -a ). So you can either try in another shell, or increase the resources by using ulimit command which controls over the resources available to the shell and processes it creates on operating system.
To increase the limits, try running:
to raise the soft limits to hard one, or:
to set the maximum size a process to unlimited and the maximum number of open file to 10240.
I am trying to run a shell script which will create process using a shell script. I get Resource temporarily unavailable error. how to identify which limit (memory/process/filecount) is creating this problem. Below is my ulimit -a results.
1 Answer 1
For the case in the comments, where you were not using much memory per thread, you were hitting the cgroup limits. You will find the default to be around 12288, but the value is writable:
And if I use my «what is the thread limit» program (found here) to check, before:
Of course, the numbers above are not exact because the «doug» user has a few other threads running, such as my SSH sessions to my sever. Check with:
Now, if you have enough memory, the next limit will be defined by the default maximum PID number, which is 32768, but is also writable. Obvioulsy in order to have more than 32768 simultaneous processes or tasks or threads their PID will have to be allowed to be higher:
Note that is quite on purpose that a number bigger than 2**16 was chosen, to see if it was actually allowed. And so now, set the cgroup max to, say 70000:
And at this point, realize that the above listed program seems to have a limit of about 32768 threads, even if resources are still available, and so use another method. My test server with 16 gigabytes of memory seems to exhaust some other resource at about 62344 tasks, even though there does seem to still be memory available.
Seems I finally hit my default ulimit settings for both user processes and number of timers (signals):
If I raise those limits, I am able to go to 69000 threads, which is all I asked for and as far as I’m going to take this answer:
At some point you will get into trouble, but it is absolutely amazing how gracefully the system bogs down. I tried 118000 threads and the system totally bogged down and I had many of these errors:
And my load average ballooned to
29000. But I just left the computer for an hour and it sorted itself out. I staggered the spin out of the threads by 200 microseconds per spin out, and then was able to run 118000 threads just fine (admittedly at very little resource use per thread).
I tried installing Intel MPI Benchmark on my computer and I got this error:
Then I received this error again when I ran ls and top command.
What is causing this error?
Configuration of my machine:

closed as off topic by Emil Vikström, John Conde, Ed Heal, iwasrobbed, deefour Dec 21 ’12 at 4:20
Questions on Stack Overflow are expected to relate to programming within the scope defined by the community. Cons >If this question can be reworded to fit the rules in the help center, please edit the question.
2 Answers 2
This is commonly caused by running out of file descriptors.
There is the systems total file descriptor limit, what do you get from the command:
This returns counts of file descriptors:
To find out what a users file descriptor limit is run the commands:
To find out how many file descriptors are in use by a user run the command: