我感兴趣的是有什么步骤可以了解在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
我认为如果至少有一个堆栈跟踪显示,当进程被杀死时,它会非常有用。
发生这种情况时你做了什么/检查了什么?
PS:我不是在寻找我的案例的答案,而是一般的步骤,每个人都可以从中受益。
答案 0 :(得分:9)
我通常首先要弄清楚使用以下代码(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
将此添加到config / boot.rb:
require File.expand_path('../initializers/debug_require', __FILE__)
并设置heroku config:add DEBUG_REQUIRE=1
观察慢速需要的日志输出。
答案 1 :(得分:0)
也许您可以尝试在本地运行以检查发生了什么?您可以使用此帖子上提供的代码来执行此操作: http://ablogaboutcode.com/2012/05/03/benchmark-your-bundle/
正如在Heroku App Boot Timeout讨论中所解释的那样,你应该看一下你需要的宝石数量,并且可能先调整它们。如果您的启动负载超过60秒,您还可以查看此gem: https://github.com/dblock/heroku-forward