0
votes

I am using Rails 3.2.12, RSpec-rails 2.13.0 and ThinkingSphinx 3.0.10

The problem:

When I run bundle exec rpsec spec/controllers/ads_controller_spec.rb, thinking sphinx spawns 3 searchd processes which become frozen, my tests just lockup until I manually killed the searchd processes after which the tests continue running.

The setup:

Here is my sphinx_env.rb file which in which I setup TS for testing:

require 'thinking_sphinx/test'

def sphinx_environment(*tables, &block)
  obj = self
  begin
    before(:all) do
      obj.use_transactional_fixtures = false
      ThinkingSphinx::Test.init
      ThinkingSphinx::Test.start
      sleep(0.5)
    end

    yield
  ensure
    after(:all) do
      ThinkingSphinx::Test.stop
      sleep(0.5)
      obj.use_transactional_fixtures = true
    end
  end
end

Here is my test script:

describe "GET index" do
  before(:each) do
    @web_origin   = FactoryGirl.create(:origin)
    @api_origin   = FactoryGirl.create(:api_origin)
    @first_ad     = FactoryGirl.create(:ad, :origin_id => @web_origin.id)

    ThinkingSphinx::Test.index #index ads created above
    sleep 0.5
  end

  sphinx_environment :ads do 
    it 'should return a collection of all live ads' do
      get :index, {:format => 'json'}
      response.code.should == '200'
    end 
  end
...

UPDATE

No progress made, however here are some additional details:

  • When I run my tests, thinking sphinx always starts 3 searchd processes.
  • The pid in my test.sphinx.pid always has just one of the searchd pid's, its always the second searchd process pid.
  • Here is the output from my test.searchd.log file:

    [ 568] binlog: finished replaying total 49 in 0.006 sec

    [ 568] accepting connections

    [ 568] caught SIGHUP (seamless=1, in queue=1)

    [ 568] rotating index 'ad_core': started

    [ 568] caught SIGHUP (seamless=1, in queue=2)

    [ 568] caught SIGTERM, shutting down

Any help is appreciated, I have been trying to sort out this issue for over a day & a bit lost.

Thanks.

1
Can you confirm what version of Thinking Sphinx you're using (latest is 3.0.2, not 3.0.10)? Also, what version of Sphinx and what operating system are you using?pat
Hi Pat, I am using TS 3.0.2, Mountain Lion & Sphinx 2.0.2Jason

1 Answers

1
votes

Sphinx 2.0.x releases with threaded Sphinx workers (which is what Thinking Sphinx v3 uses, hence the multiple searchd processes) are buggy on OS X, but this was fixed in Sphinx 2.0.6 (which was one of the main things holding back TS v3 development - my own tests wouldn't run due to problems like what you've been seeing).

I'd recommend upgrading Sphinx to 2.0.6 and I'm pretty sure that should resolve these issues.