-
Notifications
You must be signed in to change notification settings - Fork 21.9k
Description
Steps to reproduce
- Create a new rails app
- Run it on a Mac with a bad processor
Expected behavior
My laptop should work fine - processes should stay under the 700-something limit that Apple set.
Actual behavior
When running my Rails app on a Macbook Air with 1.8 ghz of cpu (I know... getting a new computer when they release the new Pro's), I have been getting a "System ran out of resources, can't fork any processes" error in all of my applications (or, they just quietly failed). Finally, I opened Activity Monitor and was able to find more then 500 fsevent_watch
processes running (my computer has a maximum of 700 processes total). Doing a Google Search, I stumbled upon the [rb-fsevent gem]. Looking at my Gemfile.lock
, I was able to track it down to the listen gem.
I'm unable to tell if it is an issue with the listen gem itself, or @fnx's implementation in Rails (see #22254), but it seems like it's more likely the implementation is broken.
Suggested Fix
I'm unable to tell if it is an issue with the listen gem itself, or @fnx's implementation in Rails (see #22254), but it seems like it's more likely the implementation is broken.
I would make sure that the listen gem is opt-in, especially on systems with low process limits (IIRC, there's a command that allows you to check this).
Temporary Workaround
If your computer is currently showing a "System ran out of resources, can't fork any processes" error, reboot it (logging in and out might work, but I haven't tested that). You probably won't be able to save most of your work (if your software forks a process in order to save).
To remove the gem for a more permanent fix
- Remove the listen and spring-watcher-listen gems.
- In your environments/development.rb file, comment out this line:
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
System configuration
Rails version:
Rails 5.0.0
Ruby version:
ruby 2.3.0p0