goshimmer icon indicating copy to clipboard operation
goshimmer copied to clipboard

OrderedMap.ForEach is not "really" thread safe

Open hmoog opened this issue 1 year ago • 0 comments

Bug description

OrderedMap.ForEach can result in a situation, where the iteration order is somewhat undefined while we are iterating if the elements get mutated during the iteration

Expected behaviour

Calling ForEach should give us the elements that are in the map by the time ForEach is called (make a copy).

Actual behaviour

Calling ForEach locks only each iterated entry, which means that if the order changes in between, we might miss or skip some entries.

hmoog avatar Mar 17 '23 12:03 hmoog