0
votes

Trying to resurrect an old project by upgrading gems. Ran into an issue where RSpec hangs on startup with the '--drb' option.

By itself, 'rspec spec' works fine. But start 'spork' in another terminal and then 'rspec --drb spec' spins up CPU to ~40% and just sits.

Using Rails 3.2.13, Ruby 1.9.3-p392, RSpec 2.13.1 and spork-rails 3.2.1, which depends on Spork 1.0.0rc3.

Gemfile

source 'http://rubygems.org'

gem 'rails', '~> 3.2.13'

gem 'devise', '~> 2.2.0'
gem 'event-calendar', :require => 'event_calendar'
gem 'has_scope'
gem 'high_voltage'
gem 'inherited_resources'
gem 'jquery-rails'
gem 'kaminari'
gem 'ransack'
gem 'simple_form'
gem 'validates_timeliness'

# deployment process management
gem 'foreman'
gem 'thin'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails', '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '< 2.0'
  gem 'bootstrap-sass', '~> 2.3.1'
end

group :production do
  gem 'pg'
end

group :development, :test do
  gem 'factory_girl_rails', '~> 4.2.0'
  gem 'rspec-rails', '~> 2.13.1'
  gem 'spork-rails'
  gem 'sqlite3'
end

group :test do
  gem 'capybara'
  gem 'growl'
  gem 'launchy'
  gem 'ruby-prof'
  gem 'test-unit'
end

spec/spec_helper.rb

require 'rubygems'
require 'spork'
#uncomment the following line to use spork with the debugger
#require 'spork/ext/ruby-debug'

Spork.prefork do

  # Prevent Devise from loading the User model super early with it's routes
  # see: https://github.com/sporkrb/spork/wiki/Spork.trap_method-Jujitsu
  require "rails/application"
  Spork.trap_method(Rails::Application::RoutesReloader, :reload!)

  # This file is copied to spec/ when you run 'rails generate rspec:install'
  ENV["RAILS_ENV"] ||= 'test'

  require File.expand_path("../../config/environment", __FILE__)
  require 'rspec/rails'
  require 'rspec/autorun'

  # Since I have included Test::Unit for perfomance tests, disable auto-run
  Test::Unit::AutoRunner.need_auto_run = false if defined?(Test::Unit::AutoRunner)

  # Requires supporting ruby files with custom matchers and macros, etc,
  # in spec/support/ and its subdirectories.
  Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }

  RSpec.configure do |config|
    # ## Mock Framework
    #
    # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
    #
    # config.mock_with :mocha
    # config.mock_with :flexmock
    # config.mock_with :rr

    # If you're not using ActiveRecord, or you'd prefer not to run each of your
    # examples within a transaction, remove the following line or assign false
    # instead of true.
    config.use_transactional_fixtures = true

    # If true, the base class of anonymous controllers will be inferred
    # automatically. This will be the default behavior in future versions of
    # rspec-rails.
    config.infer_base_class_for_anonymous_controllers = false

    # Run specs in random order to surface order dependencies. If you find an
    # order dependency and want to debug it, you can fix the order by providing
    # the seed, which is printed after each run.
    #     --seed 1234
    config.order = "random"
  end

end

Spork.each_run do
  # This code will be run each time you run your specs.

end

I'm not getting any error messages or feedback on the console, so I don't even know where to start looking for problems. Any suggestions?

1
Uh, this problem has gone away. I can't find any suitable explanation for the change. Am I crazy?Jarrod Carlson
Uh, this problem has come back, but I've also discovered that I can only reproduce this on one of my two machines.Jarrod Carlson
One machine has RVM for managing Rubies, the other uses rbenv... I'm going to try nuking my rubies altogether and rebuild... see if that does anything.Jarrod Carlson
Completely nuked rbenv, all rubies and all gemsets; reinstalled; still hanging on the machine with rbenv. Is there anything I can do to get some more debug information?Jarrod Carlson
@dimitko, I'm certain 3.2.13 contains more than Ruby 2.0.0 support; see release notes: weblog.rubyonrails.org/2013/3/18/…Jarrod Carlson

1 Answers

1
votes

Upgrading ruby-build via brew update ruby-build picked up a new version dated 2013-05-01. After the update, I trashed and reinstalled all my Rubies, and the problem seems to have resolved itself.

I don't know what specifically addressed the issue, but here are some notes and a relevant commit: https://github.com/sstephenson/ruby-build/commit/9f8d53365aef52c940095f583cdc82f02caba90f