Page 1 of 1

[kovarex] [0.17.49] Trains repathing in chain sequences still not obeying reserved block restriction sometimes

Posted: Fri Jun 14, 2019 4:48 pm
by Theikkru
See 71371

Hate to have to keep bugging (hyuk hyuk) everyone about this issue, but it's not quite fixed. I found another case where trains will ignore the reserved block restriction and go the wrong way. Here is the test setup:
test.png
test.png (1.22 MiB) Viewed 2790 times
It's similar to the last topic in that it has a circuit-controlled train that tries to go through a roundabout to reach its second stop (right stop), but that second stop gets disabled when it enters the roundabout, sending it back to the first stop (left stop). What's different here, is that there's a cargo wagon plugging up the exit block the train needs to get through to get back to its home stop.

If you turn on the constant combinator and send the train off, this happens:
fail.png
fail.png (1.61 MiB) Viewed 2790 times
It's probably important to note that the train jerks to a stop instantaneously when it needs to repath, and complains about "No path" occasionally once it's stopped in the roundabout. As far as I can tell, these two behaviors correspond to the pathing failing, so I suspect the train state is getting reset somehow.

What's really bizarre, is that if you swap out a rail section so that the upper return path is connected (it doesn't matter if the lower one still is or not), then the train returns to pathing as expected:
pass.png
pass.png (1.93 MiB) Viewed 2790 times
This is really odd, because it still has to go through the exact same chain block and exit block, but somehow not having to rejoin the roundabout makes it work. Just in case it was some weird pathfinder behavior due to the presence of a loop, I tried breaking the left side of the roundabout circle (between the 2 chain signals), but that didn't change the behavior.

So in summary, there seems to be strange failure of the pathfinder when asked to re-path within a chain sequence, the only paths to reach the new destination go through a reserved exit block at some point (even if there are unreserved blocks available to stop in before that), and some other woo-wah condition that I can't figure out is present.

Test save:

Re: [0.17.49] Trains repathing in chain sequences still not obeying reserved block restriction sometimes

Posted: Fri Jun 14, 2019 5:32 pm
by disentius
Nice base :)

I tried to reproduce your error, this happened:

1. load save
2. throw switch
3 train goes roundabout

a. train finds new path
b. train finds no path (few seconds)
c. train re-finds path

After that, no more no path errors...

l

Re: [0.17.49] Trains repathing in chain sequences still not obeying reserved block restriction sometimes

Posted: Fri Jun 14, 2019 6:51 pm
by Theikkru
Did it end up stopped in the roundabout where I showed it? It doesn't always give the "no path" message when it's stopped there. The main problem is it stopping in the roundabout where it isn't supposed to.

Re: [kovarex] [0.17.49] Trains repathing in chain sequences still not obeying reserved block restriction sometimes

Posted: Sat Jun 15, 2019 10:24 am
by disentius
Yes.
You chainsignalled the whole roundabout, Autodeadlock.

I modified your blueprint to show that behavior. as far as i can see this is as intended.

The "No Path" on the other hand, should not occur, and is probably a bug. :)


Re: [kovarex] [0.17.49] Trains repathing in chain sequences still not obeying reserved block restriction sometimes

Posted: Sat Jun 15, 2019 10:45 am
by Theikkru
That's not a deadlock, it's just saturation of the intersection (if the cargo wagon at the exit were a train and moved away, everything would clear up).

The intended behavior is how the train paths in the 3rd image: the reserved block restriction should render the path directly through the roundabout invalid, preventing the train from illegally stopping inside the roundabout (because doing so violates the chain signals), and instead send it out the bottom exit into the unreserved blocks there.

The modification you made in your blueprint is significant because it removes a potential path. If you remove the return loops, then if the train tries to get out of the chain section via the bottom exit it can no longer reach its home station, so the "No path" message in that case is valid.

Re: [kovarex] [0.17.49] Trains repathing in chain sequences still not obeying reserved block restriction sometimes

Posted: Mon Jun 17, 2019 1:22 pm
by kovarex
Thanks for the report, the problem is fixed for the next version now.

My attempt to explain the problem:

The core of the problem is, that the train path finder first found the shorter path, and discarded it as it was still a chain sequence and ended with red signal.
Then it continued to search, and the longer path joined the discarded path, and since the previous search was shorter (although in a chain sequence), it didn't allow the longer path to override the shorter but invalid
path.

It explains, why removing the bottom rail instead of the top fixed the problem, as it didn't force the shorter path to joint the discarded chain signal path.