Skip to content
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

[bug] toposort Loop Not Ending when Graph is Finished #1132

Closed
nathannaveen opened this issue Aug 7, 2023 · 3 comments
Closed

[bug] toposort Loop Not Ending when Graph is Finished #1132

nathannaveen opened this issue Aug 7, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@nathannaveen
Copy link
Contributor

Describe the bug

On line 30 of pkg/guacanalytics/toposort.go:

for numNodes <= totalNodes {

I think that it shouldn't be numNodes <= totalNodes, and should actually be numNodes < totalNodes. The reason for this being on line 41:

if len(foundIDs) == 0 {
return frontiers, fmt.Errorf("Error: cycle detected")
}

We are checking for whether len(foundIDs) == 0. If numNodes == totalNodes then we have gone through all the nodes and have no more nodes to find, so len(foundIDs) will equal 0.

I am not sure whether this is intentional because the error message is fmt.Errorf("error: cycle detected"), even though in this case there will be no cycle.

@nathannaveen nathannaveen added the bug Something isn't working label Aug 7, 2023
@nathannaveen
Copy link
Contributor Author

cc @rmetzman

@rmetzman
Copy link
Contributor

rmetzman commented Aug 7, 2023

#1129 This PR fixes the issue but it does not apply the change with the len(parents) from your other fix because the PR hasn't been merged yet.

@nathannaveen
Copy link
Contributor Author

This gets fixed with #1129.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants