简体   繁体   English

在Rails控制台中执行Enumerator#next时出现“分段错误”

[英]'Segmentation fault' when executing Enumerator#next in rails console

I am getting error when executing the following code in rails console: 在Rails控制台中执行以下代码时出现错误:

[1,2,3].to_enum.next

Trace: 跟踪:

 (irb):1: [BUG] Segmentation fault
ruby 1.9.2p320 (2012-04-20 revision 35421) [i686-linux]

-- control frame ----------
c:0029 p:---- s:0103 b:0103 l:0003a0 d:0003a0 CFUNC  :next
c:0028 p:0016 s:0100 b:0100 l:001944 d:000099 EVAL   (irb):1
c:0027 p:---- s:0098 b:0098 l:000097 d:000097 FINISH
c:0026 p:---- s:0096 b:0096 l:000095 d:000095 CFUNC  :eval
c:0025 p:0028 s:0089 b:0089 l:000088 d:000088 METHOD /home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb/workspace.rb:80
c:0024 p:0033 s:0082 b:0081 l:000080 d:000080 METHOD /home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb/context.rb:254
c:0023 p:0031 s:0076 b:0076 l:001c94 d:000075 BLOCK  /home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb.rb:159
c:0022 p:0042 s:0068 b:0068 l:000067 d:000067 METHOD /home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb.rb:273
c:0021 p:0011 s:0063 b:0063 l:001c94 d:000062 BLOCK  /home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb.rb:156
c:0020 p:0144 s:0059 b:0059 l:000042 d:000058 BLOCK  /home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb/ruby-lex.rb:243
c:0019 p:---- s:0056 b:0056 l:000055 d:000055 FINISH
c:0018 p:---- s:0054 b:0054 l:000053 d:000053 CFUNC  :loop
c:0017 p:0009 s:0051 b:0051 l:000042 d:000050 BLOCK  /home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb/ruby-lex.rb:229
c:0016 p:---- s:0049 b:0049 l:000048 d:000048 FINISH
c:0015 p:---- s:0047 b:0047 l:000046 d:000046 CFUNC  :catch
c:0014 p:0023 s:0043 b:0043 l:000042 d:000042 METHOD /home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb/ruby-lex.rb:228
c:0013 p:0046 s:0040 b:0040 l:001c94 d:001c94 METHOD /home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb.rb:155
c:0012 p:0011 s:0037 b:0037 l:00155c d:000036 BLOCK  /home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb.rb:70
c:0011 p:---- s:0035 b:0035 l:000034 d:000034 FINISH
c:0010 p:---- s:0033 b:0033 l:000032 d:000032 CFUNC  :catch
c:0009 p:0183 s:0029 b:0029 l:00155c d:00155c METHOD /home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb.rb:69
c:0008 p:0210 s:0024 b:0024 l:001828 d:001828 METHOD /home/pablo/.rvm/gems/ruby-1.9.2-p320@ekobilet/gems/railties-3.0.7/lib/rails/commands/console.rb:44
c:0007 p:0019 s:0020 b:0020 l:000019 d:000019 METHOD /home/pablo/.rvm/gems/ruby-1.9.2-p320@ekobilet/gems/railties-3.0.7/lib/rails/commands/console.rb:8
c:0006 p:0430 s:0016 b:0016 l:000015 d:000015 TOP    /home/pablo/.rvm/gems/ruby-1.9.2-p320@ekobilet/gems/railties-3.0.7/lib/rails/commands.rb:23
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:0013d4 d:001aa4 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:0013d4 d:0013d4 TOP   
---------------------------
-- Ruby level backtrace information ----------------------------------------
script/rails:6:in `<main>'
script/rails:6:in `require'
/home/pablo/.rvm/gems/ruby-1.9.2-p320@ekobilet/gems/railties-3.0.7/lib/rails/commands.rb:23:in `<top (required)>'
/home/pablo/.rvm/gems/ruby-1.9.2-p320@ekobilet/gems/railties-3.0.7/lib/rails/commands/console.rb:8:in `start'
/home/pablo/.rvm/gems/ruby-1.9.2-p320@ekobilet/gems/railties-3.0.7/lib/rails/commands/console.rb:44:in `start'
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb.rb:69:in `start'
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb.rb:69:in `catch'
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb.rb:70:in `block in start'
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb.rb:155:in `eval_input'
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `each_top_level_statement'
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `catch'
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `block in each_top_level_statement'
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `loop'
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb/ruby-lex.rb:243:in `block (2 levels) in each_top_level_statement'
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb.rb:156:in `block in eval_input'
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb.rb:273:in `signal_status'
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb.rb:159:in `block (2 levels) in eval_input'
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb/context.rb:254:in `evaluate'
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
(irb):1:in `irb_binding'
(irb):1:in `next'

-- C level backtrace information -------------------------------------------
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(rb_vm_bugreport+0x78) [0xb76d28e8]
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(+0x55e43) [0xb759ce43]
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(rb_bug+0x33) [0xb759dc53]
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(+0x115d73) [0xb765cd73]
[0xb777940c]
/home/pablo/.rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(+0x221000) [0xb7768000]

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

I am working on ubuntu 12.10 with ruby 1.9.2: 我正在使用Ruby 1.9.2在Ubuntu 12.10上工作:

ruby -v
ruby 1.9.2p320 (2012-04-20 revision 35421) [i686-linux]

Bug is also happening with ruby 1.9.2-p290 but with 1.9.3 it works ok. 在Ruby 1.9.2-p290中也发生了错误,但是在1.9.3下它可以正常工作。 Unfortunatelly i am not able to upgrade ruby version since I am working with legacy rails app: 不幸的是,由于我正在使用旧版Rails应用程序,因此我无法升级ruby版本:

Gemfile: 的Gemfile:

source 'http://rubygems.org'

gem 'unicorn', '4.0.1'
gem 'rails', '3.0.7'
gem 'rake', '~> 0.8.7'
gem 'mongrel', '1.2.0.pre2'
gem 'mysql2', '~> 0.2.18', :require => 'mysql2'
gem 'attribute_normalizer', '~> 0.3.1'
gem 'cubus-settingslogic', '~> 2.2.0', :require => 'settingslogic'
gem "bcrypt-ruby", :require => "bcrypt"
gem 'sinatra', '1.1.3'
gem 'tilt', '1.2.2'
gem 'rest-client', '~> 1.6.1'
gem 'resque', '~> 1.17.0', :require => "resque/server"
gem 'faraday', '0.5.7'
gem 'httparty', '0.7.8'
gem 'resque_mailer', '~> 1.0.0'
gem 'omniauth', '0.2.0'
gem 'pdfkit', '~> 0.5.2'
gem 'exception_notification', :require => 'exception_notifier'
gem 'whenever', '~> 0.6.2', :require => false
gem 'meta_search'
gem 'kaminari'
gem 'mini_magick', '~> 3.2'
gem 'carrierwave', '~> 0.5.1'
gem 'carrierwave_backgrounder', '0.0.6'
gem 'fgraph', '0.6.0'
gem 'hirb'
gem 'resque-retry'
gem 'event-calendar', '~> 2.3.3', :require => 'event_calendar'
gem 'activerecord-import', '~> 0.2.11'
gem 'oink'
gem "truncate_html", "~> 0.9.1"

group :development, :test do
  gem 'rspec-rails', '~> 2.6.1'
  gem 'active_reload'
  gem "parallel_tests"
  gem 'fuubar'
  gem 'awesome_print'
end

group :production do
  gem 'newrelic_rpm'
end

group :development do
  gem 'lol_dba'
  gem 'request-log-analyzer'
  gem 'query_reviewer'
  gem 'meta_request'
  gem 'better_errors'
end

group :test do
  gem 'simplecov', '>= 0.4.0', :require => false
  gem 'factory_girl_rails', '~> 1.4.0'
  gem "factory_girl", "~> 2.3.0"
  gem 'selenium-webdriver', '~> 2.21.1'
  gem 'capybara', '1.0.1'
  gem 'guard-rspec', '~> 0.4.0'
  gem 'rb-fsevent', :git => 'git://github.com/ttilley/rb-fsevent.git', :branch => 'pre-compiled-gem-one-off'
  gem 'escape_utils', '~> 0.2.3'
  gem 'launchy', '~> 2.0.5'
  gem "database_cleaner", "~> 0.9.0"
  gem 'timecop', '~> 0.3.5'
  gem 'resque_spec'
  gem 'vcr', '~> 1.11.3'
  gem 'webmock', '~> 1.7.8'
  gem 'shoulda-matchers', '~> 1.2.0'
  gem 'rr'
 end

I have tried reinstalling ruby version couple of times and it does not help. 我尝试几次重新安装ruby版本,但没有帮助。

Any help would be great appreciated! 任何帮助将不胜感激!

I don't see an issue for this reported against Ubuntu, but I do see one for OS X Lion . 我没有看到针对Ubuntu的此问题,但是我确实看到了针对OS X Lion的问题 You might consider figuring out where exactly to report the issue against 1.9.2 and try to see if anyone in the community there can give you more guidance on how to get a bug report (a) verified as an actual bug and not caused by something else, and (b) where and how to file the bug if it does get verified. 您可能会考虑找出针对1.9.2的问题报告的确切位置,并尝试查看那里的社区中是否有人可以为您提供更多指导,以获取如何将错误报告(a)验证为实际错误而不是由某种原因引起否则,以及(b)如果确实通过了验证,则在哪里以及如何提交该错误。

I don't believe you're supposed to create issues directly in the backport page, but at least for reference here are the list of issues on the 1.9.2 backport list. 我不认为您应该直接在backport页面中创建问题,但至少在这里供参考,是1.9.2 backport列表中的问题列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM