BeeStation / BeeStation-Hornet

99.95% station. 0.05% bees
https://beestation13.com
GNU Affero General Public License v3.0
200 stars 681 forks source link

Potential issue with asynchronous shuttle loading causing half of shuttles to be deleted #8782

Open PowerfulBacon opened 1 year ago

PowerfulBacon commented 1 year ago

I found an issue on a local fork during testing that some weird behaviour can occur when calling initiate docking outside of the shuttle subsystem. initiate_docking can sleep, which means the shuttle subsystem can run while initiate docking is in the process of happening. This means that in rare occassions, the transit port attached to a shuttle can be deleted while it is halfway through docking with the other shuttle. When this occurs, non deterministic behaviour arrises which either:

PowerfulBacon commented 1 year ago

I should mention that I fixed this by creating a new variable on the mobile port called is_moving, and if the port is moving don't allow its transit port to be cleared. This fixed the issue.