Files
flame/.github
Luan Nico c2afe11f2c fix: Fix priority rebalancing causing concurrent mutation of component ordered_set (#3530)
Fix priority rebalancing causing concurrent mutation of component
ordered_set.

This fixes https://github.com/flame-engine/flame/issues/3363

Basically priority changes and rebalancing was not using the component
lifecycle event queue, which caused concurrent mutations and iterations
of the component set, and due to race conditions, loss of components as
they are removed and re-added for rebalancing.

The issue is not with ordered_set itself, but rather how it is being
used. It was never designed to support concurrent mutations.

A few notes for the future:

* I think we should consider changing the whole event (input) system so
that every event is queued and only processed predictably within the
game loop, avoiding a whole class of concurrent modification issues
* we should consider more efficient ways of rebalancing than literally
removing every single component + re-adding (which is also error prone
if there is concurrent access).

---------

Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2025-03-21 22:06:20 +00:00
..
2023-03-21 07:14:11 +00:00