onierstrasz / IMAD

experiments using Gt and Mondrian to build executable domain models
MIT License
3 stars 1 forks source link

Strange Heisenbug in graph display #32

Closed onierstrasz closed 3 years ago

onierstrasz commented 3 years ago

HypernodeTestExamples>>#flatGraphTwoNodes sometimes shows node a linked to itself. (In one test run 6 times out of 20!) Strangely we add a name property to each node, it never happens.

Screenshot 2020-12-11 at 16 22 57

Inspecting self storeString shows that the wiring is correct, and self generatedValue again shows random displays. This suggests that the problem is not in the model but in the view.

Should be false (OK): self edges first source == self edges first target Interestingly, once we have a bad node, self asElement consistently shows it as such But self generatedValue shows random results, so the problem also appears with nodes generated by the builder. So maybe there is something funny about the model ... Inspecting the model Hyperlink clearly shows it connects two different nodes!

onierstrasz commented 3 years ago

The problem was that I used a Dictionary instead of an IdentityDictionary to map nodes to their elements. Probably this led to hash collision problems, since all empty nodes are equal.