帮助!在测试快结束时几乎总是运行测试时出现“分段错误”
每当我运行“rake spec”时,我有 70-80% 的机会在 Ruby 中遇到 SEGMENTATION_FAULT。它通常发生在 2 个堆栈跟踪中:一个与 Factory_Girl 相关,另一个与 ActiveRecord 相关。这确实很奇怪。我不知道该怎么办。这是我运行所有测试时的输出:
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/persistence.rb:285: [BUG] Segmentation fault
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
-- control frame ----------
c:0048 p:0026 s:0171 b:0171 l:000156 d:000170 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/persistence.rb:285
c:0047 p:---- s:0167 b:0167 l:000166 d:000166 FINISH
c:0046 p:---- s:0165 b:0165 l:000160 d:000164 IFUNC
c:0045 p:---- s:0163 b:0163 l:000162 d:000162 CFUNC :each
c:0044 p:---- s:0161 b:0161 l:000160 d:000160 CFUNC :inject
c:0043 p:0025 s:0157 b:0157 l:000156 d:000156 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/persistence.rb:284
c:0042 p:0010 s:0154 b:0154 l:000153 d:000153 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/locking/optimistic.rb:62
c:0041 p:0014 s:0150 b:0150 l:000149 d:000149 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/base.rb:1395
c:0040 p:---- s:0145 b:0145 l:000144 d:000144 FINISH
c:0039 p:---- s:0143 b:0143 l:000142 d:000142 CFUNC :new
c:0038 p:0012 s:0140 b:0140 l:000139 d:000139 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/factory_girl-1.3.3/lib/factory_girl/proxy/build.rb:5
c:0037 p:---- s:0136 b:0136 l:000135 d:000135 FINISH
c:0036 p:---- s:0134 b:0134 l:000133 d:000133 CFUNC :new
c:0035 p:0019 s:0130 b:0130 l:000129 d:000129 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/factory_girl-1.3.3/lib/factory_girl/factory.rb:321
c:0034 p:0034 s:0123 b:0123 l:000122 d:000122 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/factory_girl-1.3.3/lib/factory_girl/factory.rb:273
c:0033 p:0076 s:0118 b:0118 l:002488 d:000117 BLOCK /home/egervari/websites/training/spec/queries/company_user_query_spec.rb:8
c:0032 p:---- s:0116 b:0116 l:000115 d:000115 FINISH
c:0031 p:---- s:0114 b:0114 l:000113 d:000113 CFUNC :instance_eval
c:0030 p:0019 s:0111 b:0111 l:000110 d:000110 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:32
c:0029 p:0014 s:0107 b:0107 l:000098 d:000106 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:69
c:0028 p:---- s:0104 b:0104 l:000103 d:000103 FINISH
c:0027 p:---- s:0102 b:0102 l:000101 d:000101 CFUNC :each
c:0026 p:0025 s:0099 b:0099 l:000098 d:000098 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:69
c:0025 p:0030 s:0095 b:0095 l:000094 d:000094 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:115
c:0024 p:0024 s:0089 b:0089 l:000080 d:000088 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:221
c:0023 p:---- s:0086 b:0086 l:000085 d:000085 FINISH
c:0022 p:---- s:0084 b:0084 l:000083 d:000083 CFUNC :each
c:0021 p:0054 s:0081 b:0081 l:000080 d:000080 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:221
c:0020 p:0039 s:0077 b:0077 l:000076 d:000076 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example.rb:145
c:0019 p:0011 s:0074 b:0074 l:001e60 d:000073 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example.rb:47
c:0018 p:0024 s:0071 b:0071 l:000070 d:000070 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example.rb:107
c:0017 p:0059 s:0067 b:0067 l:001e60 d:001e60 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example.rb:45
c:0016 p:0071 s:0061 b:0061 l:000050 d:000060 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:294
c:0015 p:---- s:0056 b:0056 l:000055 d:000055 FINISH
c:0014 p:---- s:0054 b:0054 l:000053 d:000053 CFUNC :map
c:0013 p:0017 s:0051 b:0051 l:000050 d:000050 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:290
c:0012 p:0096 s:0047 b:0047 l:000046 d:000046 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:262
c:0011 p:0014 s:0040 b:0040 l:000024 d:000039 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/command_line.rb:24
c:0010 p:---- s:0037 b:0037 l:000036 d:000036 FINISH
c:0009 p:---- s:0035 b:0035 l:000034 d:000034 CFUNC :map
c:0008 p:0035 s:0032 b:0032 l:000024 d:000031 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/command_line.rb:24
c:0007 p:0022 s:0029 b:0029 l:000028 d:000028 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/reporter.rb:12
c:0006 p:0113 s:0025 b:0025 l:000024 d:000024 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/command_line.rb:21
c:0005 p:0055 s:0020 b:0020 l:000019 d:000019 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/runner.rb:80
c:0004 p:0101 s:0014 b:0014 l:000013 d:000013 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/runner.rb:69
c:0003 p:0021 s:0007 b:0006 l:0015e8 d:000005 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/runner.rb:11
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:000118 d:000118 TOP
---------------------------
-- Ruby level backtrace information ----------------------------------------
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/runner.rb:11:in `block in autorun'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/runner.rb:69:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/runner.rb:80:in `run_in_process'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/command_line.rb:21:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/reporter.rb:12:in `report'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/command_line.rb:24:in `block in run'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/command_line.rb:24:in `map'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/command_line.rb:24:in `block (2 levels) in run'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:262:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:290:in `run_examples'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:290:in `map'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:294:in `block in run_examples'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example.rb:45:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example.rb:107:in `with_around_hooks'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example.rb:47:in `block in run'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example.rb:145:in `run_before_each'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:221:in `eval_before_eachs'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:221:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:221:in `block in eval_before_eachs'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:115:in `run_hook'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:69:in `run_all'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:69:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:69:in `block in run_all'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:32:in `run_in'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:32:in `instance_eval'
/home/egervari/websites/training/spec/queries/company_user_query_spec.rb:8:in `block (2 levels) in <top (required)>'
/usr/local/lib/ruby/gems/1.9.1/gems/factory_girl-1.3.3/lib/factory_girl/factory.rb:273:in `create'
/usr/local/lib/ruby/gems/1.9.1/gems/factory_girl-1.3.3/lib/factory_girl/factory.rb:321:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/factory_girl-1.3.3/lib/factory_girl/factory.rb:321:in `new'
/usr/local/lib/ruby/gems/1.9.1/gems/factory_girl-1.3.3/lib/factory_girl/proxy/build.rb:5:in `initialize'
/usr/local/lib/ruby/gems/1.9.1/gems/factory_girl-1.3.3/lib/factory_girl/proxy/build.rb:5:in `new'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/base.rb:1395:in `initialize'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/locking/optimistic.rb:62:in `attributes_from_column_definition'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/persistence.rb:284:in `attributes_from_column_definition'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/persistence.rb:284:in `inject'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/persistence.rb:284:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/persistence.rb:285:in `block in attributes_from_column_definition'
rake aborted!
Whenever I run "rake spec", there's a 70-80% chance that I get a SEGMENTATION_FAULT with Ruby. It usually happens with 2 stack traces: one with Factory_Girl, and the other with ActiveRecord. It is really odd. I have no idea what to do. This is the output when I run all of my tests:
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/persistence.rb:285: [BUG] Segmentation fault
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
-- control frame ----------
c:0048 p:0026 s:0171 b:0171 l:000156 d:000170 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/persistence.rb:285
c:0047 p:---- s:0167 b:0167 l:000166 d:000166 FINISH
c:0046 p:---- s:0165 b:0165 l:000160 d:000164 IFUNC
c:0045 p:---- s:0163 b:0163 l:000162 d:000162 CFUNC :each
c:0044 p:---- s:0161 b:0161 l:000160 d:000160 CFUNC :inject
c:0043 p:0025 s:0157 b:0157 l:000156 d:000156 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/persistence.rb:284
c:0042 p:0010 s:0154 b:0154 l:000153 d:000153 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/locking/optimistic.rb:62
c:0041 p:0014 s:0150 b:0150 l:000149 d:000149 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/base.rb:1395
c:0040 p:---- s:0145 b:0145 l:000144 d:000144 FINISH
c:0039 p:---- s:0143 b:0143 l:000142 d:000142 CFUNC :new
c:0038 p:0012 s:0140 b:0140 l:000139 d:000139 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/factory_girl-1.3.3/lib/factory_girl/proxy/build.rb:5
c:0037 p:---- s:0136 b:0136 l:000135 d:000135 FINISH
c:0036 p:---- s:0134 b:0134 l:000133 d:000133 CFUNC :new
c:0035 p:0019 s:0130 b:0130 l:000129 d:000129 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/factory_girl-1.3.3/lib/factory_girl/factory.rb:321
c:0034 p:0034 s:0123 b:0123 l:000122 d:000122 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/factory_girl-1.3.3/lib/factory_girl/factory.rb:273
c:0033 p:0076 s:0118 b:0118 l:002488 d:000117 BLOCK /home/egervari/websites/training/spec/queries/company_user_query_spec.rb:8
c:0032 p:---- s:0116 b:0116 l:000115 d:000115 FINISH
c:0031 p:---- s:0114 b:0114 l:000113 d:000113 CFUNC :instance_eval
c:0030 p:0019 s:0111 b:0111 l:000110 d:000110 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:32
c:0029 p:0014 s:0107 b:0107 l:000098 d:000106 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:69
c:0028 p:---- s:0104 b:0104 l:000103 d:000103 FINISH
c:0027 p:---- s:0102 b:0102 l:000101 d:000101 CFUNC :each
c:0026 p:0025 s:0099 b:0099 l:000098 d:000098 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:69
c:0025 p:0030 s:0095 b:0095 l:000094 d:000094 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:115
c:0024 p:0024 s:0089 b:0089 l:000080 d:000088 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:221
c:0023 p:---- s:0086 b:0086 l:000085 d:000085 FINISH
c:0022 p:---- s:0084 b:0084 l:000083 d:000083 CFUNC :each
c:0021 p:0054 s:0081 b:0081 l:000080 d:000080 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:221
c:0020 p:0039 s:0077 b:0077 l:000076 d:000076 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example.rb:145
c:0019 p:0011 s:0074 b:0074 l:001e60 d:000073 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example.rb:47
c:0018 p:0024 s:0071 b:0071 l:000070 d:000070 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example.rb:107
c:0017 p:0059 s:0067 b:0067 l:001e60 d:001e60 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example.rb:45
c:0016 p:0071 s:0061 b:0061 l:000050 d:000060 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:294
c:0015 p:---- s:0056 b:0056 l:000055 d:000055 FINISH
c:0014 p:---- s:0054 b:0054 l:000053 d:000053 CFUNC :map
c:0013 p:0017 s:0051 b:0051 l:000050 d:000050 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:290
c:0012 p:0096 s:0047 b:0047 l:000046 d:000046 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:262
c:0011 p:0014 s:0040 b:0040 l:000024 d:000039 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/command_line.rb:24
c:0010 p:---- s:0037 b:0037 l:000036 d:000036 FINISH
c:0009 p:---- s:0035 b:0035 l:000034 d:000034 CFUNC :map
c:0008 p:0035 s:0032 b:0032 l:000024 d:000031 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/command_line.rb:24
c:0007 p:0022 s:0029 b:0029 l:000028 d:000028 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/reporter.rb:12
c:0006 p:0113 s:0025 b:0025 l:000024 d:000024 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/command_line.rb:21
c:0005 p:0055 s:0020 b:0020 l:000019 d:000019 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/runner.rb:80
c:0004 p:0101 s:0014 b:0014 l:000013 d:000013 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/runner.rb:69
c:0003 p:0021 s:0007 b:0006 l:0015e8 d:000005 BLOCK /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/runner.rb:11
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:000118 d:000118 TOP
---------------------------
-- Ruby level backtrace information ----------------------------------------
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/runner.rb:11:in `block in autorun'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/runner.rb:69:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/runner.rb:80:in `run_in_process'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/command_line.rb:21:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/reporter.rb:12:in `report'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/command_line.rb:24:in `block in run'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/command_line.rb:24:in `map'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/command_line.rb:24:in `block (2 levels) in run'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:262:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:290:in `run_examples'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:290:in `map'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:294:in `block in run_examples'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example.rb:45:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example.rb:107:in `with_around_hooks'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example.rb:47:in `block in run'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example.rb:145:in `run_before_each'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:221:in `eval_before_eachs'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:221:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/example_group.rb:221:in `block in eval_before_eachs'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:115:in `run_hook'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:69:in `run_all'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:69:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:69:in `block in run_all'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:32:in `run_in'
/usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.3/lib/rspec/core/hooks.rb:32:in `instance_eval'
/home/egervari/websites/training/spec/queries/company_user_query_spec.rb:8:in `block (2 levels) in <top (required)>'
/usr/local/lib/ruby/gems/1.9.1/gems/factory_girl-1.3.3/lib/factory_girl/factory.rb:273:in `create'
/usr/local/lib/ruby/gems/1.9.1/gems/factory_girl-1.3.3/lib/factory_girl/factory.rb:321:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/factory_girl-1.3.3/lib/factory_girl/factory.rb:321:in `new'
/usr/local/lib/ruby/gems/1.9.1/gems/factory_girl-1.3.3/lib/factory_girl/proxy/build.rb:5:in `initialize'
/usr/local/lib/ruby/gems/1.9.1/gems/factory_girl-1.3.3/lib/factory_girl/proxy/build.rb:5:in `new'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/base.rb:1395:in `initialize'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/locking/optimistic.rb:62:in `attributes_from_column_definition'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/persistence.rb:284:in `attributes_from_column_definition'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/persistence.rb:284:in `inject'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/persistence.rb:284:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/persistence.rb:285:in `block in attributes_from_column_definition'
rake aborted!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来像是 Ruby 本身的一个错误。我敢打赌,GC 会启动并清除一些它不应该清除的东西。尝试在开始的某个地方执行 GC.disable 。
现在,Ruby 1.9.2p204 有一些 GC 修复,这可能是相关的,所以如果确实是 GC 的错,那么将你的 Ruby 更新到(至少)p204,看看问题是否仍然存在。
Looks like a bug in Ruby itself. My bet it that GC kicks in and sweeps something it should not have swept. Try to do GC.disable somewhere in the beginning.
Now, Ruby 1.9.2p204 had some GC fixes, which might be related, so if it's indeed GC to blame, then update your Ruby to (at least) p204, and see if the problem persists.