有一个调用
的cron作业cd /Users/me/rails/current && bundle exec rake ts:rebuild >> /Users/me/log/sphinx_index.log
任务调用正确的版本。运行所有索引,遍历所有分数,声明成功启动(pid 53801)。'
运行搜索,然后收到不幸的消息:
未定义的方法`constantize' 0:Fixnum
手动进入应用程序目录并启动rake ts:rebuild(包含和不包含exec),将应用程序恢复到满意状态。
我看到的唯一区别是手动任务返回:
WARNING: 'require 'rake/rdoctask'' is deprecated. Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
at /Users/me/rails/shared/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/rdoctask.rb
DEPRECATION WARNING: Rake tasks in vendor/plugins/criteriaquery/tasks are deprecated. Use lib/tasks instead. (called from /Users/me/rails/shared/bundle/ruby/1.8/gems/rails-2.3.10/lib/tasks/rails.rb:10)
而日志文件没有提到这一点。
考虑到手头尚未解决的问题,在rails3下为其他应用程序设置cron作业的尝试也失败了,但没有认真调查。
完整堆栈跟踪如下:
/Users/its/rails/shared/bundle/ruby/1.8/gems/thinking-sphinx-1.5.0/lib/thinking_sphinx/search.rb:982:in class_from_crc'
/Users/its/rails/shared/bundle/ruby/1.8/gems/thinking-sphinx-1.5.0/lib/thinking_sphinx/search.rb:961:in
instances_from_matches'
/Users/its/rails/shared/bundle/ruby/1.8/gems/activesupport-2.3.10/lib/active_support/ordered_hash.rb:115:in each'
/Users/its/rails/shared/bundle/ruby/1.8/gems/activesupport-2.3.10/lib/active_support/ordered_hash.rb:115:in
每个'
/Users/its/rails/shared/bundle/ruby/1.8/gems/thinking-sphinx-1.5.0/lib/thinking_sphinx/search.rb:959:in instances_from_matches'
/Users/its/rails/shared/bundle/ruby/1.8/gems/thinking-sphinx-1.5.0/lib/thinking_sphinx/search.rb:465:in
compose_results'
/Users/its/rails/shared/bundle/ruby/1.8/gems/thinking-sphinx-1.5.0/lib/thinking_sphinx/search.rb:442:in populate'
/Users/its/rails/shared/bundle/ruby/1.8/gems/thinking-sphinx-1.5.0/lib/thinking_sphinx/search.rb:603:in
来电'
/Users/its/rails/shared/bundle/ruby/1.8/gems/thinking-sphinx-1.5.0/lib/thinking_sphinx/search.rb:603:in retry_on_stale_index'
/Users/its/rails/shared/bundle/ruby/1.8/gems/thinking-sphinx-1.5.0/lib/thinking_sphinx/search.rb:419:in
填充'
/Users/its/rails/shared/bundle/ruby/1.8/gems/thinking-sphinx-1.5.0/lib/thinking_sphinx/search.rb:286:in total_entries'
/Users/its/rails/releases/20130829144322/app/views/ricerca/risultati.html.erb:1:in
_ run_erb_app47views47ricerca47risultati46html46erb'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_view/renderable.rb:34:in send'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_view/renderable.rb:34:in
渲染'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_view/base.rb:306:in with_template'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_view/renderable.rb:30:in
渲染'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_view/template.rb:205:in render_template'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_view/base.rb:265:in
渲染'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_view/base.rb:348:in _render_with_layout'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_view/base.rb:262:in
渲染'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/base.rb:1252:in render_for_file'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/base.rb:936:in
render_without_benchmark'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/benchmarking.rb:51:in render'
/Users/its/rails/shared/bundle/ruby/1.8/gems/activesupport-2.3.10/lib/active_support/core_ext/benchmark.rb:17:in
ms'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:308:in realtime'
/Users/its/rails/shared/bundle/ruby/1.8/gems/activesupport-2.3.10/lib/active_support/core_ext/benchmark.rb:17:in
ms'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/benchmarking.rb:51:in render'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/base.rb:1328:in
default_render'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/base.rb:1334:in perform_action_without_filters'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/filters.rb:617:in
call_filters'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/filters.rb:610:in perform_action_without_benchmark'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/benchmarking.rb:68:in
perform_action_without_rescue'
/Users/its/rails/shared/bundle/ruby/1.8/gems/activesupport-2.3.10/lib/active_support/core_ext/benchmark.rb:17:in ms'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:308:in
实时'
/Users/its/rails/shared/bundle/ruby/1.8/gems/activesupport-2.3.10/lib/active_support/core_ext/benchmark.rb:17:in ms'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/benchmarking.rb:68:in
perform_action_without_rescue'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/rescue.rb:160:in perform_action_without_flash'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/flash.rb:151:in
perform_action'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/base.rb:532:in send'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/base.rb:532:in
process_without_filters'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/filters.rb:606:in process'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/base.rb:391:in
进程'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/base.rb:386:in call'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/routing/route_set.rb:438:in
来电'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/dispatcher.rb:87:in dispatch'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/dispatcher.rb:121:in
_ call'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/dispatcher.rb:130:in build_middleware_stack'
/Users/its/rails/shared/bundle/ruby/1.8/gems/activerecord-2.3.10/lib/active_record/query_cache.rb:29:in
来电'
/Users/its/rails/shared/bundle/ruby/1.8/gems/activerecord-2.3.10/lib/active_record/query_cache.rb:29:in call'
/Users/its/rails/shared/bundle/ruby/1.8/gems/activerecord-2.3.10/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in
cache'
/Users/its/rails/shared/bundle/ruby/1.8/gems/activerecord-2.3.10/lib/active_record/query_cache.rb:9:in cache'
/Users/its/rails/shared/bundle/ruby/1.8/gems/activerecord-2.3.10/lib/active_record/query_cache.rb:28:in
来电'
/Users/its/rails/shared/bundle/ruby/1.8/gems/activerecord-2.3.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in call'
/Users/its/rails/shared/bundle/ruby/1.8/gems/warden-0.10.7/lib/warden/manager.rb:35:in
来电'
/Users/its/rails/shared/bundle/ruby/1.8/gems/warden-0.10.7/lib/warden/manager.rb:34:in catch'
/Users/its/rails/shared/bundle/ruby/1.8/gems/warden-0.10.7/lib/warden/manager.rb:34:in
来电'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/string_coercion.rb:25:in call'
/Users/its/rails/shared/bundle/ruby/1.8/gems/rack-1.1.3/lib/rack/head.rb:9:in
来电'
/Users/its/rails/shared/bundle/ruby/1.8/gems/rack-1.1.3/lib/rack/methodoverride.rb:24:in call'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/params_parser.rb:15:in
来电'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/session/cookie_store.rb:100:in call'
/Users/its/rails/shared/bundle/ruby/1.8/bundler/gems/devise-efc42d7662f3/lib/devise/rails/warden_compat.rb:43:in
来电'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/failsafe.rb:26:in call'
/Users/its/rails/shared/bundle/ruby/1.8/gems/rack-1.1.3/lib/rack/lock.rb:11:in
来电'
/Users/its/rails/shared/bundle/ruby/1.8/gems/rack-1.1.3/lib/rack/lock.rb:11:in synchronize'
/Users/its/rails/shared/bundle/ruby/1.8/gems/rack-1.1.3/lib/rack/lock.rb:11:in
来电'
/Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/dispatcher.rb:106:in call'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/rack/request_handler.rb:96:in
process_request'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/abstract_request_handler.rb:513:in accept_and_process_next_request'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/abstract_request_handler.rb:274:in
main_loop'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/classic_rails/application_spawner.rb:321:in start_request_handler'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in
发送'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in handle_spawn_application'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/utils.rb:479:in
safe_fork'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/classic_rails/application_spawner.rb:270:in handle_spawn_application'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/abstract_server.rb:357:in
发送'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/abstract_server.rb:357:in server_main_loop'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/abstract_server.rb:206:in
start_synchronously'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/abstract_server.rb:180:in start'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/classic_rails/application_spawner.rb:149:in
start'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/spawn_manager.rb:219:in spawn_rails_application'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/abstract_server_collection.rb:132:in
lookup_or_add'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/spawn_manager.rb:214:in spawn_rails_application'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/abstract_server_collection.rb:82:in
同步'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/abstract_server_collection.rb:79:in synchronize'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/spawn_manager.rb:213:in
spawn_rails_application'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/spawn_manager.rb:132:in spawn_application'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/spawn_manager.rb:275:in
handle_spawn_application'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/abstract_server.rb:357:in __send__'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/abstract_server.rb:357:in
server_main_loop'
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/abstract_server.rb:206:in`start_synchronously&& 39;
/Library/Ruby/Gems/1.8/gems/passenger-3.0.7/helper-scripts/passenger-spawn-server:99
答案 0 :(得分:0)
我没有看到堆栈跟踪的猜测是,cronx的搜索和索引器命令行工具无法由cron直接访问(它们在你的PATH中,但不在cron中)。因此,Thinking Sphinx假定Sphinx的旧版本并发送/期望稍微不同的协议。虽然它在这方面取得进展的事实很奇怪......也许你安装了两个不同版本的Sphinx?
您可以在config / sphinx.yml文件中手动设置Sphinx版本:
production:
version: 2.0.8
同样设置SPHINX_VERSION环境变量也会产生相同的影响。
无关,但不需要定期重建 - 只需运行索引即可确保Sphinx加载的数据是最新的。只有在更改索引定义时才需要重建(非常类似于db:migrate调用)。