2014-11-04 60 views
3

我想在AWS盒子上設置一個獨角獸,但工人只是保持超時,我不知道爲什麼。AWS盒子上的獨角獸工作者超時

我正在使用Ubuntu Server 14.04 LTS AMI,安裝標準Ruby on Rails安裝所需的一切。使用新的rails,我生成一個空的應用程序,試圖訪問它第一次似乎是快速的,但之後,工人只是超時連續,並永遠服務於網頁。加載標準的WEBrick服務器沒有這個問題,並且幾乎立即加載頁面。我試着回滾幾個版本的紅寶石和獨角獸,但沒有運氣。此行爲不會在虛擬機本地發生。

這裏是服務器的日誌在調試模式

 

    I, [2014-11-04T18:30:13.290599 #17134] INFO -- : listening on addr=0.0.0.0:5000 fd=10 
    I, [2014-11-04T18:30:13.362993 #17134] INFO -- : master process ready 
    I, [2014-11-04T18:30:13.363098 #17137] INFO -- : worker=0 ready 
    I, [2014-11-04T18:30:13.365175 #17140] INFO -- : worker=1 ready 
    I, [2014-11-04T18:30:13.365314 #17142] INFO -- : worker=2 ready 
    Exception 'LoadError' at /var/lib/gems/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:443 - cannot load such file -- rails/application_helper.rb 
    Exception 'LoadError' at /var/lib/gems/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:352 - cannot load such file -- rails/application_helper.rb 
    Exception 'LoadError' at /var/lib/gems/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:313 - No such file to load -- rails/application_helper 
    Exception 'AbstractController::Helpers::MissingHelperError' at /var/lib/gems/2.1.0/gems/actionpack-4.1.7/lib/abstract_controller/helpers.rb:154 - Missing helper file helpers/rails/application_helper.rb 
    Exception 'LoadError' at /var/lib/gems/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:443 - cannot load such file -- rails/welcome_helper.rb 
    Exception 'LoadError' at /var/lib/gems/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:352 - cannot load such file -- rails/welcome_helper.rb 
    Exception 'LoadError' at /var/lib/gems/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:313 - No such file to load -- rails/welcome_helper 
    Exception 'AbstractController::Helpers::MissingHelperError' at /var/lib/gems/2.1.0/gems/actionpack-4.1.7/lib/abstract_controller/helpers.rb:154 - Missing helper file helpers/rails/welcome_helper.rb 
    **** - - [04/Nov/2014 18:30:13] "GET/HTTP/1.1" 200 - 0.0693 
    **** - - [04/Nov/2014 18:30:14] "GET %2Ffavicon.ico HTTP/1.1" 304 - 0.0441 
    E, [2014-11-04T18:30:45.395879 #17134] ERROR -- : worker=0 PID:17137 timeout (31s > 30s), killing 
    E, [2014-11-04T18:30:45.395995 #17134] ERROR -- : worker=1 PID:17140 timeout (31s > 30s), killing 
    E, [2014-11-04T18:30:45.396072 #17134] ERROR -- : worker=2 PID:17142 timeout (31s > 30s), killing 
    E, [2014-11-04T18:30:45.397748 #17134] ERROR -- : reaped # worker=2 
    E, [2014-11-04T18:30:45.397882 #17134] ERROR -- : worker=0 PID:17137 timeout (31s > 30s), killing 
    E, [2014-11-04T18:30:45.397990 #17134] ERROR -- : worker=1 PID:17140 timeout (31s > 30s), killing 
    E, [2014-11-04T18:30:45.401016 #17134] ERROR -- : reaped # worker=1 
    E, [2014-11-04T18:30:45.401177 #17134] ERROR -- : worker=0 PID:17137 timeout (31s > 30s), killing 
    I, [2014-11-04T18:30:45.402352 #17148] INFO -- : worker=2 ready 
    E, [2014-11-04T18:30:45.403784 #17134] ERROR -- : reaped # worker=0 
    I, [2014-11-04T18:30:45.405625 #17152] INFO -- : worker=1 ready 
    I, [2014-11-04T18:30:45.406871 #17155] INFO -- : worker=0 ready 
    Exception `EOFError' at /var/lib/gems/2.1.0/gems/unicorn-4.8.1/lib/unicorn/http_request.rb:79 - end of file reached 
    Exception `EOFError' at /var/lib/gems/2.1.0/gems/unicorn-4.8.1/lib/unicorn/http_request.rb:79 - end of file reached 
    Exception `EOFError' at /var/lib/gems/2.1.0/gems/unicorn-4.8.1/lib/unicorn/http_request.rb:79 - end of file reached 
    Exception `EOFError' at /var/lib/gems/2.1.0/gems/unicorn-4.8.1/lib/unicorn/http_request.rb:79 - end of file reached 
    Exception `EOFError' at /var/lib/gems/2.1.0/gems/unicorn-4.8.1/lib/unicorn/http_request.rb:79 - end of file reached 
    Exception `EOFError' at /var/lib/gems/2.1.0/gems/unicorn-4.8.1/lib/unicorn/http_request.rb:79 - end of file reached 
    Exception `EOFError' at /var/lib/gems/2.1.0/gems/unicorn-4.8.1/lib/unicorn/http_request.rb:79 - end of file reached 
    Exception `EOFError' at /var/lib/gems/2.1.0/gems/unicorn-4.8.1/lib/unicorn/http_request.rb:79 - end of file reached 
    Exception `LoadError' at /var/lib/gems/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:443 - cannot load such file -- rails/application_helper.rb 
    Exception `LoadError' at /var/lib/gems/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:352 - cannot load such file -- rails/application_helper.rb 
    Exception `LoadError' at /var/lib/gems/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:313 - No such file to load -- rails/application_helper 
    Exception `AbstractController::Helpers::MissingHelperError' at /var/lib/gems/2.1.0/gems/actionpack-4.1.7/lib/abstract_controller/helpers.rb:154 - Missing helper file helpers/rails/application_helper.rb 
    Exception `LoadError' at /var/lib/gems/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:443 - cannot load such file -- rails/welcome_helper.rb 
    Exception `LoadError' at /var/lib/gems/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:352 - cannot load such file -- rails/welcome_helper.rb 
    Exception `LoadError' at /var/lib/gems/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:313 - No such file to load -- rails/welcome_helper 
    Exception `AbstractController::Helpers::MissingHelperError' at /var/lib/gems/2.1.0/gems/actionpack-4.1.7/lib/abstract_controller/helpers.rb:154 - Missing helper file helpers/rails/welcome_helper.rb 
    **** - - [04/Nov/2014 18:31:14] "GET/HTTP/1.1" 200 - 0.0680 
    Exception 'EOFError' at /var/lib/gems/2.1.0/gems/unicorn-4.8.1/lib/unicorn/http_request.rb:79 - end of file reached 
    Exception 'EOFError' at /var/lib/gems/2.1.0/gems/unicorn-4.8.1/lib/unicorn/http_request.rb:79 - end of file reached 
    E, [2014-11-04T18:31:45.465765 #17134] ERROR -- : worker=2 PID:17148 timeout (31s > 30s), killing 
    E, [2014-11-04T18:31:45.468770 #17134] ERROR -- : reaped # worker=2 
    I, [2014-11-04T18:31:45.472177 #17162] INFO -- : worker=2 ready 
    E, [2014-11-04T18:31:49.474506 #17134] ERROR -- : worker=1 PID:17152 timeout (31s > 30s), killing 
    E, [2014-11-04T18:31:49.474633 #17134] ERROR -- : worker=0 PID:17155 timeout (31s > 30s), killing 
    E, [2014-11-04T18:31:49.476313 #17134] ERROR -- : reaped # worker=1 
    E, [2014-11-04T18:31:49.476451 #17134] ERROR -- : worker=0 PID:17155 timeout (31s > 30s), killing 
    I, [2014-11-04T18:31:49.481324 #17166] INFO -- : worker=1 ready 
    E, [2014-11-04T18:31:49.481548 #17134] ERROR -- : reaped # worker=0 
    I, [2014-11-04T18:31:49.484368 #17169] INFO -- : worker=0 ready 
    E, [2014-11-04T18:32:17.511012 #17134] ERROR -- : worker=2 PID:17162 timeout (31s > 30s), killing 
    E, [2014-11-04T18:32:17.512733 #17134] ERROR -- : reaped # worker=2 
    I, [2014-11-04T18:32:17.516074 #17174] INFO -- : worker=2 ready 
    E, [2014-11-04T18:32:21.518316 #17134] ERROR -- : worker=0 PID:17169 timeout (31s > 30s), killing 
    E, [2014-11-04T18:32:21.520011 #17134] ERROR -- : reaped # worker=0 
    I, [2014-11-04T18:32:21.523230 #17177] INFO -- : worker=0 ready 

運行這裏是麒麟配置文件

 
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3) 
timeout 30 
preload_app true 

before_fork do |server, worker| 
    Signal.trap 'TERM' do 
    puts 'Unicorn master intercepting TERM and sending myself QUIT instead' 
    Process.kill 'QUIT', Process.pid 
    end 

    defined?(ActiveRecord::Base) and 
    ActiveRecord::Base.connection.disconnect! 
end 

after_fork do |server, worker| 
    Signal.trap 'TERM' do 
    puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT' 
    end 

    defined?(ActiveRecord::Base) and 
    ActiveRecord::Base.establish_connection 
end 

我也注意到了EOF錯誤,並懷疑這可能是相關的到暫停,但我不知道肯定。

Exception `EOFError' at /var/lib/gems/2.1.0/gems/unicorn-4.8.1/lib/unicorn/http_request.rb:79 - end of file reached
+0

超時是針對請求的;看起來你正在用一個從未完成的請求擊中獨角獸工作者。這個問題似乎並非與獨角獸本身有關。 – 2014-11-04 19:15:47

回答

0

因此,問題似乎是我私下運行AWS實例(沒有公共IP),然後連接到Load Balancer。刪除負載平衡器並直接訪問實例可以解決工作人員超時的問題,並且不會導致性能下降。