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

Fix ambiguous_with breaking run conditions #9253

Merged
merged 3 commits into from
Aug 3, 2023

Conversation

geieredgar
Copy link
Contributor

@geieredgar geieredgar commented Jul 23, 2023

Objective

Solution

Inside ScheduleGraph::build_schedule() the variable node_count = self.systems.len() + self.system_sets.len() is used to calculate the indices for the reachable bitset derived from self.hierarchy.graph. However, the number of nodes inside self.hierarchy.graph does not always correspond to self.systems.len() + self.system_sets.len() when ambiguous_with is used, because an ambiguous set is added to system_sets (because we need an NodeId for the ambiguity graph) without adding a node to self.hierarchy.

In this PR, we rename node_count to the more descriptive name hg_node_count and set it to self.hierarchy.graph.node_count().

@alice-i-cecile alice-i-cecile added this to the 0.11.1 milestone Jul 23, 2023
@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-ECS Entities, components, systems, and events labels Jul 23, 2023
@hymm hymm requested a review from maniwani July 23, 2023 20:24
Copy link
Contributor

@maniwani maniwani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! Your assessment seems correct to me. Even though it's very subtle, I'm a little surprised this bug went unnoticed until now. Thank you for solving this so quickly.

@JoJoJet
Copy link
Member

JoJoJet commented Aug 2, 2023

Good fix. Can you add a regression test to make sure this doesn't resurface?

@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2023

Example scene failed to run, please try running it locally and check the result.

@geieredgar
Copy link
Contributor Author

Example scene failed to run, please try running it locally and check the result.

The failed example is from a commit I've accidentally pushed with the regression test commit, if anyone wonders.

@JoJoJet JoJoJet added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Aug 3, 2023
@james7132 james7132 added this pull request to the merge queue Aug 3, 2023
Merged via the queue into bevyengine:main with commit 731a6fb Aug 3, 2023
20 checks passed
cart pushed a commit that referenced this pull request Aug 10, 2023
# Objective

- Fixes #9114

## Solution

Inside `ScheduleGraph::build_schedule()` the variable `node_count =
self.systems.len() + self.system_sets.len()` is used to calculate the
indices for the `reachable` bitset derived from `self.hierarchy.graph`.
However, the number of nodes inside `self.hierarchy.graph` does not
always correspond to `self.systems.len() + self.system_sets.len()` when
`ambiguous_with` is used, because an ambiguous set is added to
`system_sets` (because we need an `NodeId` for the ambiguity graph)
without adding a node to `self.hierarchy`.

In this PR, we rename `node_count` to the more descriptive name
`hg_node_count` and set it to `self.hierarchy.graph.node_count()`.

---------

Co-authored-by: James Liu <contact@jamessliu.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ambiguous_with breaks run conditions
5 participants