[Genhis][2.0.41] Crash setting train schedule of moving train (RollingStock::checkConsistency) (speed == 0 || closing)

This subforum contains all the issues which we already resolved.
Ashier
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sun Jan 26, 2025 11:03 pm
Contact:

[Genhis][2.0.41] Crash setting train schedule of moving train (RollingStock::checkConsistency) (speed == 0 || closing)

Post by Ashier »

I will attempt to explain as best I can. The relevant lua code for my mod can be found here: https://github.com/AtelierAmber/RSAD-Tr ... r.lua#L281 Linked to the line that I think is causing it.
Also attached is a save file to test it on. It is extremely easy to reproduce if timed correctly and will happen every time. I have included a small video to demonstrate it as well.

Steps to repro:
- Click the train and send it to the already scheduled station. This, similar to cybersyn, will register the train with the RSAD train system and send it to deliver the wagon.
- After the train has picked up the wagon, place another one at the back of the remaining wagon. This may not be necessary to crash it.
- Once the train is returning to the station, and after it has passed the crossing (such that it can path to the wagon pick up stop), delete the wagon at the drop off stop. This will trigger the linked code above to run and set a new schedule for the train.

Mod list:
- Base Mod
- Elevated Rails
- Debug Adapter for Factorio Mods (via vscode)
- Editor Extensions
- Factorio Library
- Pipe Visualizer 2.0 (Likely not required)
- RSAD Train Yards (My in-dev mod linked above)

Let me know if you require anything else.

Video
2025-03-14 18-48-50.mp4
(12.85 MiB) Downloaded 33 times
Log
factorio-current.log
(11.5 KiB) Downloaded 37 times
Dump
factorio-dump-current.dmp
(1.12 MiB) Downloaded 29 times
Save
default test-.zip
(881.02 KiB) Downloaded 35 times
BurninSun
Long Handed Inserter
Long Handed Inserter
Posts: 69
Joined: Fri Mar 16, 2018 4:54 am
Contact:

Re: [2.0.41] Crash setting train schedule of moving train (RollingStock::checkConsistency) (speed == 0 || closing)

Post by BurninSun »

+1 [v2.0.45]

Code: Select all

Error RollingStock.cpp:1431: this->getSpeed() == 0.0 || this->closing was not true
Working with Space Exploration's space elevators where the mod will split up a train upon reaching the elevator's train stop.
Attachments
factorio-dump-current.dmp
(899.8 KiB) Downloaded 9 times
factorio-current.log
(20.98 KiB) Downloaded 13 times
xane256
Burner Inserter
Burner Inserter
Posts: 9
Joined: Fri Nov 01, 2024 6:36 am
Contact:

Re: [2.0.41] Crash setting train schedule of moving train (RollingStock::checkConsistency) (speed == 0 || closing)

Post by xane256 »

I have also been experiencing this issue while testing with space exploration. The issue happened for me when a large train went into the space elevator entrance on Nauvis, but a workaround that seems to work for now, is to remove all the locomotives from the big train, keeping only one locomotive. With 3 locomotives it would crash when entering the space elevator, but with 1 locomotive I haven't had a crash yet.
BurninSun
Long Handed Inserter
Long Handed Inserter
Posts: 69
Joined: Fri Mar 16, 2018 4:54 am
Contact:

Re: [2.0.41] Crash setting train schedule of moving train (RollingStock::checkConsistency) (speed == 0 || closing)

Post by BurninSun »

I found the crash can be avoided by setting the trains speed to 0 before setting the train to its intended speed, even if doing so is done in the line previous to setting its actual speed. eg.
This will crash in Space Exploration's code:

Code: Select all

...
train_a.speed = -1
...
This will not crash:

Code: Select all

...
train_a.speed = 0
train_a.speed = -1
...
BurninSun
Long Handed Inserter
Long Handed Inserter
Posts: 69
Joined: Fri Mar 16, 2018 4:54 am
Contact:

Re: [Genhis][2.0.41] Crash setting train schedule of moving train (RollingStock::checkConsistency) (speed == 0 || closin

Post by BurninSun »

Stripped down, simple save and reproduction in vanilla. Base mod only, no SA.

Load the attached save and run the following:

Code: Select all

/c storage.FRONT.train.schedule = nil storage.FRONT.destroy() storage.BACK.train.speed = 1
storage.FRONT is the front locomotive entity. storage.BACK is the back locomotive entity.

Result is immediate crash with

Code: Select all

Error RollingStock.cpp:1431: this->getSpeed() == 0.0 || this->closing was not true
Also, adding in a speed = 0 before the speed = 1 avoids the crash.
Attachments
test23.zip
(821.97 KiB) Downloaded 14 times
Genhis
Factorio Staff
Factorio Staff
Posts: 792
Joined: Wed Dec 24, 2014 8:19 am
Contact:

Re: [Genhis][2.0.41] Crash setting train schedule of moving train (RollingStock::checkConsistency) (speed == 0 || closin

Post by Genhis »

Thank you all for reproduction steps. The issue is fixed for 2.0.46.
Post Reply

Return to “Resolved Problems and Bugs”