从乘客迁移到独角兽后,我在分期时遇到了一个奇怪的问题。
我为开发和登台环境配置了独角兽。它在开发中工作,但不在分期中。在开发中,它监听 8080,而在上演它监听 unix 套接字时。这会有什么不同吗?特别是在生产环境中?
这就是我在暂存中运行它时发生的情况
- 启动时几乎占用 100% CPU
- 有时它会安定下来,我可以使用它
- *但大多数时候它挂起**,我不得不杀了它。
我已记录有关此问题的问题,请单击此处
这就是我在 unicorn.stderr.log 中看到的
I, [2011-08-26T09:02:53.324286 #5026] INFO -- : unlinking existing socket=/home/krishnaprasad/project_name/tmp/sockets/unicorn.sock
I, [2011-08-26T09:02:53.324502 #5026] INFO -- : listening on addr=/home/krishnaprasad/project_name/tmp/sockets/unicorn.sock fd=3
I, [2011-08-26T09:02:53.324860 #5026] INFO -- : Refreshing Gem list
为什么它会尝试刷新宝石?有没有办法在配置文件中避免它?
这就是我在 config/unicorn_staging.rb 中所拥有的
# unicorn_rails -c /config/unicorn_staging.rb -E staging -D
rails_env = 'staging'
working_directory "/home/krishnaprasad/Projects/project_name"
worker_processes 1
preload_app true
timeout 90
rails_root = "/home/krishnaprasad/Projects/project_name"
listen "#{rails_root}/tmp/sockets/unicorn.sock", :backlog => 2048
pid "#{rails_root}/tmp/pids/unicorn.pid"
stderr_path "#{rails_root}/log/unicorn.log"
stdout_path "#{rails_root}/log/unicorn.log"
GC.copy_on_write_friendly = true if GC.respond_to?(:copy_on_write_friendly=)
before_fork do |server, worker|
ActiveRecord::Base.connection.disconnect!
old_pid = "#{Rails.root}/tmp/pids/unicorn.pid.oldbin"
if File.exists?(old_pid) && server.pid != old_pid
begin
Process.kill("QUIT", File.read(old_pid).to_i)
rescue Errno::ENOENT, Errno::ESRCH
# someone else did our job for us
end
end
end
after_fork do |server, worker|
ActiveRecord::Base.establish_connection
end
任何帮助高度赞赏。提前致谢