The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: Dwachs on July 14, 2013, 07:15:57 PM

Title: Bug: loading corrupt savegame causes simutrans to hang
Post by: Dwachs on July 14, 2013, 07:15:57 PM
Savegame here:

http://simutrans-forum.de/forum/index.php?page=Thread&postID=95846#post95846

What happens: bz2_read_bla returns an erorr code -4 (data corrupt). The fillbuffer-thread errors out. The reading thread waits infinitely for the fillbuffer thread to continue.

I do not have a quick patch :/ I think the fillbuffer thread should somehow signal the occurance of an error (setting buf_len to -1 ?). The reading thread should then react with a dbg->fatal error.
Title: Re: Bug: loading corrupt savegame causes simutrans to hang
Post by: Ters on July 14, 2013, 08:26:06 PM
It should ideally work the same whether it is multi threaded, single threaded or unbuffered, bzipped or gzipped. As it is, read() may return either 0 or -1 on error.

There is also how to handle errors during writing. This will be a bit strange, since the error will be reported at different places depending on threading. With threading it will be detected at writing som later data, or during the final flush.
Title: Re: Bug: loading corrupt savegame causes simutrans to hang
Post by: Dwachs on July 24, 2013, 07:08:32 PM
hopefully fixed in r6601