Bug #9757
closedSegfault in 2.1.1 from RSpec expect_any_instance_of
Description
The following spec causes a segfault for me in ruby 2.1.1 on OS X 10.9.2:
class A
def a
'a'
end
end
class B
def b
'b'
end
end
describe 'segfault' do
it 'should make unused recorders' do
expect_any_instance_of(A).to receive(:a)
expect_any_instance_of(B).to receive(:b)
end
it 'should crash ruby' do
A.new.a
B.new.b
end
end
Some more info:
$ ruby -v
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]
$ bundle exec gem list
*** LOCAL GEMS ***
bundler (1.6.0.rc)
diff-lcs (1.2.5)
rspec (3.0.0.beta2)
rspec-core (3.0.0.beta2)
rspec-expectations (3.0.0.beta2)
rspec-mocks (3.0.0.beta2)
rspec-support (3.0.0.beta2)
I've also attached the crash report generated by OS X. Let me know if you need some more info. Sorry if this is a duplicate, I found some similar looking reports (#9309, #9461, #9315), but I don't really know enough to recognize if they are exactly the same issue.
Files
Updated by nobu (Nobuyoshi Nakada) about 10 years ago
- Category set to doc
- Status changed from Open to Feedback
Seems like stack overflow.
Could you try with the trunk?
Updated by nobu (Nobuyoshi Nakada) about 10 years ago
- Category changed from doc to core
Set the category to "doc" by mistake.
Updated by dafaber (David Faber) almost 10 years ago
Sorry I missed the notification about your message. I've retried this with trunk (ruby 2.2.0dev (2014-04-25 trunk 45720) [x86_64-darwin13]) and it just gives a SystemStackError, with message "stack level too deep" now, so it does seem like stack overflow. Does that indicate that the segfault is fixed in trunk, and there may be a different bug in RSpec causing the stack overflow in the first place?
Updated by jeremyevans0 (Jeremy Evans) almost 5 years ago
- Status changed from Feedback to Closed