1

Heroku-forward 为我们的应用程序运行良好!唯一的问题是在重新启动 app/dynos 时,我们在日志中看到了这个错误:

2013-06-09T22:21:19.293142+00:00 heroku[web.1]: Starting process with command `bundle exec unicorn -p 41124 -c ./config/unicorn.rb`
2013-06-09T22:21:19.831067+00:00 app[web.1]: Unicorn master intercepting TERM and sending myself QUIT instead
2013-06-09T22:21:19.839532+00:00 app[web.1]: Terminating ProxyServer
2013-06-09T22:21:19.841418+00:00 app[web.1]: Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT
2013-06-09T22:21:19.876112+00:00 app[web.1]: Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT
2013-06-09T22:21:19.951354+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:129:in `to_app': missing run or map statement (RuntimeError)
2013-06-09T22:21:19.951354+00:00 app[web.1]:    from config.ru:1:in `<main>'
2013-06-09T22:21:19.951354+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn.rb:44:in `eval'
2013-06-09T22:21:19.951354+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn.rb:44:in `block in builder'
2013-06-09T22:21:19.951354+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:722:in `call'
2013-06-09T22:21:19.951354+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:722:in `build_app!'
2013-06-09T22:21:19.951354+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:140:in `start'
2013-06-09T22:21:19.951354+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/bin/unicorn:126:in `<top (required)>'
2013-06-09T22:21:19.951354+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/bin/unicorn:19:in `load'
2013-06-09T22:21:19.951354+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/bin/unicorn:19:in `<main>'
2013-06-09T22:21:22.853675+00:00 app[web.1]: I, [2013-06-09T22:21:22.853347 #2]  INFO -- : Refreshing Gem list
2013-06-09T22:21:23.509927+00:00 heroku[web.1]: State changed from starting to up
2013-06-09T22:21:23.881194+00:00 heroku[web.1]: Process exited with status 1
2013-06-09T22:22:38.222124+00:00 app[web.1]: I, [2013-06-09T22:22:38.221884 #5]  INFO -- : listening on addr=/tmp/unicorn-20130609-2-130wmqw.sock fd=8
2013-06-09T22:22:38.301586+00:00 app[web.1]: I, [2013-06-09T22:22:38.301333 #5]  INFO -- : master process ready
2013-06-09T22:22:38.718708+00:00 app[web.1]: I, [2013-06-09T22:22:38.718418 #13]  INFO -- : worker=2 ready
2013-06-09T22:22:38.795721+00:00 app[web.1]: I, [2013-06-09T22:22:38.795417 #7]  INFO -- : worker=0 ready
2013-06-09T22:22:38.813390+00:00 app[web.1]: I, [2013-06-09T22:22:38.813064 #10]  INFO -- : worker=1 ready

不过,这似乎不是灾难性的——正如您在最后看到的那样,测功机确实启动得非常快,并且代理最终工作正常(大约一分钟后......要加载很多宝石)。错误信息只是有点令人担忧。有人见过这个吗?

更新:

根据 Heroku-forward 自述文件,这是我们的机架文件:

# my_app.ru
require ::File.expand_path('../config/environment',  __FILE__)
run MyApp::Application

# config.ru
require 'rubygems'
require 'bundler'

$stdout.sync = true
Bundler.require(:rack)

port = (ARGV.first || ENV['PORT'] || 3000).to_i
env = ENV['RACK_ENV'] || 'development'

require 'em-proxy'
require 'logger'
require 'heroku-forward'
require 'heroku/forward/backends/unicorn'

application = File.expand_path('../my_app.ru', __FILE__)
config_file = File.expand_path('../config/unicorn.rb', __FILE__)
backend = Heroku::Forward::Backends::Unicorn.new(application: application, env: env, config_file: config_file)
proxy = Heroku::Forward::Proxy::Server.new(backend, host: '0.0.0.0', port: port)
proxy.forward!
4

1 回答 1

0

这个问题可能不会发生在新测功机的启动中:它更有可能发生在旧测功机的关闭中。当 Rack 配置文件实际上并没有运行应用程序(config.ru应该以to_app调用结束)时看到类似的问题。您是否使用自定义config.ru文件?

于 2013-06-10T01:06:06.930 回答