Bug #2410

segfault when processing post in Ruby on Rails

Added by Sam Ruby about 2 years ago. Updated 9 months ago.

[ruby-core:26934]
Status:Closed Start date:11/29/2009
Priority:High Due date:
Assignee:- % Done:

100%

Category:core
Target version:-
ruby -v:ruby 1.9.2dev (2009-11-28 trunk 25955) [x86_64-linux]

Description

The following commit causes a regression that affects Ruby on Rails:

http://redmine.ruby-lang.org/repositories/revision/1?rev=25954

Reproduction instructions and stack traceback included below

Set up server:

rails depot
cd depot
ruby script/generate scaffold product title:string description:text image_url:string
rake db:migrate
ruby script/server

Run the following as a client:

require 'rexml/document'
require 'net/http'

uri=URI.parse('http://localhost:3000/products/new')

form = {
    'product[title]' => 'Pragmatic Version Control',
    'product[description]' => 'This book is a recipe-based approach ...',
    'product[image_url]' => '/images/svn.jpg'
}
p form

Net::HTTP.start(uri.host, uri.port) do |http|
  get=Net::HTTP::Get.new(uri.path)
  response = http.request(get)
  cookie = response.response['set-cookie']
  doc=REXML::Document.new(response.body)
  action=doc.get_elements('//form').first.attribute('action').value
  token=doc.get_elements('//input[@name="authenticity_token"]').first.
    attribute('value').value
  form['authenticity_token']=token

  post=Net::HTTP::Post.new(action)
  post.form_data=form
  post['Cookie'] = cookie
  response = http.request(post)
  p response
end

Traceback produced:

/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/activerecord/lib/active_record/attribute_methods.rb:343: [BUG] Segmentation fault
ruby 1.9.2dev (2009-11-26 trunk 25954) [x86_64-linux]

-- control frame ----------
c:0067 p:---- s:0312 b:0312 l:000311 d:000311 CFUNC  :to_s
c:0066 p:0016 s:0309 b:0309 l:000308 d:000308 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/activerecord/lib/active_record/attribute_methods.rb:343
c:0065 p:---- s:0302 b:0302 l:000301 d:000301 FINISH
c:0064 p:---- s:0300 b:0300 l:000299 d:000299 CFUNC  :===
c:0063 p:0146 s:0296 b:0295 l:000294 d:000294 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1120
c:0062 p:0012 s:0288 b:0288 l:0017c8 d:000287 BLOCK  /home/rubys/git/awdwr/work-2.3.5/depot/app/controllers/products_controller.rb:48
c:0061 p:---- s:0286 b:0286 l:000285 d:000285 FINISH
c:0060 p:---- s:0284 b:0284 l:000283 d:000283 CFUNC  :call
c:0059 p:0068 s:0281 b:0281 l:000078 d:000280 BLOCK  /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:135
c:0058 p:---- s:0279 b:0279 l:000278 d:000278 FINISH
c:0057 p:---- s:0277 b:0277 l:000276 d:000276 CFUNC  :call
c:0056 p:0044 s:0274 b:0274 l:000265 d:000273 BLOCK  /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:175
c:0055 p:---- s:0271 b:0271 l:000270 d:000270 FINISH
c:0054 p:---- s:0269 b:0269 l:000268 d:000268 CFUNC  :each
c:0053 p:0013 s:0266 b:0266 l:000265 d:000265 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:173
c:0052 p:0103 s:0262 b:0262 l:000261 d:000261 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:107
c:0051 p:0040 s:0256 b:0256 l:0017c8 d:0017c8 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/app/controllers/products_controller.rb:45
c:0050 p:0042 s:0253 b:0253 l:000252 d:000252 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1331
c:0049 p:0048 s:0249 b:0249 l:000248 d:000248 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:617
c:0048 p:0028 s:0242 b:0242 l:000241 d:000241 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:610
c:0047 p:0009 s:0239 b:0239 l:000e28 d:000238 BLOCK  /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68
c:0046 p:0005 s:0237 b:0237 l:001548 d:000236 BLOCK  /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17
c:0045 p:0024 s:0235 b:0235 l:000234 d:000234 METHOD /home/rubys/.rvm/ruby-1.9.1-r25955/lib/ruby/1.9.1/benchmark.rb:309
c:0044 p:0013 s:0229 b:0228 l:001548 d:001548 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17
c:0043 p:0028 s:0225 b:0225 l:000e28 d:000e28 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68
c:0042 p:0011 s:0218 b:0218 l:000217 d:000217 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/rescue.rb:160
c:0041 p:0011 s:0214 b:0214 l:000213 d:000213 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/flash.rb:146
c:0040 p:0088 s:0211 b:0211 l:000210 d:000210 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/base.rb:532
c:0039 p:0030 s:0204 b:0204 l:000203 d:000203 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:606
c:0038 p:0021 s:0197 b:0197 l:000196 d:000196 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/base.rb:391
c:0037 p:0107 s:0192 b:0192 l:000191 d:000191 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/base.rb:386
c:0036 p:0054 s:0186 b:0186 l:000185 d:000185 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:437
c:0035 p:0038 s:0180 b:0180 l:000179 d:000179 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:87
c:0034 p:0018 s:0175 b:0175 l:000174 d:000174 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:121
c:0033 p:0018 s:0171 b:0171 l:001228 d:000170 LAMBDA /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:130
c:0032 p:---- s:0168 b:0168 l:000167 d:000167 FINISH
c:0031 p:---- s:0166 b:0166 l:000165 d:000165 CFUNC  :call
c:0030 p:0014 s:0162 b:0162 l:001c00 d:000161 BLOCK  /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:29
c:0029 p:0042 s:0160 b:0160 l:000159 d:000159 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:
c:0028 p:0051 s:0156 b:0156 l:000155 d:000155 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:9
c:0027 p:0019 s:0152 b:0152 l:001c00 d:001c00 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:28
c:0026 p:0015 s:0148 b:0148 l:000147 d:000147 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool
c:0025 p:0015 s:0144 b:0144 l:000143 d:000143 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25
c:0024 p:0015 s:0137 b:0137 l:000136 d:000136 METHOD /home/rubys/git/rack/lib/rack/head.rb:9
c:0023 p:0155 s:0130 b:0130 l:000129 d:000129 METHOD /home/rubys/git/rack/lib/rack/methodoverride.rb:24
c:0022 p:0046 s:0124 b:0124 l:000123 d:000123 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15
c:0021 p:0078 s:0119 b:0119 l:000118 d:000118 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb:93
c:0020 p:0015 s:0109 b:0109 l:000108 d:000108 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/failsafe.rb:26
c:0019 p:0014 s:0104 b:0104 l:000098 d:000103 BLOCK  /home/rubys/git/rack/lib/rack/lock.rb:11
c:0018 p:0019 s:0102 b:0102 l:000101 d:000101 METHOD <internal:prelude>:8
c:0017 p:0054 s:0099 b:0099 l:000098 d:000098 METHOD /home/rubys/git/rack/lib/rack/lock.rb:11
c:0016 p:0024 s:0094 b:0094 l:000084 d:000093 BLOCK  /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:114
c:0015 p:0040 s:0092 b:0092 l:000091 d:000091 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/reloader.rb:34
c:0014 p:0038 s:0085 b:0085 l:000084 d:000084 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:108
c:0013 p:0193 s:0081 b:0081 l:000080 d:000080 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/railties/lib/rails/rack/static.rb:31
c:0012 p:0185 s:0074 b:0074 l:000063 d:000073 BLOCK  /home/rubys/git/rack/lib/rack/urlmap.rb:46
c:0011 p:---- s:0069 b:0069 l:000068 d:000068 FINISH
c:0010 p:---- s:0067 b:0067 l:000066 d:000066 CFUNC  :each
c:0009 p:0072 s:0064 b:0064 l:000063 d:000063 METHOD /home/rubys/git/rack/lib/rack/urlmap.rb:40
c:0008 p:0015 s:0055 b:0055 l:000054 d:000054 METHOD /home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/railties/lib/rails/rack/log_tailer.rb:17
c:0007 p:0015 s:0050 b:0050 l:000049 d:000049 METHOD /home/rubys/git/rack/lib/rack/content_length.rb:13
c:0006 p:0346 s:0042 b:0042 l:000041 d:000041 METHOD /home/rubys/git/rack/lib/rack/handler/webrick.rb:50
c:0005 p:0257 s:0030 b:0030 l:000029 d:000029 METHOD /home/rubys/.rvm/ruby-1.9.1-r25955/lib/ruby/1.9.1/webrick/httpserver.rb:111
c:0004 p:0393 s:0020 b:0020 l:000019 d:000019 METHOD /home/rubys/.rvm/ruby-1.9.1-r25955/lib/ruby/1.9.1/webrick/httpserver.rb:70
c:0003 p:0126 s:0009 b:0009 l:002218 d:000008 BLOCK  /home/rubys/.rvm/ruby-1.9.1-r25955/lib/ruby/1.9.1/webrick/server.rb:183
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP
---------------------------
-- Ruby level backtrace information-----------------------------------------
/home/rubys/.rvm/ruby-1.9.1-r25955/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
/home/rubys/.rvm/ruby-1.9.1-r25955/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/home/rubys/.rvm/ruby-1.9.1-r25955/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/home/rubys/git/rack/lib/rack/handler/webrick.rb:50:in `service'
/home/rubys/git/rack/lib/rack/content_length.rb:13:in `call'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/railties/lib/rails/rack/log_tailer.rb:17:in `call'
/home/rubys/git/rack/lib/rack/urlmap.rb:40:in `call'
/home/rubys/git/rack/lib/rack/urlmap.rb:40:in `each'
/home/rubys/git/rack/lib/rack/urlmap.rb:46:in `block in call'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/railties/lib/rails/rack/static.rb:31:in `call'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:108:in `call'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/reloader.rb:34:in `run'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:114:in `block in call'
/home/rubys/git/rack/lib/rack/lock.rb:11:in `call'
<internal:prelude>:8:in `synchronize'
/home/rubys/git/rack/lib/rack/lock.rb:11:in `block in call'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in `call'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb:93:in `call'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in `call'
/home/rubys/git/rack/lib/rack/methodoverride.rb:24:in `call'
/home/rubys/git/rack/lib/rack/head.rb:9:in `call'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in `call'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in `cache'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `block in call'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:130:in `block in build_middleware_stack'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:121:in `_call'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:87:in `dispatch'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:437:in `call'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/base.rb:386:in `call'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/base.rb:391:in `process'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process_with_filters'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `process'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/flash.rb:146:in `perform_action_with_flash'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/rescue.rb:160:in `perform_action_with_rescue'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/rubys/.rvm/ruby-1.9.1-r25955/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `block in ms'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `block in perform_action_with_benchmark'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_with_filters'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1331:in `perform_action'
/home/rubys/git/awdwr/work-2.3.5/depot/app/controllers/products_controller.rb:45:in `create'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:107:in `respond_to'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:173:in `respond'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:173:in `each'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:175:in `block in respond'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:175:in `call'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:135:in `block in custom'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:135:in `call'
/home/rubys/git/awdwr/work-2.3.5/depot/app/controllers/products_controller.rb:48:in `block (2 levels) in create'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1120:in `redirect_to'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1120:in `==='
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/activerecord/lib/active_record/attribute_methods.rb:343:in `respond_to?'
/home/rubys/git/awdwr/work-2.3.5/depot/vendor/rails/activerecord/lib/active_record/attribute_methods.rb:343:in `to_s'

-- C level backtrace information -------------------------------------------
ruby(rb_vm_bugreport+0x9e) [0x51990e]
ruby [0x557f68]
ruby(rb_bug+0xb1) [0x558121]
ruby [0x4ae2e8]
/lib/libpthread.so.0 [0x7fd90f034190]
ruby [0x4bc037]
ruby [0x50934f]
ruby [0x51727c]
ruby [0x50ac36]
ruby [0x50f4a4]
ruby [0x511070]
ruby(rb_funcall+0x113) [0x511af3]
ruby [0x516365]
ruby(rb_rescue2+0x233) [0x419d43]
ruby(rb_check_funcall+0x449) [0x511819]
ruby [0x44e258]
ruby(rb_check_convert_type+0x76) [0x451626]
ruby(rb_reg_eqq+0x12) [0x48b6a2]
ruby [0x50934f]
ruby [0x51727c]
ruby [0x50ac36]
ruby [0x50f4a4]
ruby(rb_vm_invoke_proc+0xb0) [0x50fed0]
ruby [0x50934f]
ruby [0x51727c]
ruby [0x50ac36]
ruby [0x50f4a4]
ruby(rb_vm_invoke_proc+0xb0) [0x50fed0]
ruby [0x50934f]
ruby [0x51727c]
ruby [0x50ac36]
ruby [0x50f4a4]
ruby(rb_yield+0x66) [0x517526]
ruby(rb_ary_each+0x45) [0x528955]
ruby [0x50934f]
ruby [0x51727c]
ruby [0x50ac36]
ruby [0x50f4a4]
ruby(rb_vm_invoke_proc+0xb0) [0x50fed0]
ruby [0x50934f]
ruby [0x51727c]
ruby [0x50ac36]
ruby [0x50f4a4]
ruby(rb_yield+0x66) [0x517526]
ruby(rb_ary_each+0x45) [0x528955]
ruby [0x50934f]
ruby [0x51727c]
ruby [0x50ac36]
ruby [0x50f4a4]
ruby(rb_vm_invoke_proc+0xb0) [0x50fed0]
ruby [0x51fbe8]
ruby [0x51fc6e]
/lib/libpthread.so.0 [0x7fd90f02ba04]
/lib/libc.so.6(clone+0x6d) [0x7fd90e4cc7bd]

[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

History

Updated by Sam Ruby about 2 years ago

Verified as fixed by http://redmine.ruby-lang.org/repositories/diff/ruby-19/vm_eval.c?rev=25959

Please close.

Updated by ujihisa . about 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF