Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fork failed: resource temporarily unavailable #1898

Closed
itismadhan opened this issue Jun 18, 2013 · 10 comments · Fixed by #2827
Closed

fork failed: resource temporarily unavailable #1898

itismadhan opened this issue Jun 18, 2013 · 10 comments · Fixed by #2827

Comments

@itismadhan
Copy link

Hey guys all of a sudden I am getting the following
/etc/zshenv:3: fork failed: resource temporarily unavailable
/Users/XXX/.oh-my-zsh/tools/check_for_upgrade.sh:31: fork failed: resource temporarily unavailable
git_compare_version:4: fork failed: resource temporarily unavailable
getent:4: fork failed: resource temporarily unavailable
__rvm_has_opt:3: fork failed: resource temporarily unavailable
[5] 14246 done
git_prompt_info:1: fork failed: resource temporarily unavailable

@bausa
Copy link

bausa commented Jul 14, 2013

I am also experiencing this issue. Sometimes it goes away but then comes back

@bom-d-van
Copy link

Please anyone tell me how to solve this terrible problem... :-(

@rogatec
Copy link

rogatec commented Dec 10, 2013

If this problem is still exists for some of you, maybe my solution will help you.

In your "oh-my-zsh.sh" file, originally in the directory ~./.oh-my-zsh on the first lines you will find the following code:

# Check for updates on initial load...
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
   /usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh $ZSH/tools/check_for_upgrade.sh
fi

# Initializes Oh My Zsh

# add a function path
fpath=($ZSH/functions $ZSH/completions $fpath)
...

I just uncommented the if condition to check the updates so it should look like this:

# Check for updates on initial load...
# if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
#   /usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh # $ZSH/tools/check_for_upgrade.sh
# fi

# Initializes Oh My Zsh

# add a function path
fpath=($ZSH/functions $ZSH/completions $fpath)
...

You can manually check for updates if you execute the following command in your Terminal/iTerm:

/usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh

@mcornella
Copy link
Member

Duplicate of #1509. This is a difficult issue to debug; it basically means that you've reached the maximum number of processes you can run at the same time. This means that the real cause of the problem can be anything and as such it will be very difficult to figure it out.

If you can execute ulimit -u to see if the max user processes value is too low. You can raise it by running the same command with a bigger value: ulimit -u BIGGER_VALUE. In my machine I'm running Ubuntu 13.10 x86 and it shows a value of 31308.
Also, try looking for duplicate processes when this happens. This is somewhat difficult because if you can't fork you can't run anymore commands to figure it out, so refer to this post to look for any ideas for that.

The last thing I can recommend is to try to describe your environment as detailed as possible to look for any pattern as to why it is happening: OS, zsh plugins, theme, etc.

@mcornella
Copy link
Member

@razrunelord, @samuelb2, @bom-d-van check your .profile file for source statements or similar stuff, as described in #1509. If that doesn't solve it, please close this issue and continue the discussion in the other one.

@rogatec
Copy link

rogatec commented May 6, 2014

Hey Marc!
I read the topic of #1509 and you are right.

I had a symlink on .profile to the .zshrc - this occured the error.

Thanks for investigating!

@khalidchawtany
Copy link

Hi all,
Whenever I executed find * -exec "unzip stuff" the terminal hanged spitting out a lot of different error messages including this fork failed thing. I tried to manually disable (comment out) portions of my _dotfiles_ to find the cause of the problem (at least for me). I had a function named _fd()_ after I renamed it to something else (_fdir()_) the issue disappeared.

@jasonleonhard
Copy link

jasonleonhard commented Jul 3, 2017

To view all limits

ulimit -a

or

ulimit -H -u

Notice the -u processes limit. To set to a higher number:

ulimit -S -u 1064

This will only last until a new terminal window is open so put it in your .bash_profile or equivalent

Then run the previous command to verify

Hope this helps.

@WangZhenhuaFirst
Copy link

ps aux | grep "what you want to execute"
kill -9 pid

I think it's because there are already the same processes running.

@nutandevjoshi
Copy link

Just close Zsh and open again

@ohmyzsh ohmyzsh locked as resolved and limited conversation to collaborators May 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
9 participants