乘客在UnknownHttpMethod异常上死亡

时间:2011-05-04 22:41:38

标签: ruby ruby-on-rails-3 apache2 passenger

更新我尝试在我的应用程序控制器中捕获此异常,但无济于事。我还将Passenger更新为3.0.7,并向他们的跟踪器提交了一个问题。


我有一个运行在FreeBSD 8.2上的Rails 3.0.4应用程序,其中Apache 2.2.17,Passenger 3.0.2和Ruby 1.9.2-p180每隔一天就会死掉。这是错误日志中的回溯:

    [ pid=85853 thr=17189069660 file=utils.rb:176 time=2011-05-04 12:08:13.022 ]: 
*** Exception ActionController::UnknownHttpMethod in application
(U<F9>i<CA>,fs<C8>6<F6><C0>b<F2><C5>hVj<BE><D9>#<F5><80><99><EA>=n, 
accepted HTTP methods are OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT, 
PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK, VERSION-CONTROL, REPORT, CHECKOUT,
CHECKIN, UNCHECKOUT, MKWORKSPACE, UPDATE, LABEL, MERGE, BASELINE-CONTROL, MKACTIVITY,
ORDERPATCH, ACL, SEARCH, and PATCH) (process 85853, thread #<Thread:0x0000080118c6b8>):
            from /usr/local/docs/arc/shared/bundle/ruby/1.9.1/gems/actionpack-3.0.4/lib/action_dispatch/http/request.rb:76:in `request_method'
            from /usr/local/docs/arc/shared/bundle/ruby/1.9.1/gems/railties-3.0.4/lib/rails/rack/logger.rb:24:in `before_dispatch'
            from /usr/local/docs/arc/shared/bundle/ruby/1.9.1/gems/railties-3.0.4/lib/rails/rack/logger.rb:12:in `call'
            from /usr/local/docs/arc/shared/bundle/ruby/1.9.1/gems/rack-1.2.1/lib/rack/runtime.rb:17:in `call'
            from /usr/local/docs/arc/shared/bundle/ruby/1.9.1/gems/rack-1.2.1/lib/rack/lock.rb:11:in `block in call'
            from <internal:prelude>:10:in `synchronize'
            from /usr/local/docs/arc/shared/bundle/ruby/1.9.1/gems/rack-1.2.1/lib/rack/lock.rb:11:in `call'
            from /usr/local/docs/arc/shared/bundle/ruby/1.9.1/gems/railties-3.0.4/lib/rails/application.rb:168:in `call'
            from /usr/local/docs/arc/shared/bundle/ruby/1.9.1/gems/railties-3.0.4/lib/rails/application.rb:77:in `method_missing'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/rack/application_spawner.rb:205:in `start_request_handler'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/rack/application_spawner.rb:170:in `block in handle_spawn_application'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/utils.rb:479:in `safe_fork'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/rack/application_spawner.rb:165:in `handle_spawn_application'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/abstract_server.rb:180:in `start'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/rack/application_spawner.rb:128:in `start'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
            from <internal:prelude>:10:in `synchronize'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
            from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/helper-scripts/passenger-spawn-server:99:in `<main>'
    [Wed May 04 12:08:13 2011] [notice] child pid 1567 exit signal Bus error (10)
    [Wed May 04 12:08:16 2011] [notice] child pid 1195 exit signal Bus error (10)
    [Wed May 04 12:08:20 2011] [notice] child pid 1600 exit signal Bus error (10)
    [Wed May 04 12:08:20 2011] [notice] child pid 1590 exit signal Bus error (10)
    [Wed May 04 12:08:21 2011] [notice] child pid 1199 exit signal Bus error (10)
    [Wed May 04 12:08:21 2011] [notice] child pid 726 exit signal Bus error (10)...etc...

一旦发生这种情况,应用程序就会停止运行。 Apache仍在公共目录中提供静态文件,但没有应用程序。当然,http动词应该关注我的gobbledygook(并且无法通过google跟踪),但是在application_controller中拯救这个异常实际上会阻止乘客死亡吗?有人见过这个吗?

1 个答案:

答案 0 :(得分:0)

说实话,看起来你的应用程序服务器(fastcgi或apache moduel?)在收到非法的HTTP动词时非常不合适。

我完全希望您可以在网站的apache配置中对此进行过滤(无论是/ etc / apache2 / site-available / ...还是虚拟文件夹中的.htaccess(mod_access)

但是,我认为只是将跟踪报告给Passenger开发人员是一个错误。信息就在跟踪

 U<F9>i<CA>,fs<C8>6<F6><C0>b<F2><C5>hVj<BE><D9>#<F5><80><99><EA>=n

不是有效的动词。在网络服务器的端口80上使用netcat重现(记住主机头)

可能很简单