Why is my ruby ​​crash / segfault during tests?

I read in places that this might have something to do with sqlite3, but my googling did not bring anything useful. Here is an example error: https://travis-ci.org/NullVoxPopuli/aeonvera/jobs/61047991

It seems to happen by accident - both on my car and on the trauma. Therefore, I have to restart rspec until it passes, which is very annoying, since my test package takes a couple of minutes.

How is this caused? and how can i prevent this? It’s stupid to actively engage with your CI to re-run the specifications until they pass.

I use sqlite3 to run all my specifications in memory - this is a good speed bonus, and also helps me make sure that I am not making any queries related to db (my production application uses pgsql)

Here is a link to my repo if anyone is interested: https://github.com/NullVoxPopuli/aeonvera

UPDATE

This is not specific to sqlite3 - this happens when using postgresql.

Stacktrace

/home/preston/.rvm/gems/ruby-2.2.1/gems/activerecord-4.1.10/lib/active_record/connection_adapters/postgresql/database_statements.rb:128: [BUG] Segmentation fault at 0x000000000001d4 ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux] -- Control frame information ----------------------------------------------- c:0057 p:---- s:0311 e:000310 CFUNC :backtrace c:0056 p:0009 s:0310 e:000309 RESCUE /home/preston/.rvm/gems/ruby-2.2.1/gems/activesupport-4.1.10/lib/active_support/notifications/instrumenter.rb:25 c:0055 p:0037 s:0307 e:000305 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/activesupport-4.1.10/lib/active_support/notifications/instrumenter.rb:25 c:0054 p:0034 s:0300 e:000299 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract_adapter.rb:378 c:0053 p:0014 s:0292 e:000291 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/activerecord-4.1.10/lib/active_record/connection_adapters/postgresql/database_statement c:0052 p:0019 s:0286 e:000286 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/savepoints.rb:17 c:0051 p:0014 s:0283 e:000282 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/transaction.rb:114 c:0050 p:0009 s:0280 e:000279 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/database_statements. c:0049 p:0018 s:0277 e:000276 RESCUE /home/preston/.rvm/gems/ruby-2.2.1/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/database_statements. c:0048 p:0035 s:0274 e:000272 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/database_statements. c:0047 p:0078 s:0267 e:000266 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/database_statements. c:0046 p:0017 s:0263 e:000262 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/activerecord-4.1.10/lib/active_record/transactions.rb:208 c:0045 p:0014 s:0262 E:001878 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/activerecord-4.1.10/lib/active_record/transactions.rb:326 c:0044 p:0010 s:0256 e:000255 RESCUE c:0043 p:---- s:0225 e:000221 CFUNC :initialize_copy c:0042 p:---- s:0221 e:000220 CFUNC :unlock c:0041 p:0024 s:0223 e:000220 BLOCK /home/preston/.rvm/gems/ruby-2.2.1/gems/railties-4.1.10/lib/rails/backtrace_cleaner.rb:10 [FINISH] c:0040 p:---- s:0218 e:000217 CFUNC :call c:0039 p:0012 s:0214 e:000213 BLOCK /home/preston/.rvm/gems/ruby-2.2.1/gems/activesupport-4.1.10/lib/active_support/backtrace_cleaner.rb:85 [FINISH] c:0038 p:---- s:0211 e:000210 CFUNC :map c:0037 p:0010 s:0208 e:000207 BLOCK /home/preston/.rvm/gems/ruby-2.2.1/gems/activesupport-4.1.10/lib/active_support/backtrace_cleaner.rb:85 [FINISH] c:0036 p:---- s:0205 e:000204 CFUNC :each c:0035 p:0011 s:0202 e:000201 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/activesupport-4.1.10/lib/active_support/backtrace_cleaner.rb:84 c:0034 p:0015 s:0198 e:000197 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/activesupport-4.1.10/lib/active_support/backtrace_cleaner.rb:37 c:0033 p:0025 s:0192 e:000191 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/actionpack-4.1.10/lib/action_dispatch/middleware/exception_wrapper.rb:89 c:0032 p:0009 s:0188 e:000187 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/actionpack-4.1.10/lib/action_dispatch/middleware/exception_wrapper.rb:49 c:0031 p:0037 s:0185 e:000184 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/actionpack-4.1.10/lib/action_dispatch/middleware/debug_exceptions.rb:74 c:0030 p:0028 s:0177 e:000176 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/actionpack-4.1.10/lib/action_dispatch/middleware/debug_exceptions.rb:34 c:0029 p:0045 s:0166 e:000165 RESCUE /home/preston/.rvm/gems/ruby-2.2.1/gems/actionpack-4.1.10/lib/action_dispatch/middleware/debug_exceptions.rb:27 c:0028 p:0091 s:0163 e:000162 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/actionpack-4.1.10/lib/action_dispatch/middleware/debug_exceptions.rb:17 c:0027 p:0011 s:0154 e:000153 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/actionpack-4.1.10/lib/action_dispatch/middleware/show_exceptions.rb:30 c:0026 p:0077 s:0149 e:000148 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/railties-4.1.10/lib/rails/rack/logger.rb:38 c:0025 p:0011 s:0142 e:000141 BLOCK /home/preston/.rvm/gems/ruby-2.2.1/gems/railties-4.1.10/lib/rails/rack/logger.rb:20 c:0024 p:0007 s:0140 e:000139 BLOCK /home/preston/.rvm/gems/ruby-2.2.1/gems/activesupport-4.1.10/lib/active_support/tagged_logging.rb:68 c:0023 p:0018 s:0138 e:000137 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/activesupport-4.1.10/lib/active_support/tagged_logging.rb:26 c:0022 p:0013 s:0133 e:000132 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/activesupport-4.1.10/lib/active_support/tagged_logging.rb:68 c:0021 p:0042 s:0129 e:000128 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/railties-4.1.10/lib/rails/rack/logger.rb:20 c:0020 p:0077 s:0124 e:000123 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/quiet_assets-1.1.0/lib/quiet_assets.rb:27 c:0019 p:0011 s:0120 e:000119 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/request_store-1.1.0/lib/request_store/middleware.rb:8 c:0018 p:0031 s:0116 e:000115 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/actionpack-4.1.10/lib/action_dispatch/middleware/request_id.rb:21 c:0017 p:0071 s:0112 e:000111 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/rack-1.5.3/lib/rack/methodoverride.rb:21 c:0016 p:0024 s:0107 e:000106 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/rack-1.5.3/lib/rack/runtime.rb:17 c:0015 p:0035 s:0098 e:000097 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/activesupport-4.1.10/lib/active_support/cache/strategy/local_cache_middleware.rb:26 c:0014 p:0091 s:0093 e:000092 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/actionpack-4.1.10/lib/action_dispatch/middleware/static.rb:84 c:0013 p:0011 s:0087 e:000086 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/rack-1.5.3/lib/rack/sendfile.rb:112 c:0012 p:0058 s:0077 e:000076 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/railties-4.1.10/lib/rails/engine.rb:514 c:0011 p:0036 s:0073 e:000072 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/railties-4.1.10/lib/rails/application.rb:144 c:0010 p:0011 s:0069 e:000068 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/rack-1.5.3/lib/rack/builder.rb:138 c:0009 p:0148 s:0065 e:000064 BLOCK /home/preston/.rvm/gems/ruby-2.2.1/gems/rack-1.5.3/lib/rack/urlmap.rb:65 [FINISH] c:0008 p:---- s:0057 e:000056 CFUNC :each c:0007 p:0054 s:0054 e:000053 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/rack-1.5.3/lib/rack/urlmap.rb:50 c:0006 p:0045 s:0045 e:000044 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/capybara-2.4.4/lib/capybara/server.rb:19 c:0005 p:0301 s:0040 e:000039 METHOD /home/preston/.rvm/gems/ruby-2.2.1/gems/rack-1.5.3/lib/rack/handler/webrick.rb:60 c:0004 p:0211 s:0028 e:000027 METHOD /home/preston/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/httpserver.rb:138 c:0003 p:0370 s:0018 e:000017 METHOD /home/preston/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/httpserver.rb:94 c:0002 p:0103 s:0007 e:000006 BLOCK /home/preston/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/server.rb:294 [FINISH] c:0001 p:---- s:0002 e:000001 TOP [FINISH] 

All other information: http://pastebin.com/d6Tm13ww

+7
ruby ruby-on-rails sqlite3 rspec
source share
1 answer

You can try to return to the git history until you get the state in which it is stable. And from there they make changes to isolate the "bad" changes.

In addition, you should avoid using on sqlite3 even in tests. Tests should be as close to production as possible.

+3
source share

All Articles