sunspot/sunspot — Issue #139: Progress bar makes sunspot:reindex fail on heroku
Author: coryschires
Created: 2011-12-06 21:14:00+00:00
State: open

When running rake tasks on heroku reindexing fails with:

negative argument

Looking at the trace, `progress_bar` seems to be at fault:

** Invoke sunspot:reindex (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sunspot:reindex
rake aborted!
negative argument
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:97:in `*'
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:97:in `render_bar'
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:87:in `send'
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:87:in `render'
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:72:in `to_s'
/app/.bundle/gems/ruby/1.8/gems/rsolr-1.0.6/lib/rsolr/client.rb:254:in `inject'
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:71:in `each'
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:71:in `inject'
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:71:in `to_s'
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:35:in `write'
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:28:in `increment!'
/app/.bundle/gems/ruby/1.8/gems/sunspot_rails-1.3.0/lib/sunspot/rails/searchable.rb:260:in `solr_index'
/app/.bundle/gems/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/relation/batches.rb:69:in `find_in_batches'
/app/.bundle/gems/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/base.rb:446:in `__send__'
/app/.bundle/gems/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/base.rb:446:in `find_in_batches'
/app/.bundle/gems/ruby/1.8/gems/sunspot_rails-1.3.0/lib/sunspot/rails/searchable.rb:254:in `solr_index'
/app/.bundle/gems/ruby/1.8/gems/sunspot_rails-1.3.0/lib/sunspot/rails/searchable.rb:198:in `solr_reindex'
/app/.bundle/gems/ruby/1.8/gems/sunspot_rails-1.3.0/lib/sunspot/rails/tasks.rb:54
/app/.bundle/gems/ruby/1.8/gems/sunspot-1.3.0/lib/sunspot/class_set.rb:16:in `each'
/app/.bundle/gems/ruby/1.8/gems/sunspot-1.3.0/lib/sunspot/class_set.rb:16:in `each'
/app/.bundle/gems/ruby/1.8/gems/sunspot_rails-1.3.0/lib/sunspot/rails/tasks.rb:53
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `execute'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/usr/ruby1.8.7/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:62:in `run'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/bin/rake:32
/app/.bundle/gems/ruby/1.8/bin/rake:19:in `load'
/app/.bundle/gems/ruby/1.8/bin/rake:19
Tasks: TOP => sunspot:reindex

Removing `progress_bar` from my production gem group seems to fix the issue. Odd.

It would be nice to have feedback when reindexing on heroku.