- 
                Notifications
    
You must be signed in to change notification settings  - Fork 201
 
http-api: edit MultiMap.getKeys() to return a LinkedHashSet to prevent non-deterministic behaviors in MultiMap.hashCode() #3358
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
base: main
Are you sure you want to change the base?
Conversation
| 
           Hi @lawrencewang49, Interesting, I haven't seen   | 
    
| 
           @idelpivnitskiy Yes! 
 
 Running that command resulted in the following output for a few runs: and similar output for another run: The reason I believe that it's non-deterministic is because the hashCode() inconsistency arises from  Equality checks remain valid since equals() doesn’t depend on key iteration order, only the hash codes vary. If   | 
    
| 
           Heh, that's a great catch! Thanks a lot for detailed explanation.  | 
    
Motivation The test headersWithSameNamesAndValuesShouldBeEquivalent included assertions comparing hashCode() values, resulting in failing assertions because the hashCode() implementation for AbstractHttpHeaders is non-deterministic, even for the same object. Modifications Removes all hashCode() assertions Result No failing flaky tests when running testing with nondex
…hset when getting keys to remove non-deterministic behaviors
fb5c1e1    to
    6162a9d      
    Compare
  
    
          
 Done!  | 
    
Motivation
headersWithSameNamesAndValuesShouldBeEquivalentinAbstractHttpHeadersTestincluded assertions onhashCode()that were failing unpredictably:headers1.hashCode() != headers1.hashCode()headers2.hashCode() != headers2.hashCode()headers1.hashCode() != headers2.hashCode()These failures occur because the hashCode() implementation is non-deterministic for these header objects. The assertions were invalid and caused unreliable test failures with nondex.
Modifications
Result