Question

I've been hitting odd behaviours with thinking-sphinx indicies. The present state is that indexing is not occurring.

I am getting different behaviours with different commands. The cap deploy stalls under a rebuild sphinx command.

invoke_command "cd #{release_path} && RAILS_ENV=#{rails_env} bundle exec rake ts:rebuild"

The manual command to index

$ bundle exec rake ts:index --trace
** Invoke ts:index (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
FATAL:  sorry, too many clients already
/Users/me/app/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `initialize'

Behaviour with a manual bundle exec rake ts:rebuild is a very long stall that I eventually interrupt.

Trying to stop the engine has a different error. THere is a stall long enough to Ctrl-C and returns:

$ bundle exec rake ts:stop --trace
** Invoke ts:stop (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute ts:stop
^Crake aborted!

/Users/me/app/shared/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/rake_interface.rb:56:in `sleep'

Update wooops... I ran

bundle exec rake ts:index --trace

straight in terminal window on the server. Indexed started writing. But got two warnings at the end.

no process found by PID 82805

indices NOT rotated

Does that paint a better picture?

** Update 2 ** data

   ??  S    11:28AM   0:06.93 /usr/local/bin/searchd --pidfile --config /Users/me/app/releases/20140127084810/config/development.sphinx.conf
   ??  S    11:28AM   0:00.00 /usr/local/bin/searchd --pidfile --config /Users/me/app/releases/20140127084810/config/development.sphinx.conf
   ??  S    13Jan14   1:16.68 /usr/local/bin/searchd --pidfile --config /Users/me/rails/releases/20140113100039/config/development.sphinx.conf
 s001  R+    1:23PM   0:00.00 grep searchd

For those interested, the issues got resolved via two discussions one on settings and another on identifying the processes and acting upon them

Was it helpful?

Solution

Firstly - with Capistrano and Thinking Sphinx, it's now highly recommended that you set the generated Sphinx configuration file to live in the shared directory. This is probably why the rebuild cap task is hanging.

As for the warnings - can you confirm if the Sphinx daemon is running? ps aux | grep searchd should do the trick. If it is, it's worth checking that the pid file contains the right pid. If it's not running, then best to delete the pid file, as Sphinx/Thinking Sphinx is presuming otherwise.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top