News:

Simutrans Forum Archive
A complete record of the old Simutrans Forum.

Losses of synchronisation related to road vehicle movement

Started by freddyhayward, December 02, 2020, 10:21:06 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

freddyhayward

I have solved one common desync that was caused by road vehicle movement: https://github.com/jamespetts/simutrans-extended/pull/308
In summary, it was caused because road vehicles determine whether to continue driving when another vehicle is ahead based partially on the routing status of that convoy. However, routing status is thread-unsafe whenever routes are being calculated, typically when convoys are about to depart. I resolved that particular case by checking whether the convoy ahead is actually moving at all.
I speculate that there are many other potential causes of desynchronisation in other sections of movement code that rely on routing information, as this can change in a thread-unsafe manner.

jamespetts

Thank you for your work on this: this is very helpful. I know that these can be fantastically difficult to track down, so you must have put a great deal of effort into this. I have now incorporated this.

I was not aware that can_enter_tile() is called whilst a vehicle is in the ROUTING state; to find other instances of this sort of issue, we may want to consider running a test checking for the ROUTING state in this and similar methods and how this is reached. This may well be an issue for other types of vehicle besides road vehicles.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Matthew

Thank you Freddy for finding and fixing the problem and James for integrating the patch.

Discovering a whole new class of desync causes seems like a major breakthrough!
(Signature being tested) If you enjoy playing Simutrans, then you might also enjoy watching Japan Railway Journal
Available in English and simplified Chinese
如果您喜欢玩Simutrans的话,那么说不定就想看《日本铁路之旅》(英语也有简体中文字幕)。

freddyhayward

Quote from: Matthew on December 03, 2020, 08:26:45 AM
Thank you Freddy for finding and fixing the problem and James for integrating the patch.

Discovering a whole new class of desync causes seems like a major breakthrough!
You certainly deserve some credit for reporting desyncs as they happened - this helped me to construct the test map that reproduced it.

jamespetts

I have added assertion checks for the state of a convoy being in the ROUTING_1 or ROUTING_2 status when calling can_enter_tile(), and have found no instances where this is the case running a recent saved game from the Stevenson-Seimens server.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.