The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: jamespetts on September 30, 2017, 10:20:53 AM

Title: [Fix] Crashes when desynchronising from a server in some cases
Post by: jamespetts on September 30, 2017, 10:20:53 AM
I have recently found and fixed on Extended recently a crash bug that occurs in identical code to Standard: see here (https://github.com/jamespetts/simutrans-extended/commit/7ce9adb834cc2e008699cb8b976068c0bf230a62) for the Github commit. The solution is quite straightforward, as will be apparent from the commit.

The bug involves a double free of the "nwc" object when a connecting client disconnects from a server. The fix checks whether the first delete operation has occurred and makes the second delete operation conditional on that check.

I vaguely remember this being reported as having been an intermittent problem for some time. It only affects clients, not servers.
Title: Re: [Fix] Crashes when desynchronising from a server in some cases
Post by: Dwachs on October 01, 2017, 09:19:51 AM
thanks for the post! This could have been fixed also by removing the 'delete nwc' in do_network_world_command?
Title: Re: [Fix] Crashes when desynchronising from a server in some cases
Post by: jamespetts on October 01, 2017, 09:29:42 AM
I am not sure - might this not have lead to a memory leak if necessary was not deleted elsewhere? I am not sure what the purpose of this was.
Title: Re: [Fix] Crashes when desynchronising from a server in some cases
Post by: Dwachs on October 01, 2017, 09:38:13 AM
To me it looks like a double-delete. Will check later.
Title: Re: [Fix] Crashes when desynchronising from a server in some cases
Post by: jamespetts on October 01, 2017, 10:47:22 AM
Yes, the crash was of a double free type.
Title: Re: [Fix] Crashes when desynchronising from a server in some cases
Post by: Dwachs on October 01, 2017, 04:13:42 PM
Removed the double delete command, see r8299.