Bug #11430
closedRedefining a lazy-loaded variable in child context within RSpec spec causes crash
Description
I had something like the following in my spec. While not great code design, it does successfully crash Ruby.
let(:my_hash) do
{
key_one: 'val_one'
}
end
subject { post :create, my_hash, format: :json }
context 'with the optional key_two field defined' do
let(:my_hash) { my_hash.merge!(key_two: 'val_two') }
it 'successfully posts' do
expect(subject.status).to eq 200
end
end
Here's the full console dump (minus loaded features):
.../Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:221: [BUG] vm_call_cfunc - cfp consistency error
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin13.0]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
-- Control frame information -----------------------------------------------
c:0050 p:---- s:0210 e:000209 CFUNC :call
c:0049 p:0020 s:0207 e:000206 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:221
c:0048 p:0041 s:0202 e:000201 BLOCK /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-rails-3.1.0/lib/rspec/rails/example/controller_example_g [FINISH]
c:0047 p:---- s:0198 e:000197 CFUNC :instance_exec
c:0046 p:0013 s:0194 e:000193 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:321
c:0045 p:0013 s:0189 e:000188 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/hooks.rb:380
c:0044 p:0013 s:0184 e:000183 BLOCK /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/hooks.rb:446 [FINISH]
c:0043 p:---- s:0182 e:000181 CFUNC :call
c:0042 p:0020 s:0179 e:000178 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:221
c:0041 p:0014 s:0174 e:000173 BLOCK /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-rails-3.1.0/lib/rspec/rails/adapters.rb:72 [FINISH]
c:0040 p:---- s:0171 e:000170 CFUNC :instance_exec
c:0039 p:0013 s:0167 e:000166 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:321
c:0038 p:0013 s:0162 e:000161 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/hooks.rb:380
c:0037 p:0013 s:0157 e:000156 BLOCK /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/hooks.rb:446 [FINISH]
c:0036 p:---- s:0155 e:000154 CFUNC :call
c:0035 p:0020 s:0152 e:000151 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:221
c:0034 p:0014 s:0147 E:001db8 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/hooks.rb:447
c:0033 p:0041 s:0144 e:000143 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/hooks.rb:500
c:0032 p:0043 s:0137 e:000136 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:330
c:0031 p:0076 s:0132 E:002540 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:148
c:0030 p:0050 s:0126 e:000125 BLOCK /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:500 [FINISH]
c:0029 p:---- s:0121 e:000120 CFUNC :map
c:0028 p:0014 s:0118 e:000117 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:496
c:0027 p:0072 s:0114 e:000113 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:463
c:0026 p:0010 s:0107 e:000106 BLOCK /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464 [FINISH]
c:0025 p:---- s:0104 e:000103 CFUNC :map
c:0024 p:0086 s:0101 e:000100 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464
c:0023 p:0010 s:0094 e:000093 BLOCK /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464 [FINISH]
c:0022 p:---- s:0091 e:000090 CFUNC :map
c:0021 p:0086 s:0088 e:000087 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464
c:0020 p:0010 s:0081 e:000080 BLOCK /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464 [FINISH]
c:0019 p:---- s:0078 e:000077 CFUNC :map
c:0018 p:0086 s:0075 e:000074 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464
c:0017 p:0010 s:0068 e:000067 BLOCK /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464 [FINISH]
c:0016 p:---- s:0065 e:000064 CFUNC :map
c:0015 p:0086 s:0062 e:000061 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464
c:0014 p:0010 s:0055 e:000054 BLOCK /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/runner.rb:111 [FINISH]
c:0013 p:---- s:0052 e:000051 CFUNC :map
c:0012 p:0039 s:0049 e:000048 BLOCK /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/runner.rb:111
c:0011 p:0017 s:0045 e:000044 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/reporter.rb:53
c:0010 p:0018 s:0041 e:000040 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/runner.rb:107
c:0009 p:0022 s:0037 e:000036 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/runner.rb:85
c:0008 p:0088 s:0032 e:000031 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/runner.rb:69
c:0007 p:0024 s:0025 e:000024 METHOD /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/runner.rb:37
c:0006 p:0023 s:0021 e:000020 TOP /Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/exe/rspec:4 [FINISH]
c:0005 p:---- s:0019 e:000018 CFUNC :load
c:0004 p:0135 s:0015 E:001598 EVAL /Users/myusername/.rbenv/versions/2.1.5/bin/rspec:23 [FINISH]
c:0003 p:---- s:0011 e:000010 CFUNC :eval
c:0002 p:0118 s:0005 E:000e30 EVAL /Users/myusername/.rbenv/versions/2.1.5/bin/ruby_executable_hooks:15 [FINISH]
c:0001 p:0000 s:0002 E:000008 TOP [FINISH]
/Users/myusername/.rbenv/versions/2.1.5/bin/ruby_executable_hooks:15:in `<main>'
/Users/myusername/.rbenv/versions/2.1.5/bin/ruby_executable_hooks:15:in `eval'
/Users/myusername/.rbenv/versions/2.1.5/bin/rspec:23:in `<main>'
/Users/myusername/.rbenv/versions/2.1.5/bin/rspec:23:in `load'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/exe/rspec:4:in `<top (required)>'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/runner.rb:37:in `invoke'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/runner.rb:69:in `run'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/runner.rb:85:in `run'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/runner.rb:107:in `run_specs'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/reporter.rb:53:in `report'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/runner.rb:111:in `block in run_specs'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/runner.rb:111:in `map'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/runner.rb:111:in `block (2 levels) in run_specs'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464:in `run'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464:in `map'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464:in `block in run'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464:in `run'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464:in `map'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464:in `block in run'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464:in `run'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464:in `map'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464:in `block in run'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464:in `run'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464:in `map'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:464:in `block in run'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:463:in `run'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:496:in `run_examples'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:496:in `map'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example_group.rb:500:in `block in run_examples'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:148:in `run'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:330:in `with_around_example_hooks'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/hooks.rb:500:in `run'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/hooks.rb:447:in `run'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:221:in `call'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:221:in `call'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/hooks.rb:446:in `block (2 levels) in run'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/hooks.rb:380:in `execute_with'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:321:in `instance_exec'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:321:in `instance_exec'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-rails-3.1.0/lib/rspec/rails/adapters.rb:72:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:221:in `call'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:221:in `call'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/hooks.rb:446:in `block (2 levels) in run'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/hooks.rb:380:in `execute_with'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:321:in `instance_exec'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:321:in `instance_exec'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-rails-3.1.0/lib/rspec/rails/example/controller_example_group.rb:179:in `block (2 levels) in <module:ControllerExampleGroup>'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:221:in `call'
/Users/myusername/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.5/lib/rspec/core/example.rb:221:in `call'
-- C level backtrace information -------------------------------------------
0 ruby 0x000000010b559b59 rb_vm_bugreport + 137
1 ruby 0x000000010b40ae61 report_bug + 305
2 ruby 0x000000010b40ad1c rb_bug + 188
3 ruby 0x000000010b5586c1 vm_call_cfunc + 1953
4 ruby 0x000000010b557c6e vm_call_method + 894
5 ruby 0x000000010b53f0e6 vm_exec_core + 11670
6 ruby 0x000000010b54ddb1 vm_exec + 129
7 ruby 0x000000010b5529ba invoke_block_from_c + 2234
8 ruby 0x000000010b54cfda vm_invoke_proc + 186
9 ruby 0x000000010b54cf10 rb_vm_invoke_proc + 32
10 ruby 0x000000010b41ae75 proc_call + 117
11 ruby 0x000000010b558341 vm_call_cfunc + 1057
12 ruby 0x000000010b53f0e6 vm_exec_core + 11670
13 ruby 0x000000010b54ddb1 vm_exec + 129
14 ruby 0x000000010b5529ba invoke_block_from_c + 2234
15 ruby 0x000000010b54ba71 yield_under + 353
16 ruby 0x000000010b558341 vm_call_cfunc + 1057
17 ruby 0x000000010b557c6e vm_call_method + 894
18 ruby 0x000000010b53f0e6 vm_exec_core + 11670
19 ruby 0x000000010b54ddb1 vm_exec + 129
20 ruby 0x000000010b5529ba invoke_block_from_c + 2234
21 ruby 0x000000010b54cfda vm_invoke_proc + 186
22 ruby 0x000000010b54cf10 rb_vm_invoke_proc + 32
23 ruby 0x000000010b41ae75 proc_call + 117
24 ruby 0x000000010b558341 vm_call_cfunc + 1057
25 ruby 0x000000010b53f0e6 vm_exec_core + 11670
26 ruby 0x000000010b54ddb1 vm_exec + 129
27 ruby 0x000000010b5529ba invoke_block_from_c + 2234
28 ruby 0x000000010b54a5d8 rb_yield + 184
29 ruby 0x000000010b3d5cd9 rb_ary_collect + 153
30 ruby 0x000000010b558341 vm_call_cfunc + 1057
31 ruby 0x000000010b53f0e6 vm_exec_core + 11670
32 ruby 0x000000010b54ddb1 vm_exec + 129
33 ruby 0x000000010b5529ba invoke_block_from_c + 2234
34 ruby 0x000000010b54a5d8 rb_yield + 184
35 ruby 0x000000010b3d5cd9 rb_ary_collect + 153
36 ruby 0x000000010b558341 vm_call_cfunc + 1057
37 ruby 0x000000010b53f0e6 vm_exec_core + 11670
38 ruby 0x000000010b54ddb1 vm_exec + 129
39 ruby 0x000000010b5529ba invoke_block_from_c + 2234
40 ruby 0x000000010b54a5d8 rb_yield + 184
41 ruby 0x000000010b3d5cd9 rb_ary_collect + 153
42 ruby 0x000000010b558341 vm_call_cfunc + 1057
43 ruby 0x000000010b53f0e6 vm_exec_core + 11670
44 ruby 0x000000010b54ddb1 vm_exec + 129
45 ruby 0x000000010b5529ba invoke_block_from_c + 2234
46 ruby 0x000000010b54a5d8 rb_yield + 184
47 ruby 0x000000010b3d5cd9 rb_ary_collect + 153
48 ruby 0x000000010b558341 vm_call_cfunc + 1057
49 ruby 0x000000010b53f0e6 vm_exec_core + 11670
50 ruby 0x000000010b54ddb1 vm_exec + 129
51 ruby 0x000000010b5529ba invoke_block_from_c + 2234
52 ruby 0x000000010b54a5d8 rb_yield + 184
53 ruby 0x000000010b3d5cd9 rb_ary_collect + 153
54 ruby 0x000000010b558341 vm_call_cfunc + 1057
55 ruby 0x000000010b557c6e vm_call_method + 894
56 ruby 0x000000010b53f0e6 vm_exec_core + 11670
57 ruby 0x000000010b54ddb1 vm_exec + 129
58 ruby 0x000000010b5529ba invoke_block_from_c + 2234
59 ruby 0x000000010b54a5d8 rb_yield + 184
60 ruby 0x000000010b3d5cd9 rb_ary_collect + 153
61 ruby 0x000000010b558341 vm_call_cfunc + 1057
62 ruby 0x000000010b557c6e vm_call_method + 894
63 ruby 0x000000010b53f0e6 vm_exec_core + 11670
64 ruby 0x000000010b54ddb1 vm_exec + 129
65 ruby 0x000000010b54dcf9 rb_iseq_eval + 281
66 ruby 0x000000010b4186a7 rb_load_internal0 + 311
67 ruby 0x000000010b41834d rb_f_load + 173
68 ruby 0x000000010b558341 vm_call_cfunc + 1057
69 ruby 0x000000010b557c6e vm_call_method + 894
70 ruby 0x000000010b53f2b9 vm_exec_core + 12137
71 ruby 0x000000010b54ddb1 vm_exec + 129
72 ruby 0x000000010b554714 eval_string_with_cref + 1620
73 ruby 0x000000010b54afd1 rb_f_eval + 161
74 ruby 0x000000010b558341 vm_call_cfunc + 1057
75 ruby 0x000000010b557c6e vm_call_method + 894
76 ruby 0x000000010b53f2b9 vm_exec_core + 12137
77 ruby 0x000000010b54ddb1 vm_exec + 129
78 ruby 0x000000010b54ed25 rb_iseq_eval_main + 389
79 ruby 0x000000010b4137b4 ruby_exec_internal + 148
80 ruby 0x000000010b4136de ruby_run_node + 78
81 ruby 0x000000010b3cde9f main + 79
-- Other runtime information -----------------------------------------------
* Loaded script: /Users/myusername/.rbenv/versions/2.1.5/bin/rspec
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
Don't forget to include the above Crash Report log file.
For details: http://www.ruby-lang.org/bugreport.html
Abort trap: 6
Files
Updated by cesario (Franck Verrot) about 9 years ago
Andrew Wong wrote:
I had something like the following in my spec. While not great code design, it does successfully crash Ruby.
let(:my_hash) do { key_one: 'val_one' } end subject { post :create, my_hash, format: :json } context 'with the optional key_two field defined' do let(:my_hash) { my_hash.merge!(key_two: 'val_two') } it 'successfully posts' do expect(subject.status).to eq 200 end end
I can reproduce this if I run rspec your_source.rb
, but not with ruby /path/to/rspec your_source.rb
.
Running the later outputs this:
Failure/Error: let(:my_hash) { my_hash.merge!(key_two: 'val_two') }
SystemStackError:
stack level too deep
HTH.
Updated by andrewchhwong (Andrew Wong) over 8 years ago
Not sure what to do here. Do random issues like this get triaged? Or sitting around like this is typical?
Updated by normalperson (Eric Wong) over 8 years ago
andrewchhwong+ruby@gmail.com wrote:
Not sure what to do here. Do random issues like this get triaged? Or sitting around like this is typical?
Most of us are volunteers and I find it helpful for reporters to
send reminders every once in a while (once every few weeks is
fine, depending on urgency).
Can you test on a newer version of Ruby?
Or reproduce it outside of rspec?
Having an isolated test case which works with a standard Ruby
install will help us immensely. Thank you.
Updated by dstosik (David Stosik) over 7 years ago
I believe this is related to an incorrect use of RSpec's let
, and has nothing to do with Ruby. (=> not a bug here?)
When you write let(:my_hash) { my_hash.merge!(key_two: 'val_two') }
, you override :my_hash
in that local context, and forget how it was defined before that. You end up with a recursion, as trying to instantiate my_hash
will run your block, that needs to evaluate my_hash
(run the block again, and so on and so forth, ad aeternam - actually just until the stack explodes).
Updated by nobu (Nobuyoshi Nakada) over 7 years ago
- Description updated (diff)
- Status changed from Open to Feedback
Updated by wanabe (_ wanabe) over 7 years ago
- Related to Bug #11903: [BUG] vm_call_cfunc - cfp consistency error added
Updated by wanabe (_ wanabe) over 7 years ago
- Related to Bug #13412: Infinite recursion with define_method may cause silent SEGV or cfp consistency error added
Updated by nobu (Nobuyoshi Nakada) over 7 years ago
- Related to deleted (Bug #13412: Infinite recursion with define_method may cause silent SEGV or cfp consistency error)
Updated by nobu (Nobuyoshi Nakada) over 7 years ago
- Has duplicate Bug #13412: Infinite recursion with define_method may cause silent SEGV or cfp consistency error added
Updated by nobu (Nobuyoshi Nakada) over 7 years ago
- Has duplicate deleted (Bug #13412: Infinite recursion with define_method may cause silent SEGV or cfp consistency error)
Updated by nobu (Nobuyoshi Nakada) over 7 years ago
- Related to Bug #13412: Infinite recursion with define_method may cause silent SEGV or cfp consistency error added
Updated by jeremyevans0 (Jeremy Evans) over 5 years ago
- Status changed from Feedback to Closed