Skip to content

Chained hashmap iteration sometimes misses items even in sane use #2049

Closed
@marijnh

Description

@marijnh

Where 'sane use' is defined as the iter body only overwriting the key that is currently being inspected, and not adding or removing any others.

In the following scenario:

  • Map is filled to a point where the next insert will trigger a grow/rehash
  • Iterate
  • Iteration body overwrites its current key

The insert method will rehash at this point, whether the inserted key is new or not. This will throw off the iteration and cause it to miss some key,value pairs.

Seems to be fixed by simply only rehashing when an actual insert occurred. Patch forthcoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions