Psych :: BadAlias:未知别名:运行rake job:work时为1

时间:2018-12-10 23:13:03

标签: ruby-on-rails ruby psych

当我用rake jobs:work引导作业服务器时,我的应用程序发生了奇怪的事情。 Rails Web服务器启动正常。我注意到诸如this one之类的线程,但是1)它不是完全相同的错误消息,一个看起来更简单; 2)答案没有产生任何不同的结果。

这是我的堆栈跟踪-

rake aborted!
Psych::BadAlias: Unknown alias: 1
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/psych_ext.rb:77:in `visit_Psych_Nodes_Mapping'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/psych_ext.rb:35:in `visit_Psych_Nodes_Mapping'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/psych_ext.rb:35:in `visit_Psych_Nodes_Mapping'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/psych_ext.rb:17:in `load_dj'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/backend/base.rb:85:in `payload_object'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/backend/base.rb:74:in `name'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:245:in `job_say'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:272:in `handle_failed_job'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:213:in `block in run'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:61:in `block in initialize'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:66:in `execute'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:213:in `rescue in run'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:202:in `run'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:280:in `block in reserve_and_run_one_job'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:61:in `block in initialize'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:66:in `execute'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:280:in `reserve_and_run_one_job'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:187:in `block in work_off'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:186:in `times'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:186:in `work_off'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:150:in `block (4 levels) in start'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:149:in `block (3 levels) in start'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:61:in `block in initialize'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:66:in `execute'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:148:in `block (2 levels) in start'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:147:in `loop'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:147:in `block in start'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:79:in `block (2 levels) in add'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:61:in `block in initialize'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:79:in `block in add'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:66:in `execute'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:146:in `start'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/tasks.rb:9:in `block (2 levels) in <top (required)>'

1 个答案:

答案 0 :(得分:2)

ruby升级到2.1.5后,我遇到了同样的问题。那是可以在rails 2.3.8上运行的最新红宝石版本。

升级到4.1.8的最新版本没有帮助。还尝试在我的delayed_job中指定psych gem的降级版本。效果不是很好。

真正的问题是,如果在作业解析阶段出现错误,则Gemfile不会更新delayed_job列。

所以我只是浏览了所有作业,并检查了是否可以解析它:

last_error

就我而言,〜3k中有6个可以安全删除的工作,所以我很幸运:)

参考:

https://github.com/collectiveidea/delayed_job/pull/867

https://github.com/collectiveidea/delayed_job_mongoid/pull/65