Ruby / Rails + Resque抛出“连接超时”错误

时间:2012-11-28 11:54:53

标签: ruby-on-rails resque

我有一个使用Resque的Ruby Rails应用程序。

Resuqe守护程序在运行一段时间后出现错误而崩溃。我的第一个猜测是守护进程没有经常访问MySQL数据库(几个小时)所以我每5分钟触发一次访问数据库的队列项。但我仍然得到:

rake aborted!
Connection timed out
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:204:in `rescue in io'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:202:in `io'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:210:in `read'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:84:in `block in call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:183:in `block (2 levels) in process'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:287:in `ensure_connected'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:173:in `block in process'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:248:in `logging'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:172:in `process'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:84:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis.rb:715:in `block in get'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis.rb:36:in `block in synchronize'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis.rb:36:in `synchronize'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis.rb:714:in `get'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-namespace-1.2.1/lib/redis/namespace.rb:257:in `method_missing'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/resque-1.23.0/lib/resque/worker.rb:517:in `job'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/resque-1.23.0/lib/resque/worker.rb:450:in `unregister_worker'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/resque-1.23.0/lib/resque/worker.rb:169:in `rescue in work'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/resque-1.23.0/lib/resque/worker.rb:129:in `work'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/resque-1.23.0/lib/resque/tasks.rb:36:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => resque:work
(See full trace by running task with --trace)

我在我的方法中输入了一些日志文件输出,当任何异步任务被触发时会被调用,但看起来好像在没有执行任何应用程序代码时连接超时。

从哪里开始?

1 个答案:

答案 0 :(得分:0)

根据这里的日志,与redis的连接丢失了,而不是mysql。