Sending CharacterMoveInputEvent from BT Node is unsafe #2468
Labels
Topic: Architecture
Requests, Issues and Changes related to software architecture, programming patterns, etc.
Type: Bug
Issues reporting and PRs fixing problems
What you were trying to do
Move a character from a behavior tree Node
What actually happened
Crashed with concurrent modification exception
How to reproduce
Create a behavior node that moves an entity fast enough to take collision damage, and allow it to kill itself in this process.
I discovered this while having very fast deer run off the side of a hill.
Log details and game version
I was able to capture the problem with a wach point in IntelliJ, getting the bug to occur takes a couple minutes but always happens under the conditions described above eventually. More generally, destroying any entity with a Behavior component from within a behavior Node will trigger a similar Exception.
As you can see below, we modify the interpreter list while iterating through it:
https://github.com/MovingBlocks/Terasology/blob/develop/engine/src/main/java/org/terasology/logic/behavior/BehaviorSystem.java#L100
https://github.com/MovingBlocks/Terasology/blob/develop/engine/src/main/java/org/terasology/logic/behavior/BehaviorSystem.java#L107
The text was updated successfully, but these errors were encountered: