[0.10.6+][slpwnd] Crash when driving trains in reverse

This subforum contains all the issues which we already resolved.
Post Reply
JLBShecky
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Mon Jul 21, 2014 5:27 pm
Contact:

[0.10.6+][slpwnd] Crash when driving trains in reverse

Post by JLBShecky » Mon Aug 04, 2014 9:05 pm

The game currently crashes when you are manually driving a train backwards and you reach a dead end in the track and the first carriage in the train is destroyed. From what I have been able to discover this seems to be a fringe case as it can only happen if there are only two carriages in the train, although it might be a case of something more, as when a train is manually drove forwards to a dead end it stops but when it is driven backwards backwards it does not make that stop and the cars bunch up and then start taking damage from each other.

I am able to consistently replicate this crash in both normal play and in sandbox and the result is the same every time. I don't know if this occurs on other build/os's as I haven't tested, but here are the steps that I use to reproduce.
  • Enter sandbox mode and elect to receive the free chest.
  • Get some rails, a Cargo wagon or two, a Diesel locomotive or two, and some coal.
  • Place down a short section of track that is long enough to hold a train with at least 2 units. (Cargo Wagon + Diesel Locomotive, Diesel Locomotive + Diesel Locomotive, Cargo Wagon + Cargo Wagon)
  • For testing purposes it is best to save here so you don't have to repeat the initial setup.
  • Place down the first carriage for the train, and then set it's health to one via moving your mouse it and running the console command: "game.player.selected.health = 1"
  • Place down the second carriage behind the first carriage.
  • Enter the train and drive it backwards, once the train runs off the end of the track the game will crash.
  • Alternatively to driving the train you can give it enough negative speed to run off the end of the track to generate the crash.
Although this is not something that most people will ever see, having a small chance that a player could crash their game with seeming normal actions is probably something that should not be in the final game.
Last edited by JLBShecky on Mon Aug 18, 2014 10:52 pm, edited 2 times in total.

MF-
Smart Inserter
Smart Inserter
Posts: 1235
Joined: Sun Feb 24, 2013 12:07 am
Contact:

Re: [0.10.6 Win x64] Crash when driving trains in reverse

Post by MF- » Tue Aug 05, 2014 8:23 am

That's a nice complete report with proper testing and steps-to-reproduce.

Unfortunately it also crosses my "wall of text" threshold.
Let me attempt a TL;DR version of this report to see I got it right and didn't omit any important steps.

------------report starts here------------
1) Get a pice of straight rail setup like so:
==<engine><wagon>=====

2) Give the wagon 1 HP (see original post)

3) Manually slam the wagon against the track end
Here it's important, that the engine is driving in reverse.

4) crash
-------------------------------------------------

Additional: Other pairs of train carriages also crash.
--<engine><engine>-------
--<engine><wagon>-------
--<wagon><engine>-------
--<wagon><wagon>-------
In case of a wagon in place of the engine use the console to give it the necessary negative speed.
-------------report ends here-------------

One question: Do I get it right, that it doesn't crash when the train speed is positive?
(Did you know wagons can be attached to the front of the locomotive too?)

JLBShecky
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Mon Jul 21, 2014 5:27 pm
Contact:

Re: [0.10.6 Win x64] Crash when driving trains in reverse

Post by JLBShecky » Tue Aug 05, 2014 1:23 pm

MF- wrote:One question: Do I get it right, that it doesn't crash when the train speed is positive?
(Did you know wagons can be attached to the front of the locomotive too?)
Yeah when the train does not crash when the speed is positive, and yes I know that you can place cars in from of the locomotive but my ordering was related to an earlier test that I had done with wagons only, which it turns out was in incorrect observation, and the order that you place down carriages is irrelevant to whether a carriage is considered the front of the train.

I'll try and keep this out of the TL;DR territory...

When the first car in a train reaches the end of the track, the train instantly stops along with it and all the cars/locomotives behind it, whether the train's length is 1 or 100. When any car other than the one the train considers to be the first car reaches the end of the track that car stops but the other cars keep on moving till the crash into each other and the cars after the car that is at the end of the train start taking damage.

When the train length is one, there are no other cars to crash into it so it is impossible to reproduce, and when the train length is longer than two, then the second to last car will be the one to take damage the fastest meaning that the first car/locomotive will not be destroyed by another part of the train. Trains to not suffer "compression" and the damage that results from it when they crash into other trains. If both train have momentum then the cars that collided will both take damage, but the crash only occurs when the "first" car in a is destroyed by another car in the same train.

It feels like I am already in the TL;DR territory so I'll leave it at there for now.

User avatar
pyrolytic_tungsten
Fast Inserter
Fast Inserter
Posts: 115
Joined: Fri Aug 01, 2014 4:29 am
Contact:

Re: [0.10.6 Win x64] Crash when driving trains in reverse

Post by pyrolytic_tungsten » Tue Aug 05, 2014 1:56 pm

I can confirm this one on linux x64. I get a segmentation fault when the locomotive I'm driving gets destroyed by backing up into the end of the track with a locomotive or cargo wagon behind me. Interestingly if you have 2 cargo wagons behind the locomotive you won't get the segfault when the cargo wagon behind the locomotive is destroyed. Fortunately this bug is unlikely to be triggered on accident compared to some of the crash bugs in the previous couple versions.

MF-
Smart Inserter
Smart Inserter
Posts: 1235
Joined: Sun Feb 24, 2013 12:07 am
Contact:

Re: [0.10.6 Win x64] Crash when driving trains in reverse

Post by MF- » Tue Aug 05, 2014 2:52 pm

Anyone tried / willing to test whether this cannot be extended to other cases when the "head" carriage gets destroyed?
(Like.. If I set it's HP to 5 and drive a buggy into it?)
Or that + the train has to be moving?

Or really only this "self-inflicted" scenario, while the train loses it's head while dealing with it's compression?

JLBShecky
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Mon Jul 21, 2014 5:27 pm
Contact:

Re: [0.10.6 Win x64] Crash when driving trains in reverse

Post by JLBShecky » Tue Aug 05, 2014 3:36 pm

MF- wrote:Anyone tried / willing to test whether this cannot be extended to other cases when the "head" carriage gets destroyed?
(Like.. If I set it's HP to 5 and drive a buggy into it?)
Or that + the train has to be moving?

Or really only this "self-inflicted" scenario, while the train loses it's head while dealing with it's compression?
I was about to say that I have done all test that I could think of, but I just realized that I have no tried all of the tests when the train has a negative speed, although when a train is heading backwards and the rear car runs into another train, the train does not compress and there is no way for the front car to take damage.

I have tested:
  • The train heading backwards into an other train heading towards it. (Both trains stop and the last cars take damage, but none of the others. If cars are destroyed game does not crash.)
  • Trains heading forwards and crashing into each other. (Lead cars take damage, and no crash if the lead car is destroyed.)
  • Train is heading forward and is destroyed by a player attack.
I have not tested:
  • Train goes head forward into a player/bitter and the train takes enough damage to be destroyed. (Given that other train do not cause compression I doubt that this could damage the lead car.)
  • The train is heading backwards is the "first" car takes damage.

JLBShecky
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Mon Jul 21, 2014 5:27 pm
Contact:

Re: [0.10.6] Crash when driving trains in reverse

Post by JLBShecky » Mon Aug 18, 2014 10:52 pm

Ok so I just got around to testing this again in 0.10.8 and it is still occurring. I used the same steps to reproduce and also check to make sure that if a train is heading backwards and the car that the train object indicates is the lead (carriages[1]) is destroyed by another moving entity such as another train or a car due to collision damage the game does not crash so I have tested all the cases that I can think of, and it seems to be a simple case of if the first carriage in a train takes damage from the car adjacent to it when the train is going backwards and the lead carriage is destroyed then the game crashes.

My gut is telling me that it is probably a case of the order that carriages are updated and that the loop that iterates through them is not being informed that the carriage has been destroyed as it happens while the game is moving the train's carriages. In my mind it is entirely plausible that the order that the carriages of the train are updated in the loop is possibly the cause of the issue, and that if they were updated in the reverse order when a train is going backwards then not only could it prevent this crash but it may also make train come to a complete stop when the train is heading backwards just like it does when heading forwards when it reaches a dead end.

slpwnd
Factorio Staff
Factorio Staff
Posts: 1837
Joined: Sun Feb 03, 2013 2:51 pm
Contact:

Re: [0.10.6+] Crash when driving trains in reverse

Post by slpwnd » Mon Aug 25, 2014 8:33 am

JLBShecky wrote:Ok so I just got around to testing this again in 0.10.8 and it is still occurring.
There was no work done on this for the 0.10.8 but we should have some time to check this out for the 0.10.9.

slpwnd
Factorio Staff
Factorio Staff
Posts: 1837
Joined: Sun Feb 03, 2013 2:51 pm
Contact:

Re: [0.10.6+][slpwnd] Crash when driving trains in reverse

Post by slpwnd » Mon Aug 25, 2014 4:21 pm

This bug will be fixed in the 0.10.9. Moreover the behavior will be consistent with the front movement so when the train goes backward and hits the end of the rail it will not start self damaging itself but rather stop completely.

As a small bonus I discovered and fixed a little bug with train movement. Trains with locomotives on each side (common setup) in manual mode wouldn't move backward when the backward locomotive had no coal.

JLBShecky
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Mon Jul 21, 2014 5:27 pm
Contact:

Re: [0.10.6+][slpwnd] Crash when driving trains in reverse

Post by JLBShecky » Mon Aug 25, 2014 6:47 pm

Great to hear, it is always positive when extra little bugs get fixed as part of a related bug.

Oh and the consistent behavior for the trains is nice as well. :D

Post Reply

Return to “Resolved Problems and Bugs”

Who is online

Users browsing this forum: No registered users