Zannick / logic-graph

Tools for video game logic representation and analysis, particularly routing and beatability checks for speedruns and randomizers.
MIT License
3 stars 0 forks source link

Error handling for cycles detected in the statedb #185

Open Zannick opened 1 week ago

Zannick commented 1 week ago

This can randomly cause a crash. The one I experienced today:

Cycle of length 2 found ending at depth 0:
[[A(Global__Become_Drone)], [A(Global__Become_Indra)]]

These are actions that reverse each other, so while technically a valid sequence of actions, whichever was the last one (I suspect Become Drone based on detect_cycle) should not have resulted in a state being written. However, if it was a state that already existed, and it was found to be faster to reach by becoming drone from a state that was Indra, and that was found to be faster by becoming Indra from a state that was drone... anyway, I'm not sure if this is resolved on its own by the thread that's writing each of these improvements, or if it's a permanent effect of a race condition or order of operations weirdness. If it will resolve on its own, we could just wrap the direct caller into an error handling function that will sleep and try again a small number of times. If not... we need some other resolution such as rewriting the state (which would require figuring it out again).