我正在尝试在我的开发环境(Ubuntu 14.04)上运行Ruby on Rails应用程序。 rails s
不报告错误,Webrick似乎正常启动:
$ rails s
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2015-04-30 08:52:32] INFO WEBrick 1.3.1
[2015-04-30 08:52:32] INFO ruby 1.9.3 (2014-11-13) [x86_64-linux]
[2015-04-30 08:52:32] INFO WEBrick::HTTPServer#start: pid=15523 port=3000
但是,一旦我尝试通过Web浏览器访问应用程序,Webrick崩溃时出现以下错误:
/home/desousa/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/webrick/server.rb:98: [BUG] Segmentation fault
ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0016 p:---- s:0060 b:0060 l:000059 d:000059 CFUNC :select
c:0015 p:0106 s:0053 b:0053 l:000043 d:000052 BLOCK /home/desousa/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/webrick/server.rb:98
c:0014 p:0007 s:0047 b:0047 l:000046 d:000046 METHOD /home/desousa/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/webrick/server.rb:22
c:0013 p:0063 s:0044 b:0044 l:000043 d:000043 METHOD /home/desousa/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/webrick/server.rb:89
c:0012 p:0118 s:0039 b:0039 l:000038 d:000038 METHOD /home/desousa/.rvm/gems/ruby-1.9.3-p551/gems/rack-1.4.5/lib/rack/handler/webrick.rb:13
c:0011 p:0294 s:0034 b:0034 l:002200 d:002200 METHOD /home/desousa/.rvm/gems/ruby-1.9.3-p551/gems/rack-1.4.5/lib/rack/server.rb:268
c:0010 p:0231 s:0028 b:0028 l:0011a0 d:0011a0 METHOD /home/desousa/.rvm/gems/ruby-1.9.3-p551/gems/railties-3.2.13/lib/rails/commands/server.rb:70
c:0009 p:0063 s:0024 b:0024 l:000015 d:000023 BLOCK /home/desousa/.rvm/gems/ruby-1.9.3-p551/gems/railties-3.2.13/lib/rails/commands.rb:55
c:0008 p:---- s:0021 b:0021 l:000020 d:000020 FINISH
c:0007 p:---- s:0019 b:0019 l:000018 d:000018 CFUNC :tap
c:0006 p:0702 s:0016 b:0016 l:000015 d:000015 TOP /home/desousa/.rvm/gems/ruby-1.9.3-p551/gems/railties-3.2.13/lib/rails/commands.rb:50
c:0005 p:---- s:0012 b:0012 l:000011 d:000011 FINISH
c:0004 p:---- s:0010 b:0010 l:000009 d:000009 CFUNC :require
c:0003 p:0061 s:0006 b:0006 l:0016e8 d:001838 EVAL script/rails:6
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:0016e8 d:0016e8 TOP
-- Ruby level backtrace information ----------------------------------------
script/rails:6:in `<main>'
script/rails:6:in `require'
/home/desousa/.rvm/gems/ruby-1.9.3-p551/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
/home/desousa/.rvm/gems/ruby-1.9.3-p551/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
/home/desousa/.rvm/gems/ruby-1.9.3-p551/gems/railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>'
/home/desousa/.rvm/gems/ruby-1.9.3-p551/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start'
/home/desousa/.rvm/gems/ruby-1.9.3-p551/gems/rack-1.4.5/lib/rack/server.rb:268:in `start'
/home/desousa/.rvm/gems/ruby-1.9.3-p551/gems/rack-1.4.5/lib/rack/handler/webrick.rb:13:in `run'
/home/desousa/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/webrick/server.rb:89:in `start'
/home/desousa/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/webrick/server.rb:22:in `start'
/home/desousa/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/webrick/server.rb:98:in `block in start'
/home/desousa/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/webrick/server.rb:98:in `select'
-- C level backtrace information -------------------------------------------
SEGV received in SEGV handler
Aborted (core dumped)
我在这个项目中使用的软件版本:
$ ruby -v
ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
$ rails -v
Rails 3.2.13
这可能是什么原因?或者我可以了解原因吗?
答案 0 :(得分:1)
我对Webrick也有一些麻烦,导致了一个分裂错误。我只在一个特定的ubuntu盒子上有这个,但我在其他ubuntu盒子上没有相同的错误,具有完全相同的设置。最近我用thin
解决了它。为此,请将此添加到Gemfile
:
gem 'thin'
然后运行
bundle install
rails server