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: Resource temporarily unavailable occurring since installing #56

Closed
paulca opened this issue Aug 10, 2016 · 8 comments
Closed

fork: Resource temporarily unavailable occurring since installing #56

paulca opened this issue Aug 10, 2016 · 8 comments

Comments

@paulca
Copy link
Contributor

paulca commented Aug 10, 2016

Since installing puma-dev, apart from my development environment being better than it's ever been, I have noticed occasionally that I get:

fork: Resource temporarily unavailable when trying any operation in Terminal. I first noticed it when tabs started crashing in Chrome.

It could be something unrelated, but a quick google for that error leads to articles about launchd so it seems a bit co-incidental.

I have no idea what's causing it ... a memory leak perhaps? I'm not all that sure where to start looking. For the most part, unloading and reloading puma-dev using launchctl solves it, or just quitting all apps and restarting them.

Could be nothing, but I thought this might tip you off to something that I'm not able to suggest!

@koenpunt
Copy link
Contributor

The error has to do with the process limit set on your system. I had the same yesterday, and I think it's puma-dev in combination with Spring, which watches a lot files. Try running ps aux | grep fsevent_watch from a terminal, and see if it yields a lot of results.

@koenpunt
Copy link
Contributor

The error has to do with the process limit set on your system.

I'm not saying this is a low limit, just saying it's not a puma-dev error.

@paulca
Copy link
Contributor Author

paulca commented Aug 10, 2016

👍

@evanphx
Copy link
Member

evanphx commented Aug 10, 2016

I have no clue why rails launches billions of fsevent_watch processes and we should probably report it to rails because it's a bit silly.

@evanphx evanphx closed this as completed Aug 10, 2016
@koenpunt
Copy link
Contributor

For reference, the same happens here: resque/resque#1483

fizz added a commit to fizz/junket that referenced this issue Sep 23, 2016
fizz added a commit to fizz/junket that referenced this issue Sep 25, 2016
@beneggett
Copy link

beneggett commented Nov 2, 2016

Linking to the Rails issue that explains all this here: rails/rails#26158

A couple helpful commands if you're experiencing this:

See all the events that are running:

ps aux | grep fsevent_watch

See how many problems you got 😺

ps aux | grep fsevent_watch | wc -l

Kill your problems 💣

pkill -f fsevent_watch

See your machine's limit

ulimit -u

The real answer to solving for now is removing the listen gem and modifying your development.rb to not watch those directories.

@goalaleo
Copy link

Here's a simple fix that worked for me (running Rails 5 on OS X):

in development.rb change config.file_watcher = ActiveSupport::EventedFileUpdateChecker`` to config.file_watcher = ActiveSupport::FileUpdateChecker, and remove following gems: listenandspring-watcher-listen<- if using. From other issues it seems like the culprit might berb-fseventgem which listen` depends on.

@fuzzygroup
Copy link

Thank you, thank you, thank you! I'm developing a rails app along the lines of service oriented architecture and all the different pieces run as separate http processes. Developing under OSX has been horridly frustrating because I can't ever run all the pieces together.

ledermann added a commit to ledermann/docker-rails that referenced this issue May 8, 2017
ledermann added a commit to ledermann/docker-rails that referenced this issue May 8, 2017
ulferts added a commit to opf/openproject that referenced this issue Feb 8, 2019
Because of the tendency of rb-fsevent (used by listen on mac) to create zombie processes and because of the rather low default number of allowed processes on mac (709), using the EventedFileUpdateChecker can cause the system to become unusable which can then only be fixed by a reboot (as kill requires forking).

Please also see:

* rails/rails#26158
* puma/puma-dev#56 (comment)
* ledermann/docker-rails@148540d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants