将Thin Server与简单的Rails应用程序一起使用时,日志中出现意外错误

时间:2012-03-02 23:03:09

标签: ruby ruby-on-rails-3 thin

我很擅长在简单的rails应用程序上使用Thin服务器。它运行得很好,除了,当我去应用程序中的任何页面时,我在浏览器上得到的这个中有1个或更少:

Status: 500 Internal Server Error Content-Type: text/html
Application error

Change this error message for exceptions thrown outside of an action (like in Dispatcher         setups or broken Ruby code) in public/500.html

并在日志中:

Processing PlansController#index (for 24.61.84.158 at 2012-03-02 17:53:48) [GET]
  Session ID: 3105294042126eab3c6292d3ba224847
  Parameters: {"controller"=>"plans", "action"=>"index"}
Rendering layoutfalseactionlist within layouts/standard
Rendering plans/list
Completed in 0.18974 (5 reqs/sec) | Rendering: 0.10813 (56%) | DB: 0.03900 (20%) | 200 OK [http://admin.blogbridge.com/]
file /tmp/ruby_sess.5684ebd33a502d9d not readable
/usr/local/rvm/rubies/ruby-1.8.7-p357/lib/ruby/1.8/pstore.rb:100:in `initialize'
/usr/local/rvm/rubies/ruby-1.8.7-p357/lib/ruby/1.8/cgi/session/pstore.rb:61:in `new'
/usr/local/rvm/rubies/ruby-1.8.7-p357/lib/ruby/1.8/cgi/session/pstore.rb:61:in `initialize'
/usr/local/rvm/rubies/ruby-1.8.7-p357/lib/ruby/1.8/cgi/session.rb:280:in `new'
/usr/local/rvm/rubies/ruby-1.8.7-p357/lib/ruby/1.8/cgi/session.rb:280:in `initialize'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/actionpack-1.13.3/lib/action_controller/cgi_process.rb:123:in `new'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/actionpack-1.13.3/lib/action_controller/cgi_process.rb:123:in `session'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/actionpack-1.13.3/lib/action_controller/cgi_process.rb:155:in `stale_session_check!'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/actionpack-1.13.3/lib/action_controller/cgi_process.rb:110:in `session'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/actionpack-1.13.3/lib/action_controller/base.rb:1052:in `assign_shortcuts_without_flash'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/actionpack-1.13.3/lib/action_controller/flash.rb:140:in `assign_shortcuts'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/actionpack-1.13.3/lib/action_controller/base.rb:424:in `process_without_filters'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/actionpack-1.13.3/lib/action_controller/filters.rb:624:in `process_without_session_management_support'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/actionpack-1.13.3/lib/action_controller/session_management.rb:114:in `process'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/actionpack-1.13.3/lib/action_controller/base.rb:330:in `process'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/rails-1.2.3/lib/dispatcher.rb:41:in `dispatch'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/thin-1.3.1/lib/rack/adapter/rails.rb:89:in `call'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/thin-1.3.1/lib/rack/adapter/rails.rb:69:in `call'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/thin-1.3.1/lib/thin/connection.rb:80:in `pre_process'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/thin-1.3.1/lib/thin/connection.rb:78:in `catch'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/thin-1.3.1/lib/thin/connection.rb:78:in `pre_process'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/thin-1.3.1/lib/thin/connection.rb:53:in `process'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/thin-1.3.1/lib/thin/connection.rb:38:in `receive_data'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/thin-1.3.1/lib/thin/backends/base.rb:61:in `start'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/thin-1.3.1/lib/thin/server.rb:159:in `start'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/thin-1.3.1/lib/thin/controllers/controller.rb:86:in `start'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/thin-1.3.1/lib/thin/runner.rb:185:in `send'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/thin-1.3.1/lib/thin/runner.rb:185:in `run_command'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/thin-1.3.1/lib/thin/runner.rb:151:in `run!'
/usr/local/rvm/gems/ruby-1.8.7-p357/gems/thin-1.3.1/bin/thin:6
/usr/local/rvm/gems/ruby-1.8.7-p357/bin/thin:19:in `load'
/usr/local/rvm/gems/ruby-1.8.7-p357/bin/thin:19

有没有人见过这个?

1 个答案:

答案 0 :(得分:1)

对我来说最棒的是rails-1.2.3在你的堆栈中。我相信如果您bundle exec thin您将获得正确版本的rails,但您也可以通过删除所有不依赖于您应用的宝石来强制执行此操作。

虽然rvm非常适合开发,但我不相信它在系统级别安装时会带来很多价值,而且我听说很多人在生产系统(特别是CentOS)上挣扎于获取环境正确运行的用户瘦身。如果您不熟悉rails部署,请考虑使用乘客之类的东西,并且只考虑sudo gem install依赖项。