Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Workaround Ruby 2 GC bug

It seems that Ruby 2 doesn't like it if the watcher.to_io ever gets
GC'd. It segfaults, see e.g.
https://travis-ci.org/jonleighton/spring/jobs/5174559.

I will try to produce a proper trace and report the bug, but in the mean
time this workaround seems to do the trick.
  • Loading branch information...
commit c8a7afdd3238ef88bffc2c8f56baa21042400e15 1 parent ecb9f6e
@jonleighton jonleighton authored
Showing with 5 additions and 4 deletions.
  1. +5 −1 lib/spring/application.rb
  2. +0 −3  test/acceptance/app_test.rb
View
6 lib/spring/application.rb
@@ -12,6 +12,10 @@ def initialize(manager, watcher = Spring.watcher)
@manager = manager
@watcher = watcher
@setup = Set.new
+
+ # Workaround for GC bug in Ruby 2 which causes segfaults if watcher.to_io
+ # instances get dereffed.
+ @fds = [manager, watcher.to_io]
end
def start
@@ -37,7 +41,7 @@ def run
watcher.start
loop do
- IO.select([manager, watcher])
+ IO.select(@fds)
if watcher.stale?
exit
View
3  test/acceptance/app_test.rb
@@ -220,9 +220,6 @@ def self.omg
end
test "app gets reloaded when preloaded files change (listen watcher)" do
- # listen with ruby 2.0.0-rc1 crashes on travis, revisit when they install 2.0.0-p0
- skip if RUBY_VERSION == "2.0.0" && RUBY_PATCHLEVEL == -1
-
begin
gemfile = app_root.join("Gemfile")
gemfile_contents = gemfile.read
Please sign in to comment.
Something went wrong with that request. Please try again.