Closed bitboxer closed 14 years ago
This is a known bug: when livereload attemps to monitor too many files (via a lame per-file watching API from EventMachine), it runs out of open file limit, throws an exception and disconnects the WebSocket.
Please try to increase ulimit -n from default 256 to something bigger:
ulimit -n 4096
livereload
I'm certainly rewriting the command-line tool to use something like fssm soon. Sorry for this issue.
With that setting it's working fine. You should update the documentation till you fix this :)
LiveReload should use fsevent branch of directory_watcher on Mac OS X. It can handle much more files without blowing up CPU.
Updated: oops, I didn't notice, fssm also supports native FSEvents.
I'm on OS X myself, so yeah, I'm definitely going to use something with FSEvents.
…But thanks for the pointer to the branch, I may well prefer that to fssm.
FYI, the ulimit-thing worked for me as well. Awesome gem!
Quick q: does anyone here know a non-polling Ruby gem that supports directory watching on Windows?
I tried on a pretty old and bloated project. Unfortunately the fix didn't work for me. Is there an error log or something?
Tried again on a small project running phusion passenger 2.2.5 and Rails 2.3.5 locally (MacBook with snow leopard): Didn't work with or without the fix. I'd love to use livereload. Maybe you can build in a little debug option so i can give you a hand fixing it.
@christoph-buente Upcoming version 1.3 will have an option for debug output.
@christoph-buente A little debug option: -D
. Please paste the console output here.
$ livereload -D
Version: 1.3 (compatible with browser extension versions 1.3.x) Port: 10083 Watching: /Users/christoph/Projects/betterplace
watch_filename': Too many open files - failed to open file /Users/christoph/Projects/betterplace/vendor/rails/railties/guides/images/has_many.png for registering with kqueue: Too many open files (Errno::EMFILE) from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:1266:in
watch_file'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/directory_watcher-1.3.2/lib/directory_watcher/em_scanner.rb:187:in _watch_file' from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/directory_watcher-1.3.2/lib/directory_watcher/em_scanner.rb:69:in
start'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/directory_watcher-1.3.2/lib/directory_watcher/em_scanner.rb:67:in each' from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/directory_watcher-1.3.2/lib/directory_watcher/em_scanner.rb:67:in
start'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/directory_watcher-1.3.2/lib/directory_watcher.rb:497:in start' from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/livereload-1.3/lib/livereload.rb:185:in
restart_watching'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/livereload-1.3/lib/livereload.rb:237:in run' from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/livereload-1.3/lib/livereload.rb:237:in
each'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/livereload-1.3/lib/livereload.rb:237:in run' from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in
call'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in run_machine' from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in
run'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/livereload-1.3/lib/livereload.rb:209:in run' from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/livereload-1.3/bin/livereload:51 from /opt/ruby-enterprise/bin/livereload:19:in
load'
from /opt/ruby-enterprise/bin/livereload:19@christoph-buente Does the ulimit
workaround work for you?
For me too, the ulimit -n 4096
works. I'm on Mac OS X SnowLeo 10.6.4
Nope, still the same error on a different file :)
The project I'm trying to use with livereload has about 11000 files. I tried to exclude the directories vendor, script, tmp, doc, lib, config, features, spec but it's still too many files. But maybe it is a good idea to exclude these directories by default, or at least prepare a commented line in the .livereload file. Makes it easier for other rails users.
Nice idea about excluding Rails vendor/tmp/test stuff by default. (Config, I guess, should stay included? And doc — is there any html/js there? Do you generate it via rdoc?)
config is just read once at startup time, except config/locales. And docs are mostly generated with a rake task. There is html in it. But how often does that change? Just when creating documentation and checking it. But a rake task has to be fired anyways.
@christoph-buente Are you sure routes.rb
is not reloaded when changed? It's been a long while since I've developed anything in Rails, but I have an impression that it does.
Yeah, you're right. There is possibly more that gets reloaded, depending on the project setup. But config/initializeres doesn't. But people would be adjusting it to their needs anyway. Just put a commented line in the .livereload config file. Developers should know what gets reloaded in development environment.
Version 1.4 released should fix ulimit problems for good. Please update and test.
Yes, working great. Awesome!
Thx for the progress, good work! Install was fine, but there seems to be the ruby-cocoa binding missing. I use a custom installation of ruby-enterprise. Is there a way install the binding afterwards? I tried to install it with ports. But then ports tries to install ruby and the whole stack.
Version: 1.4 (compatible with browser extension versions 1.4.x) Port: 35729 Watching: /Users/christoph/Projects/betterplace
LiveReload is waiting for browser to connect.
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require': no such file to load -- osx/foundation (LoadError) from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher/platform/mac/rubycocoa_watcher.rb:2
I was getting the same thing, so I rm'd /Librarary/Frameworks/RubyCocoa.framework and went to http://rubycocoa.sourceforge.net/GettingStarted, got the source .tgz and ran the source install instructions on that page and all is right with the world. The .dmg binary release doesn't seem to install all the goodies that livereload needs to run properly.
Thx for the quick reply. It worked fine, after reinstallation of ruby enterprise with the shared library flag. See here: http://www.rubyenterpriseedition.com/documentation.html#_rubycocoa_compatibility_and_tt_enable_shared_tt
Thx for the awesome piece of software. It makes the live of a webdeveloper so much easier!
I tried reinstalling rubycocoa from the tgz and it still is giving me the error message about 'osx/foundation'
I can't connect with the livereload server. This message occurs:
My Setup: Google Chrome 6.0.458.1 dev, Phusion Passenger (using Passenger Pane) under Mac Os X.
If you need more informations, I would love to help.