- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在生产中,我们的 delayed_job
由于某种原因,进程正在死亡。我不确定它是否崩溃或被操作系统杀死或什么。我在 delayed_job.log
中没有看到任何错误文件。
我能做些什么来解决这个问题?我正在考虑安装 monit监视它,但这只会告诉我它何时死亡。它不会真正告诉我它为什么会死。
有没有办法让它对日志文件更健谈,这样我就可以知道它为什么会死?
还有其他建议吗?
最佳答案
我遇到了 delay_job 静默失败的两个原因。第一个是当人们在 fork 进程中使用 libxml 时的实际段错误(这在一段时间前出现在邮件列表中)。
第二个是与 delay_job 所依赖的守护进程的 1.1.0 版本有关的问题( https://github.com/collectiveidea/delayed_job/issues#issue/81 ),这可以通过使用 1.0.10 轻松解决,这是我自己的 Gemfile 中的内容。
日志记录
有登录 delay_job 所以如果工作人员在没有打印错误的情况下死亡,通常是因为它没有抛出异常(例如段错误)或外部的东西正在终止进程。
监控
我使用 bluepill 来监控延迟的作业实例,到目前为止,这在确保作业保持运行方面非常成功。为应用程序运行 bluepill 的步骤非常简单
将 bluepill gem 添加到您的 Gemfile 中:
# Monitoring
gem 'i18n' # Not sure why but it complained I didn't have it
gem 'bluepill'
app_home = "/home/mi/production"
workers = 5
Bluepill.application("mi_delayed_job", :log_file => "#{app_home}/shared/log/bluepill.log") do |app|
(0...workers).each do |i|
app.process("delayed_job.#{i}") do |process|
process.working_dir = "#{app_home}/current"
process.start_grace_time = 10.seconds
process.stop_grace_time = 10.seconds
process.restart_grace_time = 10.seconds
process.start_command = "cd #{app_home}/current && RAILS_ENV=production ruby script/delayed_job start -i #{i}"
process.stop_command = "cd #{app_home}/current && RAILS_ENV=production ruby script/delayed_job stop -i #{i}"
process.pid_file = "#{app_home}/shared/pids/delayed_job.#{i}.pid"
process.uid = "mi"
process.gid = "mi"
end
end
end
# Bluepill related tasks
after "deploy:update", "bluepill:quit", "bluepill:start"
namespace :bluepill do
desc "Stop processes that bluepill is monitoring and quit bluepill"
task :quit, :roles => [:app] do
run "cd #{current_path} && bundle exec bluepill --no-privileged stop"
run "cd #{current_path} && bundle exec bluepill --no-privileged quit"
end
desc "Load bluepill configuration and start it"
task :start, :roles => [:app] do
run "cd #{current_path} && bundle exec bluepill --no-privileged load /home/mi/production/current/config/delayed_job.bluepill"
end
desc "Prints bluepills monitored processes statuses"
task :status, :roles => [:app] do
run "cd #{current_path} && bundle exec bluepill --no-privileged status"
end
end
关于ruby-on-rails - delay_job 在生产一段时间后停止运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4330544/
在 Rails 4.2.3 下,我已将 ActiveJob 设置为在所有环境中使用 delay_job 作为其后端: 环境文件 require File.expand_path('../boot',
在 Heroku 上,我使用 delay_job 来运行异步任务。一切都很好,直到我执行了 git push heroku master,然后 Heroku 环境杀死了所有进程中的工作线程。 这里的问
是否有一个参数可以传递给 delay_job 以防止它从 delay_jobs 表中删除已完成的作业? 有点像 destroy_failed_jobs但对于已完成的工作 有任何想法吗? 最佳答案 看起
我通过 rake jobs:work 在开发模式下运行它没有问题。但是,我不知何故无法弄清楚如何在生产中使用它。我正在使用 Capistrano 进行部署。 感谢您的任何建议! 最佳答案 如果您将 d
在生产中,我们的 delayed_job由于某种原因,进程正在死亡。我不确定它是否崩溃或被操作系统杀死或什么。我在 delayed_job.log 中没有看到任何错误文件。 我能做些什么来解决这个问题
我曾有过几次 delay_jobs 将负责发送 4000 封电子邮件,如果这些电子邮件中出现错误(例如,如果没有调用),那么它将重新启动整个过程并尝试再发送 4000电子邮件。这将无限期地持续下去,直
我们在使用 delay_job 插件时遇到了大问题 - http://github.com/collectiveidea/delayed_job/ 当我们使用“ruby script/delayed_
我想知道在新代码推送后优雅地重新启动 delay_job 消费者的最佳方法是什么?我正在使用 capistrano 推送代码,并且我知道有一些命令可以重新启动,但是如果当前有作业正在运行,则该命令要么
我在 Rails 应用程序中使用 delay_job 和 delay_job_active_record 作为后台作业执行。我们正在使用基于队列的 delay_job。为了启动延迟,我使用以下命令。
DJ 死后,日志文件没有任何指示。 正在运行:./script/delayed_job status 给出:pid-file for killed process 1143 found (/appPa
关注这个关于 delayed_job and monit 的问题 它在我的开发机器上工作。但是每当我尝试在生产环境中运行时,它都会随着延迟工作日志而死 *** Starting job worker
我正在使用 delayed_job像这样的 gem : Delayed::Job.enqueue Note.new(parameter_hash) 作业由 Heroku 工作人员处理。我需要优先处理一
有没有办法让所有 ActionMailer 交付默认将延迟作业排入队列,而不是同步进行? 最佳答案 子类 ActionMailer并将发送的方法改为使用 delayed_job .现在使用您自己的邮件
我正在尝试让 delay_job 作为 Windows 服务工作。 我彻底厌倦了 Windows,我什至无法用语言表达它,但由于 3rd 方依赖性,我现在坚持使用它。 运行 rake jobs:wor
我想从delayed_job 运行一个rake 任务(apn:notifications:deliver from the apn_on_rails gem)。换句话说,我想排队一个延迟的工作,它将调
我正在开发具有多个 RAILS_Env 的 Rails 应用程序 env_name1: adapter: mysql username: root password: host:
我想使用 DEBUG我们的登台服务器上的 Rails 应用程序的日志记录级别,但我想要 delayed_job (每 10 秒将 SELECT 语句记录到主 Rails 日志中)记录在 INFO级别,
我有一个具有以下内容的部署对象 rake jobs:work命令: apiVersion: extensions/v1beta1 kind: Deployment metadata: name:
所以现在我有一个 delay_job 的实现,它可以在我的本地开发环境中完美运行。为了在我的机器上启动工作程序,我只需运行 rake jobs:work它完美无缺。 为了让delayed_job 在h
我想验证是否调用了延迟作业回调 Hook ,但我不知道如何让 RSpec 来执行此操作,尤其是在涉及多层类时。 假设我有一个这样的 ActiveRecord 模型: class MyJob < Act
我是一名优秀的程序员,十分优秀!