Gem resque timeout 问题,求助大侠

rain010101 · 2013年01月09日 · 最后由 vkill 回复于 2013年01月15日 · 7279 次阅读

无论是 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:inio' /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:inblock 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:inensure_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:inlogging' /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:incall' /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:inblock 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:insynchronize' /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:inmethod_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:inblock 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:inqueues' /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:inblock 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:inwork' /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:incall' /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:ineach' /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:inblock 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:ininvoke_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:ininvoke_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:ineach' /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:instandard_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:inblock 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:inrun' /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:inload' /home/app/.rvm/gems/[email protected]/bin/rake:19:in `

' Tasks: TOP => resque:work

沙发自己做,求大侠出手相救

换用 sidekiq 呢?代码基本上不用改动。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号