知道为什么 Thinking Sphinx Rake 任务没有运行吗?
我发现当我尝试运行 Thinking Sphinx 的 Rake 任务时,它有时会出错。有时任务工作正常,有时我会遇到如下错误。
我以普通用户身份运行任务,而不是 root 用户。不使用 sudo。
在下面的示例中,Rake 任务失败后 searchd 仍在运行。
我在 ts:rebuild
中也看到过类似的错误。
还有其他人看过这个吗?
我正在使用 Sphinx 0.9.9-release (r2117)
我正在使用 Thinking Sphinx 1.4.4 而不是最新版本,因为我使用的是 Rails 2.3.11。
$ rake ts:stop RAILS_ENV=production
(in /var/www/blog_app/releases/20110425053509)
rake aborted!
execution expired
(See full trace by running task with --trace)
[ethan@apphost current]$ rake ts:stop RAILS_ENV=production --trace
(in /var/www/blog_app/releases/20110425053509)
** Invoke ts:stop (first_time)
** Invoke thinking_sphinx:stop (first_time)
** Invoke thinking_sphinx:app_env (first_time)
** Execute thinking_sphinx:app_env
** Invoke environment (first_time)
** Execute environment
** Execute thinking_sphinx:stop
rake aborted!
execution expired
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/1.8/timeout.rb:60
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.4/lib/thinking_sphinx/tasks.rb:58
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/opt/ruby/bin/rake:19:in `load'
/opt/ruby/bin/rake:19
I'm finding that Thinking Sphinx sometimes errors out when I try to run its Rake tasks. Sometimes the tasks work fine, and sometimes I get errors like the one below.
I'm running the tasks as a normal user, not root. Not using sudo.
In the example below, searchd is still running after the Rake task fails.
I've also seen similar errors with ts:rebuild
.
Has anyone else seen this?
I'm using Sphinx 0.9.9-release (r2117)
I'm using Thinking Sphinx 1.4.4 instead of the latest version because I'm on Rails 2.3.11.
$ rake ts:stop RAILS_ENV=production
(in /var/www/blog_app/releases/20110425053509)
rake aborted!
execution expired
(See full trace by running task with --trace)
[ethan@apphost current]$ rake ts:stop RAILS_ENV=production --trace
(in /var/www/blog_app/releases/20110425053509)
** Invoke ts:stop (first_time)
** Invoke thinking_sphinx:stop (first_time)
** Invoke thinking_sphinx:app_env (first_time)
** Execute thinking_sphinx:app_env
** Invoke environment (first_time)
** Execute environment
** Execute thinking_sphinx:stop
rake aborted!
execution expired
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/1.8/timeout.rb:60
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.4/lib/thinking_sphinx/tasks.rb:58
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/opt/ruby/bin/rake:19:in `load'
/opt/ruby/bin/rake:19
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我相信当您已经运行搜索守护程序时会导致此错误。
尝试一下,
如果这给你这样的东西......
然后杀死 searchd
process_id 在我的情况下将是 73470
然后再次尝试 rake ts:rebuild 。
I believe this error is caused when you have a search daemon already running.
Try
if that gives you something like this...
then kill the searchd
process_id in my case would be 73470
Then try rake ts:rebuild again.
我尝试了命令 'ps | grep searchd' 来获取进程ID,但我没有得到它。
然后我尝试了命令“pgrep searchd”,它给了我进程ID。
我终止了该进程并运行命令“rake ts:rebuild”。它起作用了。
我在此处写下了整个经历(免责声明:我是作者)。
I tried command 'ps | grep searchd' to get process ID, but I didn't get it.
Then I tried command 'pgrep searchd', it gives me process ID.
I killed that process and ran command 'rake ts:rebuild'. It worked.
I blogged about the entire experience here (disclaimer: I'm the author).
有5秒超时
在thinking_sphinx 1.4.4中,如果
rake ts:stop
花费接近或超过5秒,则rake ts:stop
,ruby 会抛出异常。我同时使用thinking_sphinx 1.3.18。 (1.3.18 没有超时)。
此外,我还向 github 存储库提交了补丁,并且超时可以通过 < code>sphinx.yml 配置变量
stop_timeout
。注意:rake ts:rebuild == rake ts:stop;耙 ts:索引;耙子:开始
In thinking_sphinx 1.4.4 there is a 5 second timeout on
rake ts:stop
If
rake ts:stop
takes close to or longer than 5 seconds, ruby will throw an exception.I'm using the thinking_sphinx 1.3.18 in the meantime. (there is no timeout on 1.3.18).
Also I have submitted a patch to the github repository and the timeout will be configurable with a
sphinx.yml
configuration variablestop_timeout
.NOTE:
rake ts:rebuild
==rake ts:stop; rake ts:index; rake ts:start
我猜想在 capistrano 部署后你没有运行
rakethink_sphinx:configure
它将在 config/products.sphinx.conf 中生成 sphinx 配置文件
尝试将 pidfile 添加到 config/sphinx.yml
它将确保找到要杀死的 searchd 的 pid
并添加将以下代码添加到 config/deploy.rb
以在每个发布文件夹中生成 sphinx 配置文件
I guess after deploy by capistrano you didn't run
rake thinking_sphinx:configure
it would generate sphinx config file in
config/production.sphinx.conf
try add pidfile to
config/sphinx.yml
it will make sure to find pid of searchd to kill
and added following code to
config/deploy.rb
to generate sphinx config file in each release folder
问题
如果您的 searchd 崩溃或者您手动终止了它,就会出现此问题。在 Windows 上,它不会覆盖您的
searchd..pid
,因此旧的 PID 仍然会被保存,并且 ThinkingSphinx 不会检查任务管理器中实际运行的进程。因此,所有这些命令(rake ts:restart、rake ts:rebuild、...
)都不起作用,rake 总是会中止,并且您会收到错误rake aborted, ... searchd已在运行
解决方案
删除您的
path-to/your-app/log/searchd..pid
。<环境>
可能是开发
或生产
,具体取决于您当前的阶段。希望这个答案对谷歌用户有所帮助。
The Problem
This problem occurs if your searchd crashed or you killed it manually. On Windows it doesn't overwrite your
searchd.<environment>.pid
, so still the old PID is saved and ThinkingSphinx doesn't check the real running processes in your taskmanager. So all these commands (rake ts:restart, rake ts:rebuild, ...
) won't work, rake will always abort and you get the errorrake aborted, ... searchd already running
The solution
Delete your
path-to/your-app/log/searchd.<environment>.pid
.<environment>
may bedevelopment
orproduction
, depending on your current stage.Hope this answer will help the googler's.