The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: LNBC on November 27, 2014, 10:21:50 AM

Title: [R7373] Crash on Loading saves
Post by: LNBC on November 27, 2014, 10:21:50 AM
The bug is discovered after an upgrading from R5583 (V111.2) to R7373 (V120.1)
[Using Pak128 v 2.5.2 when this situation happens.]

In short, it is unable to Load game after starting the application,
and it HANGS just after pressing the "LOAD GAME" button.
(Windows pop-out: Simutrans stops working.)

More, it is funny that after deleting "_cached.xml" file in my save folder,
Everything goes back to normal again.

It sounded alike a program error that never being reported,
so that's why I am typing the development team what's going wrong.

PS Coming soon: The Laughing Man.
Title: Re: [R7373] Crash on Loading saves
Post by: prissi on November 27, 2014, 02:00:02 PM
That sounds rather like a corrupted _cache.xml which did happen before.

Maybe SImutrans should rename it before open it so future attempts will just rebuilt that file.
Title: Re: [R7373] Crash on Loading saves
Post by: Ters on November 27, 2014, 05:11:24 PM
What Simutrans should do is detect that the file is corrupted and stop reading from it, rather than crash. The cache file can then be regenerated when Simutrans falls back to reading the save games. If someone has enough time to spare.
Title: Re: [R7373] Crash on Loading saves
Post by: prissi on November 27, 2014, 09:34:35 PM
Due to the way of the xml reader it cannot fail gracefully but can only fail with a fatal exception (whithout a lot of hacking around).

As for now I will just make sure this does not repeat itself, i.e. first a file "_load_cached.xml" is deleted, then "_cache.xml" is renamed to "_loade_cached.xml", then after succesful loading it is renamed back.
Title: Re: [R7373] Crash on Loading saves
Post by: Ters on November 28, 2014, 06:01:50 AM
Quote from: prissi on November 27, 2014, 09:34:35 PM
Due to the way of the xml reader it cannot fail gracefully but can only fail with a fatal exception (whithout a lot of hacking around).

I acknowledged that it wan't easy. Where is the xml reader anyway?
Title: Re: [R7373] Crash on Loading saves
Post by: prissi on November 28, 2014, 10:01:19 PM
THe xml read make it tags by automtic construction/destruction of variable. A block starts with xml_tag_t("bla") which trys to find <bla> If it cannot find it (file corrupt), then the constructor fails. One could encapsulate each constructor with try but then the file reading is multithreaded ...