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

SparseSet components cause incorrect Query output #7831

Closed
hankjordan opened this issue Feb 27, 2023 · 1 comment
Closed

SparseSet components cause incorrect Query output #7831

hankjordan opened this issue Feb 27, 2023 · 1 comment
Labels
A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior P-Critical This must be fixed immediately or contributors or users will be severely impacted P-Unsound A bug that results in undefined compiler behavior
Milestone

Comments

@hankjordan
Copy link
Contributor

hankjordan commented Feb 27, 2023

Bevy version

#41fec57

What you did

Not present in 0.9, but is at least as old as commit #943499.

It can be triggered by spawning many entities (10,000?) with both Table and SparseSet components and inserting / removing SparseSet components quickly

The bug manifests itself by messing with query results, returning incorrect values for a given entity.
These values are valid, just not for the Entity I am querying for.

The bug disappears when I switch all of the components to use Table storage.

Here is a log from my game.
I never update the components Transform or ChunkPos for these entities, it's only set once when the entity is spawned.
Note that the entity is the same in each tick, I am checking the same Entity and have disabled despawning:

INFO world2: Check: 6676v0 - Transform { translation: Vec3(0.0, 0.0, 0.0), rotation: Quat(0.0, 0.0, 0.0, 1.0), scale: Vec3(1.0, 1.0, 1.0) } - ChunkPos { x: 0, y: 0, z: 0 }
INFO world2: Check: 6676v0 - Transform { translation: Vec3(0.0, 0.0, 0.0), rotation: Quat(0.0, 0.0, 0.0, 1.0), scale: Vec3(1.0, 1.0, 1.0) } - ChunkPos { x: 0, y: 0, z: 0 }
INFO world2: Check: 6676v0 - Transform { translation: Vec3(0.0, 0.0, 0.0), rotation: Quat(0.0, 0.0, 0.0, 1.0), scale: Vec3(1.0, 1.0, 1.0) } - ChunkPos { x: 0, y: 0, z: 0 }
INFO world2: Check: 6676v0 - Transform { translation: Vec3(240.0, 128.0, 32.0), rotation: Quat(0.0, 0.0, 0.0, 1.0), scale: Vec3(1.0, 1.0, 1.0) } - ChunkPos { x: 15, y: 8, z: 2 }
INFO world2: Check: 6676v0 - Transform { translation: Vec3(144.0, 64.0, -16.0), rotation: Quat(0.0, 0.0, 0.0, 1.0), scale: Vec3(1.0, 1.0, 1.0) } - ChunkPos { x: 9, y: 4, z: -1 }

What went wrong

  • Query::get returned unexpectedly changed values, when no part of the code is actually modifying the values

Additional Information

  • The SparseSet components are ZST
  • No repro yet, sorry
@hankjordan hankjordan added C-Bug An unexpected or incorrect behavior A-ECS Entities, components, systems, and events labels Feb 27, 2023
@hankjordan
Copy link
Contributor Author

Appears to be fixed by #7805

@james7132 james7132 added P-Unsound A bug that results in undefined compiler behavior P-Critical This must be fixed immediately or contributors or users will be severely impacted labels Feb 27, 2023
@james7132 james7132 added this to the 0.10 milestone Feb 27, 2023
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 P-Critical This must be fixed immediately or contributors or users will be severely impacted P-Unsound A bug that results in undefined compiler behavior
Projects
None yet
Development

No branches or pull requests

2 participants