3

从瘦身到独角兽。Unicorn 在我的开发机器(Mac OSX)上运行良好,但在 Heroku 上失败,并一遍又一遍地显示以下消息(不同的 PID,0 到 2 之间的不同工人编号)reaped #<Process::Status: pid 564 exit 1> worker=0。日志中没有其他消息表明问题所在。此消息表示什么以及如何对其进行故障排除?

Procfile:
  web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb

Unicorn.rb:
  worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
  timeout 15
  preload_app true

  before_fork do |server, worker|

    Signal.trap 'TERM' do
      puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
      Process.kill 'QUIT', Process.pid
    end

    defined?(ActiveRecord::Base) and
      ActiveRecord::Base.connection.disconnect!
  end  

  after_fork do |server, worker|

    Signal.trap 'TERM' do
      puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT'
    end

    defined?(ActiveRecord::Base) and
      ActiveRecord::Base.establish_connection
  end
4

1 回答 1

0

这是一个很晚的回复,如果仍然打开,您可以尝试以下方法吗,请确保在 Heroku 上正确设置了 `RAILS_ENV1

 web: bundle exec unicorn -p $PORT -E $RAILS_ENV -c ./config/unicorn.rb
于 2014-02-06T18:48:26.567 回答