Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > sh: fork: Resource temporarily unavailable

sh: fork: Resource temporarily unavailable
Thread Tools
Dedicated MacNNer
Join Date: Oct 1999
Location: Raleigh, NC, USA
Status: Offline
Reply With Quote
Apr 2, 2007, 09:47 AM
 
Received disconnect from XX.XX.XX.XX: fork failed: Resource temporarily unavailable

macmini:~ tadd$ man users
sh: fork: Resource temporarily unavailable
Error executing formatting or display command.
System command (cd /usr/share/man && /usr/bin/tbl /usr/share/man/man1/users.1 | /usr/bin/groff -Wall -mtty-char -Tascii -mandoc -c | /usr/bin/less -is) exited with status 32768.
No manual entry for users
macmini:~ tadd$


I get fork failures on my mac mini. There seems to be a limit of how many threads I can run. I'm using SSH and SCREEN to log into my Mac Mini 10.4.9 (but also 10.4.8 before). I'm using the mini to run BZFLAG servers which launch from the command line and output logging information to standard out. I'm using SCREEN to shell to a new prompt, then capture the output using SCREEN's screenlog feature.

I have 11 shells running in screen to run the bzfs servers, and another 11 shells running bzadmin which is a text user interface item, on one of the log-ins. Other log ins are doing the same thing and there are perhaps 20 bzfs servers running total.

I end up with about 50 bash copies running according to ps -aux.

uptime shows: 10:35 up 23:42, 5 users, load averages: 0.70 0.77 0.69
System Memory in Activity Monitor shows 795MB used and 228MB free (1gig installed).

Is there any limit to the number of forks? Or shell sessions? per user? If so, can I change that limit? This is all my Mac Mini is doing but I'd like to do a lot more of them.

Perhaps there is a way to launch these command line applications while capturing stdout, without using so many threads?

Thanks for any help.
Tadd
     
Senior User
Join Date: Mar 2007
Location: San Jose
Status: Offline
Reply With Quote
Apr 2, 2007, 03:47 PM
 
Play around with sysctl a bit. Something like 'sysctl -w kern.maxproc=1000' should work. The man pages have a fair bit to say on the topic.
     
tadd  (op)
Dedicated MacNNer
Join Date: Oct 1999
Location: Raleigh, NC, USA
Status: Offline
Reply With Quote
Apr 3, 2007, 09:33 PM
 
Thanks mfbernstein. I got a confirm from somebody on #bzflag (freenode IRC) but that I also ahd to do a local change in my user bash-profile. So.. this is what I did:

sudo sysctl -w kern.maxprocperuid=256
cd ~
cat >> .bash_profile
ulimit -u 256
^D

the reboot.

The first command allows the computer to have 256 processes per user and the ulimit allows THAT user to have 256 processes.

I did this but haven't rebooted yet. Will try shortly.
(Last edited by tadd; Apr 3, 2007 at 09:35 PM. (Reason:more info))
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:40 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2