FS#5965 - Loading savegame causes a crash.

Attached to Project: OpenTTD
Opened by Wormnest (Wormnest) - Thursday, 03 April 2014, 17:53 GMT
Last edited by andythenorth (andythenorth) - Tuesday, 15 August 2017, 05:54 GMT
Type Bug
Category Core
Status Closed
Assigned To andythenorth (andythenorth)
Operating System All
Severity High
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


Trunk r26438.
OS Windows 7 Home Premium 64 bits.

As soon as I try to load a certain older savegame it crashes. I have a savegame from about a year before this save that does not crash, let me know if it is needed. All the later ones do crash.
I tried one of the crashing saves also on 1.4.0 which also crashes.

Note i have trouble adding this task, I'm guessing it's timing out on the crash.dmp (6828 KB) uploading since I return to an empty new task window. Trying for now to add the task without crash.dmp.
This task depends upon

Closed by  andythenorth (andythenorth)
Tuesday, 15 August 2017, 05:54 GMT
Reason for closing:  Unreproducible
Additional comments about closing:  Provided savegames load on 1.7.1.

Possibly the issue diagnosed by Cirdan (at end of comments) has been resolved. That's an assumption that I didn't check, don't take it as fact. No crashes here though in 1.7.1.
Comment by Wormnest (Wormnest) - Thursday, 03 April 2014, 17:55 GMT
Trying to add the crash.dmp.
(application/octet-stream)    crash.dmp (6.67 MiB)
Comment by Ingo von Borstel (planetmaker) - Thursday, 03 April 2014, 18:25 GMT
Do you also have the savegame itself which causes the crash?
Comment by Wormnest (Wormnest) - Friday, 04 April 2014, 10:28 GMT
Attached the last savegame that works and the first one that crashes on both trunk r26438 and 1.4.0.
Note that on 1.2.2 it doesn't crash. I currently don't have 1.3.x installed to test.
Comment by Brumi (Brumi) - Friday, 04 April 2014, 16:03 GMT
I have a similar issue, both using r26443 and 1.4.0. These really old savegames (one from around 0.5.3-0.6 series or so, two from TTO) cause OpenTTD to crash, while 1.3.3 loads them just finely.
Maybe my files can be of some help. The crash files were generated during loading the Flonningley Transport.sav file.

EDIT: Other old savgames (including TTO ones) can be loaded properly even in 1.4.0.
Comment by Ingo von Borstel (planetmaker) - Friday, 04 April 2014, 16:53 GMT
from current trunk with Flonningley Transport.sav:

planetmaker@localhost:~/ottd/trunk$ gdb bin/openttd
GNU gdb (GDB) Fedora
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
Find the GDB manual and other documentation resources online at:
For help, type "help".
Type "apropos word" to search for commands related to "word".
Reading symbols from /home/planetmaker/ottd/trunk/bin/openttd...(no debugging symbols found)...done.
(gdb) run
Starting program: /home/planetmaker/ottd/trunk/bin/openttd
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/".
[New Thread 0x7fffe4e41700 (LWP 6170)]
[Thread 0x7fffe4e41700 (LWP 6170) exited]
[New Thread 0x7fffe4e41700 (LWP 6171)]
[New Thread 0x7fffbfffe700 (LWP 6172)]
[Thread 0x7fffbfffe700 (LWP 6172) exited]
[New Thread 0x7fffbfffe700 (LWP 6173)]
[New Thread 0x7fffbf7fd700 (LWP 6174)]
[Thread 0x7fffbfffe700 (LWP 6173) exited]

Program received signal SIGSEGV, Segmentation fault.
0x00000000008177f9 in ShowNewGrfVehicleError(unsigned short, unsigned short, unsigned short, GRFBugs, bool) ()
Missing separate debuginfos, use: debuginfo-install SDL-1.2.15-12.fc20.x86_64 dbus-libs-1.6.12-8.fc20.x86_64 flac-libs-1.3.0-3.fc20.x86_64 freetype-2.5.0-5.fc20.x86_64 glibc-2.18-12.fc20.x86_64 gsm-1.0.13-10.fc20.x86_64 json-c-0.11-3.fc20.x86_64 libICE-1.0.8-6.fc20.x86_64 libSM-1.2.1-6.fc20.x86_64 libX11-1.6.1-1.fc20.x86_64 libXau-1.0.8-2.fc20.x86_64 libXcursor-1.1.14-2.fc20.x86_64 libXext-1.3.2-2.fc20.x86_64 libXfixes-5.0.1-2.fc20.x86_64 libXi-1.7.2-2.fc20.x86_64 libXrandr-1.4.1-2.fc20.x86_64 libXrender-0.9.8-2.fc20.x86_64 libXtst-1.2.2-2.fc20.x86_64 libasyncns-0.8-6.fc20.x86_64 libattr-2.4.47-3.fc20.x86_64 libcap-2.22-7.fc20.x86_64 libgcc-4.8.2-7.fc20.x86_64 libicu-50.1.2-10.fc20.x86_64 libogg-1.3.0-6.fc20.x86_64 libpng-1.6.3-3.fc20.x86_64 libsndfile-1.0.25-8.fc20.x86_64 libstdc++-4.8.2-7.fc20.x86_64 libuuid-2.24.1-1.fc20.x86_64 libvorbis-1.3.4-1.fc20.x86_64 libxcb-1.9.1-3.fc20.x86_64 lzo-2.06-5.fc20.x86_64 pulseaudio-libs-4.0-9.gitf81e3.fc20.x86_64 tcp_wrappers-libs-7.6-76.fc20.x86_64 xz-libs-5.1.2-6alpha.fc20.x86_64 zlib-1.2.8-3.fc20.x86_64
(gdb) bt
#0 0x00000000008177f9 in ShowNewGrfVehicleError(unsigned short, unsigned short, unsigned short, GRFBugs, bool) ()
#1 0x0000000000800dab in Train::ConsistChanged(ConsistChangeFlags) ()
#2 0x000000000077034e in AfterLoadVehicles(bool) ()
#3 0x0000000000751ad6 in AfterLoadGame() ()
#4 0x0000000000764c05 in DoLoad(LoadFilter*, bool) ()
#5 0x000000000076a5bb in SaveOrLoad(char const*, int, Subdirectory, bool) ()
#6 0x00000000006f5191 in SafeLoad(char const*, int, GameMode, Subdirectory, LoadFilter*) ()
#7 0x00000000006f539c in SwitchToMode(SwitchMode) ()
#8 0x00000000006f65ef in GameLoop() ()
#9 0x0000000000828624 in VideoDriver_SDL::MainLoop() ()
#10 0x00000000006f4a0d in openttd_main(int, char**) ()
#11 0x00007ffff428fd65 in __libc_start_main () from /lib64/
#12 0x000000000055595d in _start ()
Comment by CĂ­rdan (cirdan) - Friday, 04 April 2014, 22:01 GMT
Commit r23860 changed the capacity of refitted default vehicles, rounding up instead of truncating. If you try to load a savegame older than r23860 where a default vehicle with an odd capacity is refitted to a lower capacity, the saveload code will cry foul because a vehicle is trying to change its capacity outside of a depot (due to rounding). And, since it is a default vehicle and has no newgrf information, the function that prints the error will segfault.