hak*_*nin 2 ruby-on-rails heroku
我感兴趣的是有什么步骤可以了解在60秒内发生的事情是什么阻止了发射和通常的原因.
这就是日志文件的外观(不知道实际上是什么)
2013-01-14T10:34:17+00:00 app[web.1]: => Booting Thin
2013-01-14T10:34:17+00:00 app[web.1]: => Call with -d to detach
2013-01-14T10:34:17+00:00 app[web.1]: => Rails 3.2.2 application starting in production on http://0.0.0.0:52216
2013-01-14T10:34:17+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-01-14T10:34:23+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2013-01-14T10:34:23+00:00 heroku[web.1]: Stopping process with SIGKILL
2013-01-14T10:34:24+00:00 heroku[web.1]: Process exited with status 137
2013-01-14T10:34:24+00:00 heroku[web.1]: State changed from starting to crashed
Run Code Online (Sandbox Code Playgroud)
我想如果至少有一个堆栈跟踪显示,当进程被杀死时,它会非常有用.
发生这种情况时你做了什么/检查了什么?
PS:我不是在寻找我的案例的答案,而是一般的步骤,每个人都可以从中受益.
我通常首先通过以下代码(initializers/debug_require.rb)确定宝石花了很长时间:
if ENV['DEBUG_REQUIRE']
require 'benchmark'
def require(file)
@@first ||= Time.now
rc = false
ts = Benchmark.measure do
rc = super
end
if ENV['DEBUG_REQUIRE'].to_f < ts.total
total = ts.format("%t require #{file}")
from_start = (Time.now - @@first).to_i
$stdout.puts "#{total} (#{from_start} second(s) from start)"
end
rc
end
end
Run Code Online (Sandbox Code Playgroud)
将其添加到config/boot.rb:
require File.expand_path('../initializers/debug_require', __FILE__)
Run Code Online (Sandbox Code Playgroud)
并设置 heroku config:add DEBUG_REQUIRE=1
观察日志输出是否需要缓慢.
| 归档时间: |
|
| 查看次数: |
2740 次 |
| 最近记录: |