0

有一个调用的 cron 工作

cd /Users/me/rails/current && bundle exec rake ts:rebuild >> /Users/me/log/sphinx_index.log

任务调用适当的释放。遍历所有索引,遍历所有分数,声明“已成功启动(pid 53801)。”

运行搜索并得到不幸的消息:

0:Fixnum 的未定义方法“constantize”

手动进入应用程序的目录并启动 rake ts:rebuild(有和没有 bundle 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:ininstances_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:ineach' /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:incompose_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:incall' /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:inpopulate' /Users/its/rails/shared/bundle/ruby /1.8/gems/thinking-sphinx-1.5.0/lib/thinking_sphinx/search.rb:286:intotal_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:inrender' /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:inrender' /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:inrender' /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:inrender' /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:inrender_without_benchmark' /Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack -2.3.10/lib/action_controller/benchmarking.rb:51:inrender' /Users/its/rails/shared/bundle/ruby/1.8/gems/activesupport-2.3.10/lib/active_support/core_ext/benchmark.rb:17:inms' /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:inms' /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:indefault_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:incall_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:inperform_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:inrealtime' /Users/its/rails/shared/bundle/ruby/1.8/gems/activesupport-2.3 .10/lib/active_support/core_ext/benchmark.rb:17:inms' /Users/its/rails/shared/bundle/ruby/1.8/gems/actionpack-2.3.10/lib/action_controller/benchmarking.rb:68:inperform_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:inperform_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:inprocess_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:inprocess' /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:incall' /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:inbuild_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:incache'/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:incall' /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:incall' /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:incall' /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:incall' /Users/its/rails/shared/bundle/ruby/1.8 /gems/rack-1.1.3/lib/rack/methodoverride.rb:24:incall' /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:incall'/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:incall' /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:incall' /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:inprocess_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:inmain_loop' /Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/classic_rails /application_spawner.rb:321:instart_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:insafe_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:insend '/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:instart_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:instart' /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:inlookup_or_add' /Library/Ruby/Gems/1.8/gems/passenger-3.0.7/lib/phusion_passenger/spawn_manager.rb:214:inspawn_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:inspawn_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:inhandle_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:inserver_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/helper-scripts/passenger-spawn-server: 99

4

1 回答 1

0

我没有看到堆栈跟踪的猜测是,cron 无法直接访问 Sphinx 的 searchd 和 indexer 命令行工具(它们在您的 PATH 中,但不在 cron 中)。因此,Thinking Sphinx 假定 Sphinx 的旧版本,并发送/期望略有不同的协议。虽然它在这方面取得进展的事实很奇怪......也许你安装了两个不同版本的 Sphinx?

您可以在 config/sphinx.yml 文件中手动设置 Sphinx 版本:

production:
  version: 2.0.8

设置 SPHINX_VERSION 环境变量也会产生同样的效果。

不相关,但无需定期重建 - 只需运行索引即可确保 Sphinx 加载的数据是最新的。仅当您更改索引定义时才需要重建(很像 db:migrate 调用)。

于 2013-09-14T04:02:55.060 回答