Skip to content

rehashing regression with compare_by_identity #5304

@ahorek

Description

@ahorek

Environment

jruby 9.2.1.0-SNAPSHOT (2.5.0) 2018-08-29 dad052a Java HotSpot(TM) 64-Bit Server VM 10.0.1+10 on 10.0.1+10 +jit [mswin32-x86_64]

probably related to the new hash implementation #5215 , @ChrisBr ?

it "rehashes internally so that old keys can be looked up" do

1000.times do
  h = {}
  (1..10).each { |k| h[k] = k }
  o = Object.new
  def o.hash; 123; end
  h[o] = 1
  h.compare_by_identity
  puts h[o] == 1
end

another example (fails randomly)
https://travis-ci.org/rails/sprockets/jobs/422225343

Expected Behavior

should always return true

Actual Behavior

true
true
true
false
true
true
true
true
true
true
true
false
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
false
true
true
true
true
true
true
false
false
true
true
true
true
true
true
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions