FS#6688 - Random game crash

Attached to Project: OpenTTD
Opened by Bogdan (bnegrut) - Monday, 19 March 2018, 19:33 GMT
Type Bug
Category Core
Status New
Assigned To No-one
Operating System Windows
Severity Medium
Priority Normal
Reported Version 1.7.2
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


Random game crash

OS Windows 10, 64 bit
Game version 1.7.2. 64 bit

Crash at: Mon Mar 19 19:27:44 2018
In game date: 1922-10-08 (16)

Crash reason:
Exception: C0000005
Location: 00007FF70AAB5440
Message: <none>

OpenTTD version:
Version: 1.7.2 (0)
NewGRF ver: 17286d2d
Bits: 64
Endian: little
Dedicated: no
Build date: Dec 24 2017 12:25:35
This task depends upon

Comment by Bogdan (bnegrut) - Tuesday, 20 March 2018, 18:51 GMT
Crashed again today. DMP file will not upload.
Comment by 3298 (3298) - Wednesday, 21 March 2018, 09:33 GMT
From the crash.log of both crashes:
Tick 14454: GRF config changed
Removed NewGRF: GRF ID 52455400, unknown GRF
There is a reason changing NewGRFs is hidden behind a openttd.cfg-only option and displays a red warning window (which should also have told you NOT to report issues that happen after you do so): Changing NewGRFs can wreak all kinds of havoc in a savegame, including setting it up so it crashes later. That appears to be what happened here, so ... warranty void, I guess.
Comment by Bogdan (bnegrut) - Wednesday, 21 March 2018, 18:36 GMT
Now I understood that the cause is a GRF, specifically GRF ID 52455400, checksum 1600687C50C5AB1E72EDD487CAD50E2A, filename: coded_by_aegir._artwork_by_aegir-1/ae_cityw.grf (md5sum matches).
What I can not understand is why a GRF that is not loaded cause such havoc. Also, as far as I remember I did not load it for this game. Is there a way to check if this GRF was loaded at some point in the game?

Attached is a screenshot with the GRFs in use in game.
Comment by 3298 (3298) - Thursday, 22 March 2018, 00:26 GMT
That would be the gamelog, which got thrown into both crash.log files. As far as I know, there's also a console command that outputs the gamelog of a running game, but why bother with that when it's right there. - It's the section I took those lines from. The rest of the gamelog tells me that the game was started with all the GRFs I see listed in your screenshot plus that missing one at the end of the list, using version 1.7.1. On tick 1280 (approximately in-game day 18) you switched to version 1.7.2. On tick 14454 (approximately day 192, i.e. after almost six and a half in-game months) the GRF got removed. The gamelog section of both crash.log files is identical, so I guess that after you experienced the first crash, you reloaded a save that was made after the GRF was already removed (e.g. the emergency save created during the crash).
I'm not the developer of that GRF (or even a GRF dev at all), so I don't know how it's coded (and I'm not familiar with OpenTTD's NewGRF handling code either) and therefore don't know if the following even has a chance of working, but my first attempt at fixing this savegame would be adding the GRF back (at least you were able to identify the missing one, so there's that). Considering that it's a fairly old and possibly a relatively simple GRF just providing station graphics, it might just work, but that's unfortunately far from guaranteed.
GRFs are deeply integrated into the system, so they can have great influence on the game state. When GRFs are changed, a lot of lists get updated, but when the stuff in the lists has been used already, we are screwed. Then some hilarious things can happen, like lone helicopter rotors swimming across the ocean, or a coal plant's exhaust plume pulling into a bus station. But things can go more wrong than that - try loading passengers into that exhaust plume, for instance. They'll probably choke, as does the game that assumed the plume was a bus instead. Though I can't think of a reason why the absence of a station set would lead to a crash (and I can't check the stacktrace to see what the game was doing, because unlike Linux, Windows stacktraces need tools to decipher), there appears to be one.
Comment by Bogdan (bnegrut) - Sunday, 25 March 2018, 13:59 GMT
New Game, without changing any GRF, still crash.