今天下午开始使用delayed_job进程发现问题,发现守护进程已经死了并重新启动它们......
大约40分钟后,这个过程再次以86个工作岗位去世。试图再次启动守护进程,发现它们在我启动后立即悄然死亡。检查我发现的日志:
s603021@ec2-184-72-244-232:~/rails/gamestreamer/current$ tail -F log/delayed_job.log
SQL (0.7ms) SET NAMES 'utf8'
SQL (0.8ms) SET SQL_AUTO_IS_NULL=0
*** Starting job worker delayed_job.4 host:ec2-184-72-244-232.compute-1.amazonaws.com pid:17397
Delayed::Job Columns (1.5ms) SHOW FIELDS FROM `delayed_jobs`
Product Columns (1.5ms) SHOW FIELDS FROM `products`
Game Columns (2.4ms) SHOW FIELDS FROM `games`
Delayed::Job Update (12.8ms) UPDATE `delayed_jobs` SET locked_by = null, locked_at = null WHERE (locked_by = 'delayed_job.4 host:ec2-184-72-244-232.compute-1.amazonaws.com pid:17397')
#<ArgumentError: syntax error on line 1588, col 10: `'>
我继续前进并做了一些挖掘,很多人用来找到delayed_jobs的守护进程宝石被窃听,并且rake任务仍然有效;然而,对我来说并非如此:
s603021@ec2-184-72-244-232:~/rails/gamestreamer/current$ RAILS_ENV=gs1_development rake jobs:work --trace
(in /data01/home/s603021/rails/gamestreamer/releases/20110302193304)
** Invoke jobs:work (first_time)
** Invoke merb_env (first_time)
** Execute merb_env
** Invoke environment (first_time)
** Execute environment
** Execute jobs:work
*** Starting job worker host:ec2-184-72-244-232.compute-1.amazonaws.com pid:17082
rake aborted!
syntax error on line 1588, col 10: `'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/1.8/yaml.rb:133:in `load'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/1.8/yaml.rb:133:in `load'
/data01/home/s603021/rails/gamestreamer/releases/20110302193304/vendor/plugins/delayed_job/lib/delayed/job.rb:234:in `deserialize'
/data01/home/s603021/rails/gamestreamer/releases/20110302193304/vendor/plugins/delayed_job/lib/delayed/job.rb:50:in `payload_object'
/data01/home/s603021/rails/gamestreamer/releases/20110302193304/vendor/plugins/delayed_job/lib/delayed/job.rb:55:in `name'
/data01/home/s603021/rails/gamestreamer/releases/20110302193304/vendor/plugins/delayed_job/lib/delayed/job.rb:90:in `run_with_lock'
/data01/home/s603021/rails/gamestreamer/releases/20110302193304/vendor/plugins/delayed_job/lib/delayed/job.rb:159:in `reserve_and_run_one_job'
/data01/home/s603021/rails/gamestreamer/releases/20110302193304/vendor/plugins/delayed_job/lib/delayed/job.rb:158:in `each'
/data01/home/s603021/rails/gamestreamer/releases/20110302193304/vendor/plugins/delayed_job/lib/delayed/job.rb:158:in `reserve_and_run_one_job'
/data01/home/s603021/rails/gamestreamer/releases/20110302193304/vendor/plugins/delayed_job/lib/delayed/job.rb:205:in `work_off'
/data01/home/s603021/rails/gamestreamer/releases/20110302193304/vendor/plugins/delayed_job/lib/delayed/job.rb:204:in `times'
/data01/home/s603021/rails/gamestreamer/releases/20110302193304/vendor/plugins/delayed_job/lib/delayed/job.rb:204:in `work_off'
/data01/home/s603021/rails/gamestreamer/releases/20110302193304/vendor/plugins/delayed_job/lib/delayed/worker.rb:30:in `start'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/data01/home/s603021/rails/gamestreamer/releases/20110302193304/vendor/plugins/delayed_job/lib/delayed/worker.rb:29:in `start'
/data01/home/s603021/rails/gamestreamer/releases/20110302193304/vendor/plugins/delayed_job/lib/delayed/worker.rb:26:in `loop'
/data01/home/s603021/rails/gamestreamer/releases/20110302193304/vendor/plugins/delayed_job/lib/delayed/worker.rb:26:in `start'
/data01/home/s603021/rails/gamestreamer/releases/20110302193304/vendor/plugins/delayed_job/lib/delayed/tasks.rb:13
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/opt/ruby-enterprise-1.8.7-2010.02/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.02/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/ruby-enterprise-1.8.7-2010.02/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.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/ruby-enterprise-1.8.7-2010.02/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.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/opt/ruby-enterprise-1.8.7-2010.02/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.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
现在我只是不确定可能出现什么问题,关于如何获取更多信息(或更详细的例外)的任何建议都会很棒。如果有人能帮助我解决它,那将是难以置信的。提前致谢 -
Job.rb文件:http://pastie.org/1697465
答案 0 :(得分:2)
几个月后我遇到了类似的问题,我的堆栈跟踪吐出来了:
2011-02-02 20:19:42 INFO -- Processing request 342 for service document_upload, worker 1
2011-02-02 20:19:44 FATAL -- ArgumentError (syntax error on line 29, col -1: `'):
/usr/lib/ruby/1.8/yaml.rb:133:in `load'
/usr/lib/ruby/1.8/yaml.rb:133:in `load'
/var/local/hprime/lib/puck_seed_file.rb:179:in `get_seed'
/var/local/hprime/lib/puck_seed_file.rb:7:in `read'
我花了很多时间才找到导致它的原因,因为它非常间歇性,但结果却是正在处理的实际作业中的语法问题。不确定你的确在做什么,但你可以从那里开始..?
同时在尝试解决我的问题时,我遇到了一些修复了类似问题的人,他们通过将其添加到他们的config / boot.rb来改变yaml中的解析引擎
require 'yaml'
YAML::ENGINE.yamler= 'syck'
显然,如果yaml内容中包含特殊字符,则默认解析器会吐出虚拟对象。您也可以尝试使用它,看看它是否有帮助。无论如何,对不起它有点模糊,希望它有所帮助。
答案 1 :(得分:0)
该问题归结为YAML无法解析的作业有效负载 - 对于最接近的答案,信用额度为2个蛋白质。
加载IRb并根据payload_object方法检查作业将显示YAML正在阻塞的作业,销毁作业并且rake任务将正常工作。