PDA

View Full Version : fork: Resource temporarily unavailable




Tex-Twil
Jul 20, 2012, 03:39 AM
Hi,
quite often after some hours of work (XCode, git), I cannot execute any commands from bash and I got this error:


fork: Resource temporarily unavailable


I have 8GB ram (60-70% used) on a MBP 2011.

What is going on?



appletechpro
Jul 20, 2012, 11:51 AM
Hi,
quite often after some hours of work (XCode, git), I cannot execute any commands from bash and I got this error:


fork: Resource temporarily unavailable


I have 8GB ram (60-70% used) on a MBP 2011.

What is going on?

It's possible the kernel is reaching some sort of sysctl limit.

My suggestion would be to dump the full process list at the time of occurrence, examine the processes one by one to see if you can find any information and examine the sysctl values on your machine.

Tex-Twil
Jul 20, 2012, 11:56 AM
It's possible the kernel is reaching some sort of sysctl limit.

My suggestion would be to dump the full process list at the time of occurrence, examine the processes one by one to see if you can find any information and examine the sysctl values on your machine.
ok I'll try that when it happens again

Tex-Twil
Jul 21, 2012, 01:34 AM
It has happened again but the problem is that I cannot open new applications to do what you suggested.

This time it happened on my other MBP (also 8GB). It occurs when I am building several times this library http://libmailcore.com/

Btw, what do you mean by "examine the sysctl values"

cheers

appletechpro
Jul 21, 2012, 05:03 AM
Before the issue occurs, enter the following commands in Terminal:

sudo sysctl -a|grep maxprocperuid

^ That will return the process limit for your user.

sudo sysctl -w kern.maxprocperuid=800

^ That will increase your user process limit to 800, for instance.

Tex-Twil
Jul 21, 2012, 10:17 AM
Before the issue occurs, enter the following commands in Terminal:

sudo sysctl -a|grep maxprocperuid

^ That will return the process limit for your user.

sudo sysctl -w kern.maxprocperuid=800

^ That will increase your user process limit to 800, for instance.

currently it is

sudo sysctl -a|grep maxprocperuid
Password:
kern.maxprocperuid = 709
kern.maxprocperuid: 709

I set it to 800. Let's see if that help.

Tex-Twil
Jul 25, 2012, 03:24 AM
It's still happening (mostly after working with git projects) :(

appletechpro
Jul 25, 2012, 09:36 AM
I am confident that is the problem. Try increasing the value further.

http://blog.ghostinthemachines.com/2010/01/19/mac-os-x-fork-resource-temporarily-unavailable/

Tex-Twil
Jul 25, 2012, 10:58 AM
I am confident that is the problem. Try increasing the value further.

http://blog.ghostinthemachines.com/2010/01/19/mac-os-x-fork-resource-temporarily-unavailable/

My current values are of maxproc and maxprocperuid are:


$ sysctl -a | grep maxproc | grep =
kern.maxproc = 1064
kern.maxprocperuid = 709
$ ulimit
unlimited


this is even bigger that what the tutorial suggests.

appletechpro
Jul 25, 2012, 11:27 AM
My current values are of maxproc and maxprocperuid are:



this is even bigger that what the tutorial suggests.

What the tutorial suggests will vary upon the workload.

Just because a certain process limit worked for that user doesn't mean the same process limit would work for your environment.

Thus, I might suggest upgrading the value to something extremely large (such as 3,000) so that you can rule out process limits as the culprit.

Tex-Twil
Jul 25, 2012, 01:01 PM
ok, I will try that