乘客因 UnknownHttpMethod 异常而死亡
更新 我尝试在我的应用程序控制器中捕获此异常,但无济于事。我还将 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 动词应该出现的官样文章让我担心(并且无法通过谷歌追踪),但是在 application_controller 中拯救这个异常真的会阻止乘客死亡吗?有人以前见过这个吗?
Update I tried catching this exception in my application controller, but to no avail. I've also updated Passenger to 3.0.7 and submitted an issue to their tracker.
I have a Rails 3.0.4 application running on FreeBSD 8.2 with Apache 2.2.17, Passenger 3.0.2 and Ruby 1.9.2-p180 that's been dying every other day. Here's the backtrace from the error log:
[ 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...
Once this happens, the application goes down. Apache still serves up static files in the public directory, but no application. Of course the gobbledygook where the http verb should be concerns me (and makes it impossible to track down via google), but will rescuing this exception in the application_controller actually prevent passenger from dying? Anyone seen this before?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
老实说,当收到非法 HTTP 动词时,您的应用程序服务器(fastcgi 或 apache moduel?)看起来非常不优雅地死亡。
我完全希望您可以在站点的 apache 配置中过滤此内容(无论是 /etc/apache2/site-available/... 或虚拟文件夹中的 .htaccess (mod_access)
但是,我认为仅报告是明智的对乘客开发人员的跟踪是一个错误。跟踪中的信息
不是有效的动词,在网络服务器的端口 80 上使用 netcat 进行重现可能很简单(记住主机标头)。
To be perfectly honest, it looks like your application server (fastcgi or apache moduel?) is dieing quite ungracefully when an illegal HTTP verb is received.
I fully expect that you can filter this in the apache config for the site (be it /etc/apache2/site-available/... or .htaccess in your virtual folder (mod_access)
However, I think it is sane to just report the trace to the Passenger devs as a bug. The info is right there in the trace
is not a valid verb. It could be trivial to reproduce using netcat on port 80 of your webserver (remember the Host header)