[0.12.35] [Hanziq] Trains sometimes change path after chain signals

This subforum contains all the issues which we already resolved.
tag
Burner Inserter
Burner Inserter
Posts: 10
Joined: Wed Jun 08, 2016 1:12 pm
Contact:

[0.12.35] [Hanziq] Trains sometimes change path after chain signals

Post by tag »

Sometimes trains change to a different path when passing chain signals.
This is a problem because the new exit block might not be free.
It can happen that a train passes a chain signal, but then has to wait before the exit block.

I've attached a short video. Please note the trains coming from east.
intersection.gif
intersection.gif (3.89 MiB) Viewed 22968 times
- The first train (iron ore) travels straight from east to west ahead along the reserved path. All is well.

- The second train (copper ore) reserves the same path, but just before the first chain signal, the train suddenly chooses a different path and stops abruptly because the exit is occupied by another train. Subobtimal, but not really a problem.

- The third train (also copper ore) passes the first chain signal without a problem. The train then changes its path at the second chain signal and finally stops in the middle of the intersection at the third chain signal.
In this case, the train only needs to wait for a short time, but I've seen other cases where a train mysteriously passed a chain signal and caused a deadlock.

IMHO when a train needs to change its path after it passed a chain signal, only paths through free exit blocks should be considered.

Old path:
train1.jpg
train1.jpg (933.99 KiB) Viewed 22968 times
New path:
train2.jpg
train2.jpg (934.24 KiB) Viewed 22968 times
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5266
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.12.35] Trains sometimes wait after chain signals

Post by Klonan »

Thanks for the report,
This end up part of a long list of train related bugs, which will be tended to at some point
youdoomt
Long Handed Inserter
Long Handed Inserter
Posts: 63
Joined: Mon Apr 04, 2016 5:58 pm
Contact:

Re: [0.12.35] Trains sometimes wait after chain signals

Post by youdoomt »

This must be the same issue that cause the "roundabout" problem when the train gets stuck in a roundabout because it want to do more than a 360 and sees itself.

I would recommend trains only recalculate after they hit a train signal this would fix a lot of issues with train stopping/getting stuck in junction.
fregate84
Fast Inserter
Fast Inserter
Posts: 235
Joined: Sun Jun 22, 2014 10:56 am
Contact:

Re: [0.12.35] [Hanziq] Trains sometimes change path after chain signals

Post by fregate84 »

it's a big problem on big base like mine, because every 10 mins a train is stuck because the train try to do more that 360° turn on a circle ... blocking itself.


perhaps a simple way to solve that is to NEVER try to change path of train after chain signals, EXPECT when we check a checkbox on GUI signal who specify the on this chain signal, path MUST be calculate again.
Bonus part, it will add a very good signal to loadbalance train between track, because we will choose where path must be recalculate again.
Yoyobuae
Filter Inserter
Filter Inserter
Posts: 509
Joined: Fri Nov 04, 2016 11:04 pm
Contact:

Re: [0.12.35] [Hanziq] Trains sometimes change path after chain signals

Post by Yoyobuae »

No matter what kind of rules the game code it's using to reroute trains, they are completely hidden/secret.

From the point of view of players trains can randomly change routes whenever they please. Of course that massively complicates rail design.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5266
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.12.35] [Hanziq] Trains sometimes change path after chain signals

Post by Klonan »

fregate84 wrote:it's a big problem on big base like mine, because every 10 mins a train is stuck because the train try to do more that 360° turn on a circle ... blocking itself.
.
This seems more like a design problem than an issue with the train pathing
Yoyobuae
Filter Inserter
Filter Inserter
Posts: 509
Joined: Fri Nov 04, 2016 11:04 pm
Contact:

Re: [0.12.35] [Hanziq] Trains sometimes change path after chain signals

Post by Yoyobuae »

Klonan wrote:
fregate84 wrote:it's a big problem on big base like mine, because every 10 mins a train is stuck because the train try to do more that 360° turn on a circle ... blocking itself.
.
This seems more like a design problem than an issue with the train pathing
With trains rerouting mid-intersection all bets are off. Nothing rail signals, chain signals or rail layout can do when trains can reroute as they please.

Take for example this typical chain signaled roundabout:
Image

Follows the whole "chain signals on all entries, rail signals on all exits" mantra. So it should just work, right?


All I did was change the name of the station on the east, train rerouted in the middle of the intersection to station to the north, but now it's blocking it's own path north = deadlock. That's the only train in the rail system, BTW.

Granted, players don't change the name of stations all that often to make this a big problem. But the video in OP shows that trains do this kind of rerouting on their own, so this kind of deadlock can happen spuriously without player intervention.

There's a way around the issue though: Never give the same name to two stations. Train rerouting shouldn't happen (as much). Maybe use same-name stations on very limited applications, but never on stations which are far apart and reachable via different paths from intersections.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5266
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.12.35] [Hanziq] Trains sometimes change path after chain signals

Post by Klonan »

Yoyobuae wrote:
Klonan wrote:
fregate84 wrote:it's a big problem on big base like mine, because every 10 mins a train is stuck because the train try to do more that 360° turn on a circle ... blocking itself.
.
This seems more like a design problem than an issue with the train pathing
With trains rerouting mid-intersection all bets are off. Nothing rail signals, chain signals or rail layout can do when trains can reroute as they please.

Take for example this typical chain signaled roundabout

Follows the whole "chain signals on all entries, rail signals on all exits" mantra. So it should just work, right?

All I did was change the name of the station on the east, train rerouted in the middle of the intersection to station to the north, but now it's blocking it's own path north = deadlock. That's the only train in the rail system, BTW.

Granted, players don't change the name of stations all that often to make this a big problem. But the video in OP shows that trains do this kind of rerouting on their own, so this kind of deadlock can happen spuriously without player intervention.

There's a way around the issue though: Never give the same name to two stations. Train rerouting shouldn't happen (as much). Maybe use same-name stations on very limited applications, but never on stations which are far apart and reachable via different paths from intersections.
Once again, this seems like more of a rail design problem.
Your loops are not big enough for your trains, you are liberally applying extra chain signals, and you are using roundabouts for general intersections.

Any one of these can cause the train to deadlock like this, with or without the re-pathing.
Yoyobuae
Filter Inserter
Filter Inserter
Posts: 509
Joined: Fri Nov 04, 2016 11:04 pm
Contact:

Re: [0.12.35] [Hanziq] Trains sometimes change path after chain signals

Post by Yoyobuae »

I can probably force a deadlock on almost any kind of roundabout just by triggering a reroute at the precise time. Pretty much having any chain signals at all inside the roundabout allows this kind of deadlock to happen, no matter the size of the roundabout, or the placement of the chain signals.

Maybe it's best to just avoid roundabouts. This kind of problems shouldn't affect T intersections, I think. So if by "good rail design" you mean "no roundabouts" then I agree with you.
Last edited by Yoyobuae on Fri Dec 23, 2016 8:51 pm, edited 1 time in total.
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [0.12.35] [Hanziq] Trains sometimes change path after chain signals

Post by Nexela »

Roundabouts are fine as far as roundabouts being fine goes, The key thing to remember is your blocks need to be bigger than your trains. and you need more blocks then potential trains between stations. If the but of your train can block a potential exit for that train deadlocks can occur
Yoyobuae
Filter Inserter
Filter Inserter
Posts: 509
Joined: Fri Nov 04, 2016 11:04 pm
Contact:

Re: [0.12.35] [Hanziq] Trains sometimes change path after chain signals

Post by Yoyobuae »

Nexela wrote:Roundabouts are fine as far as roundabouts being fine goes, The key thing to remember is your blocks need to be bigger than your trains. and you need more blocks then potential trains between stations. If the but of your train can block a potential exit for that train deadlocks can occur
And I'm saying that single train can always block it's own exit if there's any kind of chain signals inside the roundabout. All it takes it's rerouting to happen at some precise time and boom! deadlock.

If rerouting can happen, then the only kind of roundabouts which are deadlock free are the ones without any signals except at entries/exits.

Now, some player might never encounter the exact rerouting situation where deadlock will happen. That depends on the rail layout outside the roundabout (where stations are placed, etc).
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [0.12.35] [Hanziq] Trains sometimes change path after chain signals

Post by Nexela »

Remove the last cargo wagon from your train and it will go through the intersection just fine. The last wagon is blocking the topmost chain signal closing the block causing the eastmost signal to turn red because there is a train in the block.
Yoyobuae
Filter Inserter
Filter Inserter
Posts: 509
Joined: Fri Nov 04, 2016 11:04 pm
Contact:

Re: [0.12.35] [Hanziq] Trains sometimes change path after chain signals

Post by Yoyobuae »

Nexela wrote:Remove the last cargo wagon from your train and it will go through the intersection just fine. The last wagon is blocking the topmost chain signal closing the block causing the eastmost signal to turn red because there is a train in the block.
I can remove all cargo wagons if you want:
Image

Oh I know, I'll add another chain signal:
Image

Trust me, it's an unsolvable problem. Train rerouting can deadlock any roundabouts, no matter their size or signaling, unless there's zero signals on the circle itself.

Please keep in mind this is a rather unlikely event. Train rerouting doesn't happen often and in some cases it will never happen like this. But whether train rerouting happens or not depends on the rail layout outside the roundabout.
Loewchen
Global Moderator
Global Moderator
Posts: 9103
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: [0.12.35] [Hanziq] Trains sometimes change path after chain signals

Post by Loewchen »

I think there is no need to discuss individual results of path-changing-after-chain-signals. As I understand it, there is agreement that the behaviour in general is considered a bug, as it defeats the purpose of the chain signal and results in unexpected and unreliable behaviour. And just to make sure there are no misconceptions, the path-changing-after-chain-signal is not limited to changing/removing stations or even roundabouts.
BlackMoon
Inserter
Inserter
Posts: 42
Joined: Wed Aug 06, 2014 7:15 am
Contact:

Re: [0.12.35] [Hanziq] Trains sometimes change path after chain signals

Post by BlackMoon »

Great we have agreed its a bug and it still exists in 15.20, 12 months later.

Can we please have trains check if they are in between two chain signals and disable rerouting logic?

Rather, when a train recalculates a path, just use the old path (early out) if the train is current in between two chain signals or if this is hard to check for, if next signal is a chain signal.

Because I don't think a train should ever change paths after it has entered a chain signal block till it reaches regular signals. Since a train has to reserve a path through chain signals, changing that path midway (Mainly to a non reservable path because its already occupied) defeats the point of reserving a path and chain signals.

If the rerouting logic can't be disabled, then it needs to detect if its in a chain block and only consider the currently reserved chain blocks a valid path, ie force it to follow its reserved route through the chain blocks, or at least to find a reservable route.

Picking a worse path to the destination is acceptable. Getting stuck in any roundabout (And many other constructs) using chain signals is not.
BlackMoon
Inserter
Inserter
Posts: 42
Joined: Wed Aug 06, 2014 7:15 am
Contact:

Re: [0.12.35] [Hanziq] Trains sometimes change path after chain signals

Post by BlackMoon »

So I talked to the developers on IRC and apparently several videos and a dozen screenshots of the bug are not enough, they need a save just before it happens or they won't look into it.

Can anyone provide one? I tried but without knowing what causes trains to repath (I asked the devs and they won't tell me) I haven't a clue how to reproduce it outside of my modded savegame with 40+ trains running around between different stations.
User avatar
Nexarius
Filter Inserter
Filter Inserter
Posts: 275
Joined: Sat May 09, 2015 7:34 pm
Contact:

Re: [0.12.35] [Hanziq] Trains sometimes change path after chain signals

Post by Nexarius »

BlackMoon wrote:they need a save just before it happens or they won't look into it.
I made it happen every 30sec in my test world by turning a station off and on (btw gif !!).
Image
Attachments
Kreativ.zip
(31.01 MiB) Downloaded 282 times
Rseding91
Factorio Staff
Factorio Staff
Posts: 14250
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.12.35] [Hanziq] Trains sometimes change path after chain signals

Post by Rseding91 »

Nexarius wrote:
BlackMoon wrote:they need a save just before it happens or they won't look into it.
I made it happen every 30sec in my test world by turning a station off and on (btw gif !!).
Image
That's not the issue described here. That's simply a train trying to plan a self-intersecting route which is in another bug report.

The issue here existed before train stop disabling was a thing.
If you want to get ahold of me I'm almost always on Discord.
User avatar
Sephrat
Long Handed Inserter
Long Handed Inserter
Posts: 74
Joined: Wed Mar 16, 2016 2:39 pm
Contact:

Re: [0.12.35] [Hanziq] Trains sometimes change path after chain signals

Post by Sephrat »

BlackMoon wrote:So I talked to the developers on IRC and apparently several videos and a dozen screenshots of the bug are not enough, they need a save just before it happens or they won't look into it.

Can anyone provide one? I tried but without knowing what causes trains to repath (I asked the devs and they won't tell me) I haven't a clue how to reproduce it outside of my modded savegame with 40+ trains running around between different stations.
My report contains such a save: viewtopic.php?f=47&t=34844
It's from 0.14.14 but I'm pretty sure it's reproducable on the latest build.
Anyway it should be easily reproducable if you have several paths with the same "cost" leading to the destination.

I really hope this bug will be addressed at some point. It occurs quite often on big train networks, especially in bottlenecks such as unloading bays.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14250
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.12.35] [Hanziq] Trains sometimes change path after chain signals

Post by Rseding91 »

Sephrat wrote:
BlackMoon wrote:So I talked to the developers on IRC and apparently several videos and a dozen screenshots of the bug are not enough, they need a save just before it happens or they won't look into it.

Can anyone provide one? I tried but without knowing what causes trains to repath (I asked the devs and they won't tell me) I haven't a clue how to reproduce it outside of my modded savegame with 40+ trains running around between different stations.
My report contains such a save: viewtopic.php?f=47&t=34844
It's from 0.14.14 but I'm pretty sure it's reproducable on the latest build.
Anyway it should be easily reproducable if you have several paths with the same "cost" leading to the destination.

I really hope this bug will be addressed at some point. It occurs quite often on big train networks, especially in bottlenecks such as unloading bays.
I'll take a look at it tomorrow.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved Problems and Bugs”