2015-07-21 63 views
0

我的Rails服務器在某些請求中反覆崩潰,我無法在其執行條件下進行復制。這是最近一次的日誌條目。Ruby on Rails URI :: InvalidComponentError不斷崩潰服務器

I, [2015-07-21T12:10:45.080631 #28576] INFO -- : Started GET "/" for 209.126.230.71 at 2015-07-21 12:10:45 -0400 
F, [2015-07-21T12:10:45.087452 #28576] FATAL -- : 
URI::InvalidComponentError (bad component(expected host component): localhost:): 
    /home/admin/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/uri/generic.rb:593:in `check_host' 
    /home/admin/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/uri/generic.rb:634:in `host=' 
    actionpack (4.2.1) lib/action_dispatch/routing/redirection.rb:37:in `serve' 
    actionpack (4.2.1) lib/action_dispatch/routing/redirection.rb:21:in `call' 
    actionpack (4.2.1) lib/action_dispatch/routing/mapper.rb:51:in `serve' 
    actionpack (4.2.1) lib/action_dispatch/journey/router.rb:43:in `block in serve' 
    actionpack (4.2.1) lib/action_dispatch/journey/router.rb:30:in `each' 
    actionpack (4.2.1) lib/action_dispatch/journey/router.rb:30:in `serve' 
    actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:819:in `call' 
    rack (1.6.1) lib/rack/etag.rb:24:in `call' 
    rack (1.6.1) lib/rack/conditionalget.rb:25:in `call' 
    rack (1.6.1) lib/rack/head.rb:13:in `call' 
    actionpack (4.2.1) lib/action_dispatch/middleware/params_parser.rb:27:in `call' 
    actionpack (4.2.1) lib/action_dispatch/middleware/flash.rb:260:in `call' 
    rack (1.6.1) lib/rack/session/abstract/id.rb:225:in `context' 
    rack (1.6.1) lib/rack/session/abstract/id.rb:220:in `call' 
    actionpack (4.2.1) lib/action_dispatch/middleware/cookies.rb:560:in `call' 
    activerecord (4.2.1) lib/active_record/query_cache.rb:36:in `call' 
    activerecord (4.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:649:in `call' 
    actionpack (4.2.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' 
    activesupport (4.2.1) lib/active_support/callbacks.rb:88:in `call' 
    activesupport (4.2.1) lib/active_support/callbacks.rb:88:in `_run_callbacks' 
    activesupport (4.2.1) lib/active_support/callbacks.rb:776:in `_run_call_callbacks' 
    activesupport (4.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks' 
    actionpack (4.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call' 
    actionpack (4.2.1) lib/action_dispatch/middleware/remote_ip.rb:78:in `call' 
    actionpack (4.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' 
    actionpack (4.2.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' 
    railties (4.2.1) lib/rails/rack/logger.rb:38:in `call_app' 
    railties (4.2.1) lib/rails/rack/logger.rb:20:in `block in call' 
    activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `block in tagged' 
    activesupport (4.2.1) lib/active_support/tagged_logging.rb:26:in `tagged' 
    activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `tagged' 
    railties (4.2.1) lib/rails/rack/logger.rb:20:in `call' 
    actionpack (4.2.1) lib/action_dispatch/middleware/request_id.rb:21:in `call' 
    rack (1.6.1) lib/rack/methodoverride.rb:22:in `call' 
    rack (1.6.1) lib/rack/runtime.rb:18:in `call' 
    activesupport (4.2.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call' 
    actionpack (4.2.1) lib/action_dispatch/middleware/static.rb:113:in `call' 
    rack (1.6.1) lib/rack/sendfile.rb:113:in `call' 
    railties (4.2.1) lib/rails/engine.rb:518:in `call' 
    railties (4.2.1) lib/rails/application.rb:164:in `call' 
    thin (1.6.3) lib/thin/connection.rb:86:in `block in pre_process' 
    thin (1.6.3) lib/thin/connection.rb:84:in `catch' 
    thin (1.6.3) lib/thin/connection.rb:84:in `pre_process' 
    thin (1.6.3) lib/thin/connection.rb:53:in `process' 
    thin (1.6.3) lib/thin/connection.rb:39:in `receive_data' 
    eventmachine (1.0.7) lib/eventmachine.rb:187:in `run_machine' 
    eventmachine (1.0.7) lib/eventmachine.rb:187:in `run' 
    thin (1.6.3) lib/thin/backends/base.rb:73:in `start' 
    thin (1.6.3) lib/thin/server.rb:162:in `start' 
    thin (1.6.3) lib/thin/controllers/controller.rb:87:in `start' 
    thin (1.6.3) lib/thin/runner.rb:200:in `run_command' 
    thin (1.6.3) lib/thin/runner.rb:156:in `run!' 
    thin (1.6.3) bin/thin:6:in `<top (required)>' 
    /home/admin/.rvm/gems/[email protected]_sprint/bin/thin:23:in `load' 
    /home/admin/.rvm/gems/[email protected]_sprint/bin/thin:23:in `<main>' 
    /home/admin/.rvm/gems/[email protected]_sprint/bin/ruby_executable_hooks:15:in `eval' 
    /home/admin/.rvm/gems/[email protected]_sprint/bin/ruby_executable_hooks:15:in `<main>' 

我不知道是什麼原因造成的。絕大多數請求不會造成問題。

production.rb:

Rails.application.configure do 

    config.cache_classes = true 

    config.consider_all_requests_local  = false 
    config.action_controller.perform_caching = true 

    config.serve_static_files = true # ENV['RAILS_SERVE_STATIC_FILES'].present? 

    config.assets.js_compressor = :uglifier 
    config.assets.digest = true 

    config.log_level = :debug 
    config.i18n.fallbacks = true 

    config.active_support.deprecation = :notify 

    config.log_formatter = ::Logger::Formatter.new 

    config.active_record.dump_schema_after_migration = false 
+0

您可以編輯幷包含您的development.rb的代碼 – nextstep

+0

這是在生產模式下添加它。 – PoolOfPeas

回答

0

在項目中只是找到(用你喜歡的IDE)localhost:host應該只是主機,而不是最後帶有:的主機。