Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation Fault when running all specs with RSpec #208

Closed
georgeu2000 opened this issue Feb 26, 2013 · 8 comments
Closed

Segmentation Fault when running all specs with RSpec #208

georgeu2000 opened this issue Feb 26, 2013 · 8 comments
Labels

Comments

@georgeu2000
Copy link

The following causes a segmentation fault, but only when simplecov is in Gemfile:

c.run_all_when_everything_filtered = true

When set to false, there is no seg fault.

More RSpec config:

RSpec.configure do |c|
  c.filter_run :focus => true
  c.filter_run_excluding :slow  => true
  c.run_all_when_everything_filtered = true
  c.include FactoryGirl::Syntax::Methods
end

simplecov (0.7.1)
guard (1.6.2)
guard-rspec (2.4.1)
Ruby 1.9.3p125 and 1.9.3p374

ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.4.2]

* Loaded features
0 enumerator.so
1 /Users/george/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/x86_64-darwin11.4.2/enc/encdb.bundle
....
525 /Users/george/.rbenv/versions/1.9.3-p125/gemsets/ruby-bitcoin/gems/rspec-expectations-2.12.1/lib/rspec/expectations/differ.rb
526 /Users/george/.rbenv/versions/1.9.3-p125/gemsets/ruby-bitcoin/gems/rspec-expectations-2.12.1/lib/rspec/expectations.rb
@colszowka
Copy link
Collaborator

You're 7 patch-level releases of Ruby 1.9.3 behind - could you please update to the latest 1.9.3-p392 and try again?

@georgeu2000
Copy link
Author

I saw the same symptom on 1.9.3p374, but I no longer think it is coming from simplecov.

It seems to happen when I change the Gemfile. Not only with simplecov. Have never seen this before...perhaps because I am working with threads.

@colszowka
Copy link
Collaborator

Alright, good luck figuring your problems out then! Maybe you can separate your specs into unit tests that test your individual components thread-less and a separate integration-style suite that puts it all together - I think that'd make it easier for you to find bugs in your threading implementation. I'd also strongly recommend checking out the celluloid gem when working with threads, it makes structuring and maintaining things a lot easier through things like supervision groups, though it surely is not applicable to everything. It's what the popular sidekiq gem uses under the hood, too.

@garysweaver
Copy link

Getting same problem, also using rspec 2.12.0, Rails 3.2.x, OS X 10.7.5:

(erb):35: [BUG] Segmentation fault
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin11.4.2]

-- Control frame information -----------------------------------------------
c:0024 p:---- s:0087 b:0087 l:000086 d:000086 CFUNC  :round
c:0023 p:0132 s:0083 b:0082 l:0012e0 d:000081 BLOCK  (erb):35
c:0022 p:---- s:0079 b:0079 l:000078 d:000078 FINISH
c:0021 p:---- s:0077 b:0077 l:000076 d:000076 CFUNC  :each
c:0020 p:0501 s:0074 b:0074 l:0012e0 d:001280 EVAL   (erb):32
c:0019 p:---- s:0071 b:0071 l:000070 d:000070 FINISH
c:0018 p:---- s:0069 b:0069 l:000068 d:000068 CFUNC  :eval
c:0017 p:0062 s:0062 b:0062 l:000061 d:000061 METHOD /path/to/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/erb.rb:838
c:0016 p:0052 s:0058 b:0058 l:0012e0 d:0012e0 METHOD /path/to/gems/simplecov-html-0.7.1/lib/simplecov-html.rb:58
c:0015 p:0387 s:0052 b:0051 l:001e50 d:001e80 EVAL   (erb):21
c:0014 p:---- s:0048 b:0048 l:000047 d:000047 FINISH
c:0013 p:---- s:0046 b:0046 l:000045 d:000045 CFUNC  :eval
c:0012 p:0062 s:0039 b:0039 l:000038 d:000038 METHOD /path/to/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/erb.rb:838
c:0011 p:0027 s:0035 b:0034 l:001e50 d:000050 BLOCK  /path/to/gems/simplecov-html-0.7.1/lib/simplecov-html.rb:19
c:0010 p:---- s:0031 b:0031 l:000030 d:000030 FINISH
c:0009 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC  :open
c:0008 p:0089 s:0024 b:0024 l:001e50 d:001e50 METHOD /path/to/gems/simplecov-html-0.7.1/lib/simplecov-html.rb:18
c:0007 p:0030 s:0020 b:0020 l:000019 d:000019 METHOD /path/to/gems/simplecov-0.7.1/lib/simplecov/result.rb:91
c:0006 p:0021 s:0017 b:0017 l:001dd0 d:000016 BLOCK  /path/to/gems/simplecov-0.7.1/lib/simplecov/configuration.rb:133
c:0005 p:---- s:0015 b:0015 l:000014 d:000014 FINISH
c:0004 p:---- s:0013 b:0013 l:000012 d:000012 CFUNC  :call
c:0003 p:0070 s:0010 b:0010 l:000760 d:000009 BLOCK  /path/to/gems/simplecov-0.7.1/lib/simplecov/defaults.rb:52
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001828 d:001828 TOP   

-- Ruby level backtrace information ----------------------------------------
/path/to/gems/simplecov-0.7.1/lib/simplecov/defaults.rb:52:in `block in <top (required)>'
/path/to/gems/simplecov-0.7.1/lib/simplecov/defaults.rb:52:in `call'
/path/to/gems/simplecov-0.7.1/lib/simplecov/configuration.rb:133:in `block in at_exit'
/path/to/gems/simplecov-0.7.1/lib/simplecov/result.rb:91:in `format!'
/path/to/gems/simplecov-html-0.7.1/lib/simplecov-html.rb:18:in `format'
/path/to/gems/simplecov-html-0.7.1/lib/simplecov-html.rb:18:in `open'
/path/to/gems/simplecov-html-0.7.1/lib/simplecov-html.rb:19:in `block in format'
/path/to/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/erb.rb:838:in `result'
/path/to/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/erb.rb:838:in `eval'
(erb):21:in `block in format'
/path/to/gems/simplecov-html-0.7.1/lib/simplecov-html.rb:58:in `formatted_file_list'
/path/to/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/erb.rb:838:in `result'
/path/to/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/erb.rb:838:in `eval'
(erb):32:in `formatted_file_list'
(erb):32:in `each'
(erb):35:in `block in formatted_file_list'
(erb):35:in `round'

Fails when a require was pointing at something that was missing and immediately after reporting test results after running a set of tests. Fails every time.

Simplecov works great for coverage in a gem I test with rspec, though, so I don't think is rspec. Trying to track down what is causing the problem.

@garysweaver
Copy link

Now works great! Removed ruby-prof 0.11.2 (which was probably the problem) and switched to requiring/starting in initializer per this comment.

@alexperto
Copy link

guys, do you have any update about this? I have the same problem in jenkins

@MaicolBen
Copy link

I have the same issue on ruby 2.4.2 and simplecov 0.13, 0.14 and 0.15

@PragTob
Copy link
Collaborator

PragTob commented Nov 17, 2017

Most likely it's a ruby bug. We don't usually segfault but the Coverage library we use underneath.

You can check that out by just doing:

require "coverage"
Coverage.start
# your test suite
p Coverage.result

http://ruby-doc.org/stdlib-2.3.0/libdoc/coverage/rdoc/Coverage.html

Without a sample application there's probably also not much that ruby core can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants