-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
AdjacencyMap may cause panic #102
Comments
We have experienced this also in a non concurrent environment. |
@davidovich Yes. |
Because the store could theoretically be updated without the use of the main `AddVertex` and `AddEdge` APIs (which does some input validation), calculating the `AdjencyMap` could provoke an "assignment to entry in nil map" panic if the store reported edges that were between unknown vertices. Since the edges are always between known vertices, it is an error to try and match a missing source vertex from the vertex set. If that happens, it is a data desynchronization error that we report to the user. In order to test this pathological case, we needed to modify the test to use the store directly because the "front-facing" API would not allow us to add Edges on missing vertex. fixes dominikbraun#102 Signed-off-by: davidovich <[email protected]>
While investigating this issue, it appeared to me that the code is correct on assuming the presence of a vertex, hence it would be, IMHO, a bad fix to just initialize the map on an un-existing source vertex because that would create a degenerate edge. In our implementation of the store interface, we hit a panic because the store was returning edges with vertices that did not exist. So I went and opened a PR for reporting that error instead of panicking. |
Concurrent calls to AddVertex, AddEdge, and AdjacencyMap redundantly panic.
ListVertices and ListEdges directly occur AddVertex and AddEdge will cause this problem
The text was updated successfully, but these errors were encountered: