Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 代理服务器终止时Heroku转发错误_Ruby On Rails_Heroku - Fatal编程技术网

Ruby on rails 代理服务器终止时Heroku转发错误

Ruby on rails 代理服务器终止时Heroku转发错误,ruby-on-rails,heroku,Ruby On Rails,Heroku,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 mas

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


这个问题可能不会发生在新dyno的启动阶段:更可能发生在旧dyno的关闭阶段。当机架配置文件未实际运行应用程序时出现类似问题(
config.ru
应以
to_app
调用结束)。您正在使用自定义的
config.ru
文件吗?

Odd:看起来不错。在my_app.ru中尝试使用
运行Rails::application
?查看此提交,这可能有助于:
# 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!