Skip to content

Fix crash when parsing previous version resultset.json  #820

Closed

Description

@PragTob

We changed our file format with the 0.18.0 release series - unfortunately our code still seems to want to read the old file format and then break ;) We gotta be more careful there. I don't think we need to be able to read all old versions of files but I think we should rather capture the error and continue without processing the old results (easiest to achieve I believe).

This is my preliminary diagnosis, problems goes away when deleting the coverage directory.
Reported by @klyonrad #781 (comment)

bundle show simplecov
/Users/username/.rvm/gems/ruby-2.6.5/gems/simplecov-0.18.0.beta1

bundle show simplecov-html
/Users/username/.rvm/gems/ruby-2.6.5/gems/simplecov-html-0.11.0.beta1

bundle exec rspec spec/policies
Run options: exclude {:future=>true}                                                                                 

Randomized with seed 25469
 237/237 |========================================== 100 ==========================================>| Time: 00:00:23 

Finished in 23.37 seconds (files took 10.5 seconds to load)
237 examples, 0 failures

Randomized with seed 25469
Traceback (most recent call last):
	15: from /Users/username/.rvm/gems/ruby-2.6.5/gems/simplecov-0.18.0.beta1/lib/simplecov/defaults.rb:29:in `block in <top (required)>'
	14: from /Users/username/.rvm/gems/ruby-2.6.5/gems/simplecov-0.18.0.beta1/lib/simplecov.rb:164:in `run_exit_tasks!'
	13: from /Users/username/.rvm/gems/ruby-2.6.5/gems/simplecov-0.18.0.beta1/lib/simplecov/configuration.rb:196:in `block in at_exit'
	12: from /Users/username/.rvm/gems/ruby-2.6.5/gems/simplecov-0.18.0.beta1/lib/simplecov.rb:74:in `result'
	11: from /Users/username/.rvm/gems/ruby-2.6.5/gems/simplecov-0.18.0.beta1/lib/simplecov/result_merger.rb:83:in `merged_result'
	10: from /Users/username/.rvm/gems/ruby-2.6.5/gems/simplecov-0.18.0.beta1/lib/simplecov/result_merger.rb:57:in `results'
	 9: from /Users/username/.rvm/gems/ruby-2.6.5/gems/simplecov-0.18.0.beta1/lib/simplecov/result_merger.rb:57:in `each'
	 8: from /Users/username/.rvm/gems/ruby-2.6.5/gems/simplecov-0.18.0.beta1/lib/simplecov/result_merger.rb:58:in `block in results'
	 7: from /Users/username/.rvm/gems/ruby-2.6.5/gems/simplecov-0.18.0.beta1/lib/simplecov/result.rb:72:in `from_hash'
	 6: from /Users/username/.rvm/gems/ruby-2.6.5/gems/simplecov-0.18.0.beta1/lib/simplecov/result.rb:86:in `symbolize_names_of_coverage_results'
	 5: from /Users/username/.rvm/gems/ruby-2.6.5/gems/simplecov-0.18.0.beta1/lib/simplecov/result.rb:86:in `each_with_object'
	 4: from /Users/username/.rvm/gems/ruby-2.6.5/gems/simplecov-0.18.0.beta1/lib/simplecov/result.rb:86:in `each'
	 3: from /Users/username/.rvm/gems/ruby-2.6.5/gems/simplecov-0.18.0.beta1/lib/simplecov/result.rb:87:in `block in symbolize_names_of_coverage_results'
	 2: from /Users/username/.rvm/gems/ruby-2.6.5/gems/simplecov-0.18.0.beta1/lib/simplecov/result.rb:87:in `each_with_object'
	 1: from /Users/username/.rvm/gems/ruby-2.6.5/gems/simplecov-0.18.0.beta1/lib/simplecov/result.rb:87:in `each'
/Users/username/.rvm/gems/ruby-2.6.5/gems/simplecov-0.18.0.beta1/lib/simplecov/result.rb:88:in `block (2 levels) in symbolize_names_of_coverage_results': undefined method `to_sym' for 1:Integer (NoMethodError)
Did you mean?  to_s

#781

Activity

  1. PragTob commented on Jan 15, 2020

    @PragTob
    CollaboratorAuthor

    fix-crash-against-old-resultset-json has a scenario aimed at reproducing this.

    Right now it's incomplete because of:

         if use_merging
            wait_for_other_processes
            SimpleCov::ResultMerger.store_result(@result) if result?
            @result = SimpleCov::ResultMerger.merged_result
          end

    If store_result is executed before the result merging then this bug doesn't trigger. So gotta make result? be false in the scenario :)

  2. PragTob commented on Jan 15, 2020

    @PragTob
    CollaboratorAuthor

    WIP fix/reproduction is up at #824

  3. added 3 commits that reference this issue on Jan 16, 2020
  4. PragTob commented on Jan 19, 2020

    @PragTob
    CollaboratorAuthor

    Fixed in #824

  5. added theissue type on May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions