This was our workaround for "index not preread": https://gist.github.com/1818244

We populate early and retry on exception, as suggested by Pat in
another thread (that Google Groups would not let me reply to). Simple
fix but trickier to write a spec for.

On Jan 12, 9:53 am, "Pat Allan" <[email protected]> wrote:
> Hi Aaron
>
> Not really sure what's causing this - is this a high traffic site? I've 
> certainly seen others get these connection problems, but never in sites I 
> manage, nor others that I've helped with that are reasonably high traffic.
>
> The first two errors, I'd guess, are similar - but the third must have been 
> timed with indexing - whether by deltas or otherwise.
>
> It might be worth searching through the Sphinx forum, see if others have hit 
> connection issues with the daemon, and found out how they worked around it? 
> If I had more time right now, I'd jump in and look there myself.
>
> Also worth noting: is it the same query causing the problem? Or different 
> ones, in different parts of your site?
>
> --
> Pat
>
> On 11/01/2012, at 1:13 AM, Aaron Gibralter wrote:
>
>
>
>
>
>
>
> > I've been seeing a lot of searchd/ThinkingSphinx/Riddle related errors come 
> > through in our Airbrake exception notification system and I'm just 
> > wondering if there's some sort of connection between the different errors 
> > and whether there is some sort of optimal way to deal with them:
>
> > Riddle::ResponseError: No response from searchd (status: , version: )
> > [GEM_ROOT]/gems/riddle-1.5.1/lib/riddle/client.rb:653:in `request'
> > [GEM_ROOT]/gems/riddle-1.5.1/lib/riddle/client.rb:226:in `run'
> > [GEM_ROOT]/gems/riddle-1.5.1/lib/riddle/client.rb:338:in `query'
> > [GEM_ROOT]/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/search.rb:422:in 
> > `block (2 levels) in populate'
> > [GEM_ROOT]/gems/activesupport-3.1.3/lib/active_support/notifications.rb:53: 
> > in `block in instrument'
> > [GEM_ROOT]/gems/activesupport-3.1.3/lib/active_support/notifications/instru 
> > menter.rb:21:in `instrument'
> > [GEM_ROOT]/gems/activesupport-3.1.3/lib/active_support/notifications.rb:53: 
> > in `instrument'
> > [GEM_ROOT]/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/search.rb:526:in 
> > `log'
> > [GEM_ROOT]/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/search.rb:535:in 
> > `log'
> > [GEM_ROOT]/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/search.rb:421:in 
> > `block in populate'
> > [GEM_ROOT]/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/search.rb:576:in 
> > `call'
> > [GEM_ROOT]/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/search.rb:576:in 
> > `retry_on_stale_index'
> > [GEM_ROOT]/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/search.rb:419:in 
> > `populate'
> > [GEM_ROOT]/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/search.rb:182:in 
> > `method_missing'
>
> > Errno::ECONNRESET: Connection reset by peer - recvfrom(2)
> > [GEM_ROOT]/gems/riddle-1.5.1/lib/riddle/0.9.9/client.rb:14:in `recv'
> > [GEM_ROOT]/gems/riddle-1.5.1/lib/riddle/0.9.9/client.rb:14:in 
> > `initialise_connection'
> > [GEM_ROOT]/gems/riddle-1.5.1/lib/riddle/client.rb:499:in `open_socket'
> > [GEM_ROOT]/gems/riddle-1.5.1/lib/riddle/client.rb:536:in `connect'
> > [GEM_ROOT]/gems/riddle-1.5.1/lib/riddle/client.rb:623:in `request'
> > [GEM_ROOT]/gems/riddle-1.5.1/lib/riddle/client.rb:423:in `update'
> > [GEM_ROOT]/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/active_record/at 
> > tribute_updates.rb:44:in `update_index'
> > [GEM_ROOT]/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/active_record/at 
> > tribute_updates.rb:23:in `block in update_attribute_values'
> > [GEM_ROOT]/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/active_record/at 
> > tribute_updates.rb:16:in `each'
> > [GEM_ROOT]/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/active_record/at 
> > tribute_updates.rb:16:in `update_attribute_values'
> > [GEM_ROOT]/gems/activesupport-3.1.3/lib/active_support/callbacks.rb:476:in 
> > `_run_save_callbacks'
> > [GEM_ROOT]/gems/activesupport-3.1.3/lib/active_support/callbacks.rb:81:in 
> > `run_callbacks'
> > [GEM_ROOT]/gems/activerecord-3.1.3/lib/active_record/callbacks.rb:264:in 
> > `create_or_update'
> > [GEM_ROOT]/gems/activerecord-3.1.3/lib/active_record/persistence.rb:57:in 
> > `save!'
> > [GEM_ROOT]/gems/activerecord-3.1.3/lib/active_record/validations.rb:56:in 
> > `save!'
> > [GEM_ROOT]/gems/activerecord-3.1.3/lib/active_record/attribute_methods/dirt 
> > y.rb:33:in `save!'
> > [GEM_ROOT]/gems/activerecord-3.1.3/lib/active_record/transactions.rb:246:in 
> > `block in save!'
> > [GEM_ROOT]/gems/activerecord-3.1.3/lib/active_record/transactions.rb:295:in 
> > `block in with_transaction_returning_status'
> > [GEM_ROOT]/gems/activerecord-3.1.3/lib/active_record/connection_adapters/ab 
> > stract/database_statements.rb:192:in `transaction'
> > [GEM_ROOT]/gems/activerecord-3.1.3/lib/active_record/transactions.rb:208:in 
> > `transaction'
> > [GEM_ROOT]/gems/newrelic_rpm-3.3.1/lib/new_relic/agent/method_tracer.rb:491 
> > :in `block in transaction_with_trace_ActiveRecord_self_name_transaction'
> > [GEM_ROOT]/gems/newrelic_rpm-3.3.1/lib/new_relic/agent/method_tracer.rb:242 
> > :in `trace_execution_scoped'
> > [GEM_ROOT]/gems/newrelic_rpm-3.3.1/lib/new_relic/agent/method_tracer.rb:486 
> > :in `transaction_with_trace_ActiveRecord_self_name_transaction'
> > [GEM_ROOT]/gems/activerecord-3.1.3/lib/active_record/transactions.rb:293:in 
> > `with_transaction_returning_status'
> > [GEM_ROOT]/gems/activerecord-3.1.3/lib/active_record/transactions.rb:246:in 
> > `save!'
> > app/models/response.rb:124:in `block (2 levels) in create_with_attributes!'
> > [GEM_ROOT]/gems/activerecord-3.1.3/lib/active_record/connection_adapters/ab 
> > stract/database_statements.rb:192:in `transaction'
> > [GEM_ROOT]/gems/activerecord-3.1.3/lib/active_record/transactions.rb:208:in 
> > `transaction'
> > [GEM_ROOT]/gems/newrelic_rpm-3.3.1/lib/new_relic/agent/method_tracer.rb:491 
> > :in `block in transaction_with_trace_ActiveRecord_self_name_transaction'
> > [GEM_ROOT]/gems/newrelic_rpm-3.3.1/lib/new_relic/agent/method_tracer.rb:242 
> > :in `trace_execution_scoped'
> > [GEM_ROOT]/gems/newrelic_rpm-3.3.1/lib/new_relic/agent/method_tracer.rb:486 
> > :in `transaction_with_trace_ActiveRecord_self_name_transaction'
>
> > ThinkingSphinx::SphinxError: index not preread
> > [GEM_ROOT]/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/search.rb:431:in 
> > `block in populate'
> > [GEM_ROOT]/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/search.rb:576:in 
> > `call'
> > [GEM_ROOT]/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/search.rb:576:in 
> > `retry_on_stale_index'
> > [GEM_ROOT]/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/search.rb:419:in 
> > `populate'
> > [GEM_ROOT]/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/search.rb:182:in 
> > `method_missing'
>
> > Any thoughts? I'm using the latest version of TS/Riddle, Sphinx 2.0.2, and 
> > Ruby 1.9.3-p0.
>
> > Thank you!
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Thinking Sphinx" group.
> > To view this discussion on the web 
> > visithttps://groups.google.com/d/msg/thinking-sphinx/-/vvpYVkMQyNEJ.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://groups.google.com/group/thinking-sphinx?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.

Reply via email to