无论是 resque 和 redis 在同一台机器上,还是跨网络,一段时间后(本机时间长点,跨网络不到一个小时就挂掉)都会僵死掉不能取 job 处理,下面是前台起 resque --trace 后看到的异常,但实际上 redis 都是可用的。 按道理 resque 会重连 redis 吧,redis 设置 timeout=0. 而且前台起 resque 一旦网络异常进程就退出了,不会这么脆弱吧。 后台起 resque 一段时间后,进程还在,但不工作了,重启才重新获取 job 处理。 各位有遇到过吗?
rake aborted!
Connection timed out
/home/app/.rvm/gems/[email protected]/gems/redis-3.0.1/lib/redis/client.rb:198:in rescue in io'
/home/app/.rvm/gems/[email protected]/gems/redis-3.0.1/lib/redis/client.rb:196:in
io'
/home/app/.rvm/gems/[email protected]/gems/redis-3.0.1/lib/redis/client.rb:204:in read'
/home/app/.rvm/gems/[email protected]/gems/redis-3.0.1/lib/redis/client.rb:78:in
block in call'
/home/app/.rvm/gems/[email protected]/gems/redis-3.0.1/lib/redis/client.rb:177:in block (2 levels) in process'
/home/app/.rvm/gems/[email protected]/gems/redis-3.0.1/lib/redis/client.rb:281:in
ensure_connected'
/home/app/.rvm/gems/[email protected]/gems/redis-3.0.1/lib/redis/client.rb:167:in block in process'
/home/app/.rvm/gems/[email protected]/gems/redis-3.0.1/lib/redis/client.rb:242:in
logging'
/home/app/.rvm/gems/[email protected]/gems/redis-3.0.1/lib/redis/client.rb:166:in process'
/home/app/.rvm/gems/[email protected]/gems/redis-3.0.1/lib/redis/client.rb:78:in
call'
/home/app/.rvm/gems/[email protected]/gems/redis-3.0.1/lib/redis.rb:1195:in block in smembers'
/home/app/.rvm/gems/[email protected]/gems/redis-3.0.1/lib/redis.rb:36:in
block in synchronize'
/home/app/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/monitor.rb:211:in mon_synchronize'
/home/app/.rvm/gems/[email protected]/gems/redis-3.0.1/lib/redis.rb:36:in
synchronize'
/home/app/.rvm/gems/[email protected]/gems/redis-3.0.1/lib/redis.rb:1194:in smembers'
/home/app/.rvm/gems/[email protected]/gems/redis-namespace-1.2.0/lib/redis/namespace.rb:243:in
method_missing'
/home/app/.rvm/gems/[email protected]/gems/resque-1.21.0/lib/resque.rb:184:in queues'
/home/app/.rvm/gems/[email protected]/gems/resque-1.21.0/lib/resque/worker.rb:216:in
block in queues'
/home/app/.rvm/gems/[email protected]/gems/resque-1.21.0/lib/resque/worker.rb:216:in map'
/home/app/.rvm/gems/[email protected]/gems/resque-1.21.0/lib/resque/worker.rb:216:in
queues'
/home/app/.rvm/gems/[email protected]/gems/resque-1.21.0/lib/resque/worker.rb:197:in reserve'
/home/app/.rvm/gems/[email protected]/gems/resque-1.21.0/lib/resque/worker.rb:131:in
block in work'
/home/app/.rvm/gems/[email protected]/gems/resque-1.21.0/lib/resque/worker.rb:128:in loop'
/home/app/.rvm/gems/[email protected]/gems/resque-1.21.0/lib/resque/worker.rb:128:in
work'
/home/app/.rvm/gems/[email protected]/gems/resque-1.21.0/lib/resque/tasks.rb:34:in block (2 levels) in <top (required)>'
/home/app/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:205:in
call'
/home/app/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:205:in block in execute'
/home/app/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:200:in
each'
/home/app/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:200:in execute'
/home/app/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:158:in
block in invoke_with_call_chain'
/home/app/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/monitor.rb:211:in mon_synchronize'
/home/app/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:151:in
invoke_with_call_chain'
/home/app/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:144:in invoke'
/home/app/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:116:in
invoke_task'
/home/app/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:94:in block (2 levels) in top_level'
/home/app/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:94:in
each'
/home/app/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:94:in block in top_level'
/home/app/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:133:in
standard_exception_handling'
/home/app/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:88:in top_level'
/home/app/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:66:in
block in run'
/home/app/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:133:in standard_exception_handling'
/home/app/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:63:in
run'
/home/app/.rvm/gems/[email protected]/gems/rake-0.9.2.2/bin/rake:33:in <top (required)>'
/home/app/.rvm/gems/[email protected]/bin/rake:19:in
load'
/home/app/.rvm/gems/[email protected]/bin/rake:19:in `