Heroku - Ruby 错误循环
Posted
技术标签:
【中文标题】Heroku - Ruby 错误循环【英文标题】:Heroku - Ruby error loop 【发布时间】:2018-07-12 06:55:38 【问题描述】:我没有对 ruby 文件进行任何更改,只是对布局进行了一些更改,并且在我的服务器上的 Papertrail 中看到以下错误。我做了一些挖掘似乎找不到答案。
同样的代码库也在 QA 系统中运行,没有错误。两台服务器都在同一个版本 Cedar-14 上,唯一的区别是 Prod 服务器有一个工作人员 Dyno,而 QA 没有。
Feb 01 11:24:46 skincaremarketplace app/worker.1: Don't know how to build
task 'jobs:work'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:74:in `load'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:27:in `run'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/cli.rb:360:in `exec'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor.rb:369:in `dispatch'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/cli.rb:20:in `dispatch'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/base.rb:444:in `start'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/cli.rb:10:in `start'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/exe/bundle:30:in `block in <top (required)>'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/exe/bundle:22:in `<top (required)>'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/bin/bundle:3:in `load'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/bin/bundle:3:in `<main>'
Feb 01 11:24:46 skincaremarketplace app/worker.1: (See full trace by running task with --trace)
Feb 01 11:24:46 skincaremarketplace heroku/worker.1: Process exited with status 1
Feb 01 11:40:45 skincaremarketplace heroku/worker.1: State changed from crashed to starting
Feb 01 11:40:52 skincaremarketplace heroku/worker.1: Starting process with command `bundle exec rake jobs:work`
Feb 01 11:40:52 skincaremarketplace heroku/worker.1: State changed from starting to up
Feb 01 11:41:02 skincaremarketplace heroku/worker.1: Process exited with status 1
Feb 01 11:41:02 skincaremarketplace heroku/worker.1: State changed from up to crashed
Feb 01 11:41:02 skincaremarketplace app/worker.1: rake aborted!
【问题讨论】:
【参考方案1】:在查看 Heroku 上的配置后,我们所有其他遵循相同模式的应用程序都没有使用 jobs:work,或者有一个 jobs.rake 文件。工人被错误地打开了。调查确实提供了一些启示,所以谢谢斯坦。
【讨论】:
【参考方案2】:您的 prod 服务器工作人员 dyno 尝试运行 bundle exec rake jobs:work
(检查您的 Procfile
)。看起来你没有那个任务。它通常应该在lib/tasks/jobs.rake
。
如果你扩大你的 QA 工作人员,他们也会失败。
【讨论】:
我是该平台的新手,并将其作为另一个没有这些问题的应用程序的克隆。我不确定发生了什么变化,但其他系统没有这些问题。并且文件集不包括 Jobs:work 或 jobs.rake。heroku ps:scale worker=0 -a <name-of-your-prod-server>
将在 prod 上将 worker 缩放到 0。然后从您的 Procfile 中删除行 worker: bundle exec rake jobs:work
。以上是关于Heroku - Ruby 错误循环的主要内容,如果未能解决你的问题,请参考以下文章
Ruby on Rails - Heroku上的Carrierwave错误