Project

General

Profile

Bug #4634

Segmentation fault on marshal_dump

Added by asozontov (Anton Sozontov) over 8 years ago. Updated over 8 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
Backport:
[ruby-core:35949]

Description

=begin
Call

...
def marshal_dump
dup.tap{|i| i.instance_variable_set(:@callbacks,[]) }
end
...
=>>>

[BUG] Segmentation fault
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]

-- control frame ----------
c:0058 p:---- s:0289 b:0289 l:000288 d:000288 CFUNC :instance_variable_set
c:0057 p:0015 s:0284 b:0284 l:000275 d:000283 BLOCK /home/anton/projects/ij/lib/filter.rb:30
c:0056 p:---- s:0281 b:0281 l:000280 d:000280 FINISH
c:0055 p:---- s:0279 b:0279 l:000278 d:000278 CFUNC :tap
c:0054 p:0017 s:0276 b:0276 l:000275 d:000275 METHOD /home/anton/projects/ij/lib/filter.rb:30
c:0053 p:---- s:0273 b:0273 l:000272 d:000272 FINISH
c:0052 p:---- s:0271 b:0271 l:000270 d:000270 CFUNC :dump
c:0051 p:0047 s:0267 b:0267 l:000266 d:000266 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-mocks-2.1.0/lib/rspec/mocks/extensions/marshal.rb:7
c:0050 p:0034 s:0261 b:0260 l:000259 d:000259 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/session_store.rb:54
c:0049 p:0045 s:0256 b:0254 l:000253 d:000253 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/session_store.rb:144
c:0048 p:0143 s:0251 b:0251 l:000250 d:000250 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/callbacks.rb:415
c:0047 p:0011 s:0242 b:0242 l:000998 d:000998 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/callbacks.rb:273
c:0046 p:0011 s:0239 b:0239 l:000238 d:000238 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/persistence.rb:39
c:0045 p:0027 s:0235 b:0235 l:000234 d:000234 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/validations.rb:43
c:0044 p:0012 s:0231 b:0231 l:000230 d:000230 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/attribute_methods/dirty.rb:21
c:0043 p:0010 s:0226 b:0226 l:0001f0 d:000225 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/transactions.rb:240
c:0042 p:0015 s:0224 b:0224 l:000690 d:000223 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/transactions.rb:292
c:0041 p:0232 s:0222 b:0222 l:000221 d:000221 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/database_statements.rb:13
c:0040 p:0025 s:0213 b:0213 l:000212 d:000212 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/transactions.rb:207
c:0039 p:0022 s:0208 b:0208 l:000690 d:000690 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/transactions.rb:290
c:0038 p:0009 s:0204 b:0204 l:0001f0 d:0004e8 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/transactions.rb:240
c:0037 p:0017 s:0202 b:0202 l:000201 d:000201 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/transactions.rb:251
c:0036 p:0011 s:0199 b:0199 l:0001f0 d:0001f0 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/transactions.rb:239
c:0035 p:0044 s:0195 b:0195 l:000187 d:000194 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/session_store.rb:306
c:0034 p:0067 s:0192 b:0192 l:000191 d:000191 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/benchmarkable.rb:55
c:0033 p:0017 s:0188 b:0188 l:000187 d:000187 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/session_store.rb:303
c:0032 p:0192 s:0182 b:0182 l:000181 d:000181 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.0.6/lib/action_dispatch/middleware/session/abstract_store.rb:160
c:0031 p:0015 s:0171 b:0171 l:000170 d:000170 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.0.6/lib/action_dispatch/middleware/cookies.rb:302
c:0030 p:0014 s:0163 b:0163 l:001520 d:000162 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/query_cache.rb:32
c:0029 p:0019 s:0161 b:0161 l:000160 d:000160 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/query_cache.rb:28
c:0028 p:0051 s:0157 b:0157 l:000156 d:000156 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/query_cache.rb:12
c:0027 p:0019 s:0153 b:0153 l:001520 d:001520 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/query_cache.rb:31
c:0026 p:0015 s:0149 b:0149 l:000148 d:000148 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:354
c:0025 p:0029 s:0145 b:0145 l:001690 d:000144 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.0.6/lib/action_dispatch/middleware/callbacks.rb:46
c:0024 p:0155 s:0143 b:0143 l:000142 d:000142 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/callbacks.rb:416
c:0023 p:0011 s:0133 b:0133 l:001690 d:001690 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.0.6/lib/action_dispatch/middleware/callbacks.rb:44
c:0022 p:0015 s:0129 b:0129 l:000128 d:000128 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/sendfile.rb:107
c:0021 p:0049 s:0119 b:0119 l:000118 d:000118 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.0.6/lib/action_dispatch/middleware/remote_ip.rb:48
c:0020 p:0017 s:0115 b:0115 l:000114 d:000114 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.0.6/lib/action_dispatch/middleware/show_exceptions.rb:47
c:0019 p:0027 s:0107 b:0107 l:000106 d:000106 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/rack/logger.rb:13
c:0018 p:0032 s:0103 b:0103 l:000102 d:000102 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/runtime.rb:17
c:0017 p:0052 s:0094 b:0094 l:000093 d:000093 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/cache/strategy/local_cache.rb:72
c:0016 p:0014 s:0090 b:0090 l:000084 d:000089 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/lock.rb:11
c:0015 p:0019 s:0088 b:0088 l:000087 d:000087 METHOD internal:prelude:10
c:0014 p:0054 s:0085 b:0085 l:000084 d:000084 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/lock.rb:11
c:0013 p:0193 s:0080 b:0080 l:000079 d:000079 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.0.6/lib/action_dispatch/middleware/static.rb:30
c:0012 p:0193 s:0073 b:0073 l:000072 d:000072 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.0.6/lib/action_dispatch/middleware/static.rb:30
c:0011 p:0032 s:0066 b:0066 l:000065 d:000065 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/application.rb:168
c:0010 p:0021 s:0062 b:0062 l:000061 d:000061 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/application.rb:77
c:0009 p:---- s:0057 b:0057 l:000056 d:000056 FINISH
c:0008 p:0015 s:0055 b:0055 l:000054 d:000054 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/rack/log_tailer.rb:14
c:0007 p:0015 s:0050 b:0050 l:000049 d:000049 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/content_length.rb:13
c:0006 p:0338 s:0042 b:0042 l:000041 d:000041 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/handler/webrick.rb:52
c:0005 p:0257 s:0030 b:0030 l:000029 d:000029 METHOD /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111
c:0004 p:0393 s:0020 b:0020 l:000019 d:000019 METHOD /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70
c:0003 p:0126 s:0009 b:0009 l:002538 d:000008 BLOCK /usr/local/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 ----------------------------------------
/usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in block in start_thread'
/usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in
run'
/usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in service'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/handler/webrick.rb:52:in
service'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/content_length.rb:13:in call'
/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/rack/log_tailer.rb:14:in
call'
/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/application.rb:77:in method_missing'
/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/application.rb:168:in
call'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.0.6/lib/action_dispatch/middleware/static.rb:30:in call'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.0.6/lib/action_dispatch/middleware/static.rb:30:in
call'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/lock.rb:11:in call'
<internal:prelude>:10:in
synchronize'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/lock.rb:11:in block in call'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/cache/strategy/local_cache.rb:72:in
call'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/runtime.rb:17:in call'
/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/rack/logger.rb:13:in
call'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.0.6/lib/action_dispatch/middleware/show_exceptions.rb:47:in call'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.0.6/lib/action_dispatch/middleware/remote_ip.rb:48:in
call'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/sendfile.rb:107:in call'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.0.6/lib/action_dispatch/middleware/callbacks.rb:44:in
call'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/callbacks.rb:416:in _run_call_callbacks'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.0.6/lib/action_dispatch/middleware/callbacks.rb:46:in
block in call'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in call'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/query_cache.rb:31:in
call'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/query_cache.rb:12:in cache'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/query_cache.rb:28:in
cache'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/query_cache.rb:32:in block in call'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.0.6/lib/action_dispatch/middleware/cookies.rb:302:in
call'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.0.6/lib/action_dispatch/middleware/session/abstract_store.rb:160:in call'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/session_store.rb:303:in
set_session'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/benchmarkable.rb:55:in silence'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/session_store.rb:306:in
block in set_session'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/transactions.rb:239:in save'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/transactions.rb:251:in
rollback_active_record_state!'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/transactions.rb:240:in block in save'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/transactions.rb:290:in
with_transaction_returning_status'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/transactions.rb:207:in transaction'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in
transaction'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/transactions.rb:292:in block in with_transaction_returning_status'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/transactions.rb:240:in
block (2 levels) in save'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/attribute_methods/dirty.rb:21:in save'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/validations.rb:43:in
save'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/persistence.rb:39:in save'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/callbacks.rb:273:in
create_or_update'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/callbacks.rb:415:in _run_save_callbacks'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/session_store.rb:144:in
marshal_data!'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/session_store.rb:54:in marshal'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-mocks-2.1.0/lib/rspec/mocks/extensions/marshal.rb:7:in
dump_with_mocks'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-mocks-2.1.0/lib/rspec/mocks/extensions/marshal.rb:7:in dump'
/home/anton/projects/ij/lib/filter.rb:30:in
marshal_dump'
/home/anton/projects/ij/lib/filter.rb:30:in tap'
/home/anton/projects/ij/lib/filter.rb:30:in
block in marshal_dump'
/home/anton/projects/ij/lib/filter.rb:30:in `instance_variable_set'

-- C level backtrace information -------------------------------------------
/home/anton/projects/ij/script/rails(rb_vm_bugreport+0x9e) [0x52029e]
/home/anton/projects/ij/script/rails() [0x5619a8]
/home/anton/projects/ij/script/rails(rb_bug+0xb1) [0x561b41]
/home/anton/projects/ij/script/rails() [0x4afd28]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xfc60) [0x7ffbd686ec60]
/home/anton/projects/ij/script/rails() [0x50f782]
/home/anton/projects/ij/script/rails() [0x510ea6]
/home/anton/projects/ij/script/rails() [0x515bca]
/home/anton/projects/ij/script/rails(rb_yield+0x66) [0x51e476]
/home/anton/projects/ij/script/rails(rb_obj_tap+0x9) [0x44f8b9]
/home/anton/projects/ij/script/rails() [0x50f787]
/home/anton/projects/ij/script/rails() [0x510ea6]
/home/anton/projects/ij/script/rails() [0x515bca]
/home/anton/projects/ij/script/rails() [0x51716b]
/home/anton/projects/ij/script/rails(rb_funcall+0x113) [0x517bd3]
/home/anton/projects/ij/script/rails() [0x443bde]
/home/anton/projects/ij/script/rails() [0x443c19]

[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

Process finished with exit code 134
=end

History

Updated by nagachika (Tomoyuki Chikanaga) over 8 years ago

=begin
Hi,

Your marshal_dump implementation seems to fall into stack overflow because of infinite recursion. I've got SystemStackError with script like below.

4634.rb
class A
def marshal_dump
dup.tap{|i| i.instance_variable_set(:@callbacks,[]) }
end
end
Marshal.dump(A.new)

result:
$ ruby -v 4634.rb
ruby 1.9.3dev (2011-04-14 trunk 31279) [x86_64-darwin10.7.0]
4634.rb:3: stack level too deep (SystemStackError)

But backtrace shows SEGV occurred at the first call of instance_variable_set.
I can't reproduce SEGV on trunk, 1.9.2.
=end

Updated by yugui (Yuki Sonoda) over 8 years ago

  • Status changed from Open to Rejected
#3

Updated by yugui (Yuki Sonoda) over 8 years ago

  • Tracker changed from Backport to Bug
  • Project changed from Backport192 to Ruby master

Also available in: Atom PDF