3

I can no longer reindex and cannot resolve this issue. Spend several hours digging the web for this issue. ** *regarding production environment * development goes ok. :( How would one fix this?

rake sunspot:reindex
rake aborted!
RSolr::Error::Http - 404 Not Found
Error:     Not Found

Request Data: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><delete><query>type:Match</query></delete>"

Backtrace: 

    /srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:268:in `adapt_response'
    /srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:175:in `execute'
    /srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:161:in `send_and_receive'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation'
    /srv/books/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `block in instrument'
    /srv/books/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    /srv/books/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `instrument'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation'
    (eval):2:in `post'
    /srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:67:in `update'
    /srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:131:in `delete_by_query'/srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:268:in `adapt_response'
    /srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:175:in `execute'
    /srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:161:in `send_and_receive'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation'
    /srv/books/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `block in instrument'
    /srv/books/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    /srv/books/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `instrument'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation'
    (eval):2:in `post'
    /srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:67:in `update'
    /srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:131:in `delete_by_query'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot/indexer.rb:57:in `remove_all'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot/session.rb:181:in `block in remove_all'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot/session.rb:181:in `each'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot/session.rb:181:in `remove_all'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot/session_proxy/retry_5xx_session_proxy.rb:17:in `method_missing'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot.rb:464:in `remove_all'
    /srv/books/shared/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.8.168/lib/new_relic/agent/method_tracer.rb:508:in `block in remove_all_with_trace_SolrClient_Sunspot_delete'
    /srv/books/shared/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.8.168/lib/new_relic/agent/method_tracer.rb:259:in `trace_execution_scoped'
    /srv/books/shared/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.8.168/lib/new_relic/agent/method_tracer.rb:503:in `remove_all_with_trace_SolrClient_Sunspot_delete'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/searchable.rb:183:in `solr_remove_all_from_index'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/searchable.rb:202:in `solr_reindex'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/tasks.rb:57:in `block (4 levels) in <top (required)>'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot/class_set.rb:16:in `each'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot/class_set.rb:16:in `each'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/tasks.rb:56:in `block (3 levels) in <top (required)>'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/tasks.rb:68:in `with_session'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/tasks.rb:19:in `block (2 levels) in <top (required)>'
    /usr/local/rvm/gems/ruby-2.0.0-p247@books/bin/ruby_executable_hooks:15:in `eval'
    /usr/local/rvm/gems/ruby-2.0.0-p247@books/bin/ruby_executable_hooks:15:in `<main>'
    Tasks: TOP => sunspot:reindex
    (See full trace by running task with --trace)
clami219
  • 2,958
  • 1
  • 31
  • 45
Rubytastic
  • 15,001
  • 18
  • 87
  • 175
  • can you tell us, what changes made the rake task to fail? ruby-, rails-, gem-update? Can you try to naroow down the problem – ernd enson Nov 01 '13 at 14:08
  • No can't recall. I did fresh install according to sunspot docs, it still fails – Rubytastic Nov 01 '13 at 15:37
  • well, maybe the problem is not only sunspot related, because one of the first lines in your backtrace it says `delete_by_query'/srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:268:in `adapt_response' so i'd suggest to downgrade sunspot to a prior version and check if the problem is still occurring. sorry, but my hands are tied :( – ernd enson Nov 01 '13 at 16:05
  • your log-file implies to me, that this is happening on a staging/production env. is the problem occurring in development as well? – ernd enson Nov 01 '13 at 16:06
  • No the problem is only in production. I shall update my post to clarify that more – Rubytastic Nov 01 '13 at 16:48
  • ok, that sounds interesting. Maybe you just need to 1) shut down your solr-instance 2) remove the complete solr/data/production-folder where your indices are kept 3) restart your solr instance (so that new, empty indices are created) 4) reindex your solr. We had a similar problem in development once and that was doing the job. – ernd enson Nov 01 '13 at 17:03
  • Tried "Creating" a /solr/production folder in my app's folder because it was not there, and reindex. Still same issue. no response from the solr uergroup or issue list this is getting quite frustrating! – Rubytastic Nov 01 '13 at 18:15
  • a co-worker of mine was recently running a second instance in development (one started manually and the other started by the rake task). maybe you're running into the same issue, that the solr instance, that is referenced by the pid, is not running. – ernd enson Nov 02 '13 at 15:09

2 Answers2

4

These are the terminal commands you should follow to solve your problems:

  1. ps aux | grep solr to get solr process ID
  2. sudo kill <ID>, <ID> is the ID you found from 1
  3. rm -r <path/to/solr>, remove the solr directory inside your project to remove all of previous indexes
  4. RAILS_ENV=production bundle exec rake sunspot:solr:start
  5. Change the path to /solr/default inside config/sunspot.yml
  6. RAILS_ENV=production bundle exec rake sunspot:solr:reindex

Bam! Problems solved! I hope.

vutran
  • 2,145
  • 21
  • 34
0

upgrading to tomcat6 fixed the issue after i Set sunspot.yml path to /solr/collection1 and copying the scheme.xml from sunspot to the /opt/solr/collection1/conf/scheme.xml

Rubytastic
  • 15,001
  • 18
  • 87
  • 175