The International Simutrans Forum

Simutrans Extended => Simutrans-Extended bug reports => Simutrans-Extended development => Simutrans-Extended closed bug reports => Topic started by: Sirius on January 19, 2020, 03:44:12 PM

Title: [BUG] one_train_staff greedily reservating tiles it can not yet enter
Post by: Sirius on January 19, 2020, 03:44:12 PM
What happened?
When a train is waiting at a cabinet, it will greedily start reservating tiles even if it can't enter the section yet.

How to reproduce?
- Open the attached reproduction case
- You will see a train being in a one_train_staff controlled section and another one waiting at the cabinet for clearance.
- Clear the reservation of the train in one train staff controlled section.

- The train whose resevation was just cleared will continue in drive_by_sight, as expected.
- The other train will greedily reservate any tile as soon as it gets cleared by the train in the section.
- The train in the section will reverse at the dead-end.
- After reversal it can't continue because the way is already reservated
- Deadlock

Note that this won't happen quite often but it will be a hassle either spamming the clear-reservation tool or opening the schedule of the train at the cabinet , then clearing the reservation and closing the schedule when the train left the section.
Especially when the train at the cabinet is not your own whilst the stuck one is, this will be quite annoying.
When the train in the section already reports "stuck", spamming the reservation tool won't help at all because the train at the cabinet will always create its reservation faster than the one in drive_by_sight, so this will either require help of the server administration or the player who is waiting at the cabinet.

Also see one_train_staff clearing too many tiles (,19498.0.html), where this behavior is involved in deadlocking a proper one_train_staff layout.

Further, this might affect some strange mixes in between one_train_staff and any other signalling system but that should not be a problem imho. I can't imagine any combination that might be expected working and will unexpectedly deadlock at some time in the future.

I guess I finally have reported any one_train_staff related bugs I know of.
Title: Re: [BUG] one_train_staff greedily reservating tiles it can not yet enter
Post by: jamespetts on January 19, 2020, 05:12:55 PM
Thank you for the report: I believe that I have now fixed this. I should be grateful if you could re-test with the next nightly build.
Title: Re: [BUG] one_train_staff greedily reservating tiles it can not yet enter
Post by: Sirius on January 20, 2020, 03:12:02 PM

The train leaving the section will enter one_train_staff when leaving the section, but that's an issue by design as cabinets cannot know if they are the entry point for the section or the exit apart from infering this from trains working method.

Edit: Maybe they can. If the next cabinet on the route is not adjacent (the exploit fix), we know for sure that either trains working method or the signalling layout was wrong, thus passing in drive_by_sight