The International Simutrans Forum

 

Author Topic: [RC 11.9] Loading fails too many intercity roads - also probably affects Standard  (Read 10940 times)

0 Members and 1 Guest are viewing this topic.

Offline pwhk

  • *
  • Posts: 60
  • Languages: ZH, EN
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #35 on: April 11, 2013, 03:53:23 PM »
Hm... I don't have any good 11.9003 savegame to load...

After loading 10.11+pak0.8.3 autosave in 11.9003 and re-save it as 11.9003+pak0.8.4 save file, loading that file fails.

The loaded save file is http://simutrans-germany.com/files/upload/autosave01.sve
And re-saved file is http://simutrans-germany.com/files/upload/1.sve

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #36 on: April 11, 2013, 06:08:30 PM »
Thank you for checking that. Can you check whether you have the same issue with the latest version of Standard? Thank you!

Offline pwhk

  • *
  • Posts: 60
  • Languages: ZH, EN
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #37 on: April 12, 2013, 12:48:02 PM »
Simutrans-Standard 112.2 r6390M + pak64 112.2 r1185 does not exhibit this issue.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #38 on: April 12, 2013, 12:49:18 PM »
May I ask - do you use the single user install?

Edit: Also - would you mind sending me/uploading an uncompressed binary version of your corrupted save file based on the game loaded from an earlier version and re-saved without being changed so that I can look for the differences between the two with a hex editor?

Apologies, incidentally, for asking so much: I am afraid that it is very difficult for me to test this properly without being able to reproduce the problem myself, so I have to rely on those who can. You have been most helpful.
« Last Edit: April 12, 2013, 10:20:28 PM by jamespetts »

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9516
  • Languages: De,EN,JP
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #39 on: April 12, 2013, 10:31:02 PM »
This rather indicates something is saved in another size than loded, if XML works.

And as mentioned before: The error is usually not in the city roads but in stuff saved before it. Could be even three objects before, with "luck".

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #40 on: April 12, 2013, 11:00:23 PM »
Yes, indeed, you are correct: my tests show that all of the data in loading/saving the settings are shifted up by one. The problem originates before even loading/saving the settings, a the pakset string is corrupted. Instead of "Pak128.Britain-Ex-0.8.3" or the like, the pakset string is: "E:\Saved Games\Simutrans-Experimental\Pak128.Britain-Ex-0." (or something similar, depending on which of the various saved games that have been uploaded in this thread is used). Because I cannot reproduce the problem in saving the game itself, I have yet to work out why/how this is occurring.

Offline pwhk

  • *
  • Posts: 60
  • Languages: ZH, EN
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #41 on: April 13, 2013, 02:06:17 AM »
http://simutrans-germany.com/files/upload/save.zip
Contains both uncompressed 10.11 save and corrupted RC 11.9003 save, zipped with 7-zip (so when extracted with 7-zip they should give two uncompressed files)

My saves are stored in user directory.

btw, this is what I get when I open up the load dialog.

Offline Markohs

  • DevTeam, Coder/patcher
  • Devotees (Inactive)
  • *
  • Posts: 1559
  • Languages: EN,ES,CAT
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #42 on: April 13, 2013, 02:17:12 AM »
mmm.... this is related to simutrans standard commit 6024 I think and if I'm not wrong the problem must be in how you merged loadsave_frame_t::get_info in experimental code.

But the detail of the bug might be somewere on that patch, because I experienced that bug when I developed the patch and fixed it before commiting. Something in experimental triggers the bug again, afaik.

Deleting save/_cached.xml *MIGHT* solve the bug too.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #43 on: April 13, 2013, 11:15:19 AM »
The oddest thing about this bug is that it appears to occur on some people's systems and not on others. May I ask - how long ago was this patch put into the code? I cannot find anything before March 2010 mentioning "loadsave_frame_t::get_info".

Edit: Also, I have yet to work out how to find a commit by SVN revision number in the Standard code - but I can find it on the Github mirrors by date.

Edit 2: I wonder whether this might be related to this issue...?
« Last Edit: April 13, 2013, 11:52:22 AM by jamespetts »

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #44 on: April 14, 2013, 06:31:27 PM »
I have not found a definitive solution to this problem (which is very hard when I cannot reproduce it) but I think that I have managed to produce a workaround on my Github branch. Unfortunately, this will not be effective without a new pakset version release, as it uses the pakset version string (which is not defined in 0.8.4 owing to an oversight) instead of the pakset folder name where it detects corruption of the pakset string (where the second character is a colon: this fix will only work in Windows, therefore, but the problem only appears to have occurred in Windows so far in any event).

I have also incidentally fixed a number of coding errors, tracked down with Dr. Memory, that did not produce known bugs but that were theoretically capable of causing unpredictable behaviour, which it is just possible might fix the issue, although there is no easy way of testing it.

Edit: In the meantime, I recommend using the XML save as a workaround.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #45 on: April 16, 2013, 06:18:39 PM »
Can all those who have had the problem re-test with RC 11.9004 to check whether this recurs?

Offline killwater

  • *
  • Posts: 221
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #46 on: April 16, 2013, 08:01:42 PM »
I'm sorry James mine is still crashing. Tried 3 times. Tried with 112.3 and 112.2 savegame version. 
zipped does not work
xml_zipped works
xml_bzip2 works but painfully slow

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #47 on: April 16, 2013, 09:35:13 PM »
This is extremely odd. Can you upload your saved games from this latest version?

Offline pwhk

  • *
  • Posts: 60
  • Languages: ZH, EN
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #48 on: April 19, 2013, 12:37:47 AM »
RC 11.9004 Doesn't work for me too... :(

The following save does not touch any new game config, and used the old config taken from previous testing (i.e. the config files are not touched in the update)
http://simutrans-germany.com/files/upload/1.sve

Offline killwater

  • *
  • Posts: 221
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #49 on: April 20, 2013, 07:58:27 PM »
Hello would you like zipped one?
Here it is:
http://simutrans-germany.com/files/upload/3.sve


djgoldsmith

  • Guest
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #50 on: April 21, 2013, 09:13:51 AM »
Hi,

I am also having this problem on a fresh build of RC-11.9004.   Looks like I am the first with the problem on linux.

Any save from the new version give the "Too many (x) city roads" message.   However, Saves from the previous release (111.2.1 experimental 10.27) do load.

One thing I have noticed is the strings in the load game dialog box are munged:
Saves from previous release (that work) are <Name> <Date> <Pak> <Simutrans Version> <Ex-Version>
Saves from 11.9004 Are <Name> <Date> </home/dang/build>

So it looks like the Pakname is being replaced with the build / run directory

You can see this also in pwhks post

btw, this is what I get when I open up the load dialog.



Will be having a root around to see if I can track down the problem.  Will keep you updated.

EDIT:

XML Saves work fine for me.



Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #51 on: April 21, 2013, 12:22:06 PM »
Yes - that I have discovered: the trouble is that, because I cannot reproduce the issue, I have no idea what actually happens in the code to cause this at save time. Any investigation that you are able to undertake that might provide some illumination would be most worthwhile.
« Last Edit: April 21, 2013, 01:23:18 PM by jamespetts »

Offline Vonjo

  • *
  • Posts: 273
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #52 on: April 21, 2013, 04:25:35 PM »
How about using another paksets? Does this problem occur with all paksets?
I didn't have this problem with pak128-standard. I haven't tried pak.brit-ex.

djgoldsmith

  • Guest
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #53 on: April 23, 2013, 08:33:42 PM »
I have worked out the problem :) , now just have to write a fix  ???.

It appears that the pakset string being too long causes the issue.  Currently the pakset string in the save file is the full working directory of the pak, as the array to hold it is limited to 64 characters then if it goes longer than this you get an overrun.
If you move the working directory of simutrans, then the problem goes away (or you can replicate it)

For example if I moved simutrans (and thus the pakset) from:

Code: [Select]
$/home/dang/build/simutrans-experimental/simutrans/Pak128.Britain-Ex-0.8.3  (73 Chars)
to  $/home/dang/simutrans/Pak128.Britain-Ex-0.8.3/   (45 Chars)

I could save in binary.  James to replicate the bug you could try running from a few directories down the tree.

You can also edit the save file and remove a few characters from the first string which also made it work for me.


I am working on a quick fix now,  was intending to string the pakset string from its current form (the full path) to just the working directory.  However, James I see in other posts you were asking about this string, and where it comes from (copyright?) If this is solved in the pakset then the problem should resolve itself.

It shouldn't take too long, but its my first (I hope on many) trip into the simutrans source, so its taking a bit of time to get my head around things.  And I haven't coded in standard c++ for about 5 years (been wasting my time with Python and NesC) so its taking a bit of time to adjust back.


Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #54 on: April 23, 2013, 10:14:50 PM »
Hmm - this is rather curious. Thank you very much for your work on this. Have you managed to track down where in the code the full path appears? I do not seem to get the full path at all when I look at the relevant part of loadsave.cc with a debugger - but which lines are you looking at exactly? The problem seemed to me to be precisely that the full path was being used somewhere where it ought not to be used, but I could never reproduce the problem and find out where the full path ended up being used incorrectly. If you are able to shed any light on that, that would be most helpful.

djgoldsmith

  • Guest
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #55 on: April 24, 2013, 08:36:39 AM »
Hi, sorry family called last night, so didn't make as much progress as I hoped.

Sticking some debug statements in it looks like the relevant code is in loadsave.cc lines
325 - 372
It appears to be the pakset_string variable written to file in line 358 that is the problem.

that's under the rc11-1004 tag

simutrans source is still only a day old as far as I am concerned, so it's all a bit of a mystery where function calls go, slowly starting to see bits of the big picture :)  I am interested in contributing, if there are any resources that could help me get started drop me a pm.  A quick heads up on what's what in the git repository would be useful, I am used to svn / bzr so haven't quite got that either.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #56 on: April 24, 2013, 10:45:39 PM »
I have just pushed one change to the Github repository which might conceivably make a difference to this issue: would you be so kind as to try re-compiling with the latest code and check whether the problem recurs?

More generally as to the code - what sort of thing did you want information about particularly? As you may know, Experimental is a fork of Standard, so I am rather unfamiliar myself with many parts of the code that have not changed significantly or at all from Standard to Experimental (the code for graphics, for example, or sound). The Github repository is what we use for Experimental - Standard primarily uses SVN, but there is an official Github mirror, which is used for merging the latest changes from Standard into Experimental. There are a number of branches. "Master" is always the latest released version (here, 10.27). There are a number of older branches for previous projects since merged, and a 10.x branch that will soon be superseded by a 11.x branch that deals with bug fixes based on the latest main version. The current branch on which development is occurring is the 112.x-private-car-merge branch, which is a merger of the 112.x-merge branch, itself a merger of Experimental and the changes in Standard 112.x, and the private-car-routing branch of Experimental, which introduced a number of new features.

In recent times, Bernd Gabriel has very helpfully done a lot of work on merging, and has also worked a great deal on the physics, which are different in Experimental to Standard (we have braking physics, for example). Information in this forum should give you some useful pointers about the Standard code, on which, of course, the Experimental code is closely based.

I hope that that is a helpful start - do let me know if you want more specific sorts of information and I shall try to assist.

djgoldsmith

  • Guest
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #57 on: April 27, 2013, 08:26:05 AM »
I am afraid that your change didn't work for me. I still get a too many roads error

Ref the Code,  thanks for pointing me in the direction of the forum, looks like an excellent place to start.
Started to understand how git works, and have an idea of what branch to develop on now.
Just need to delve a bit deeper into the simutrans source to try to get an idea of how it all hangs together.

Regards.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #58 on: April 27, 2013, 10:33:46 AM »
You say that you still get a too many roads error: may I check - are you trying to load a game that you saved with the previous code, or are you trying to save/load a new game? As the error occurs on saving, not loading, only the latter will be a proper test.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [RC 11.9] Loading fails too many intercity roads (816)
« Reply #59 on: April 30, 2013, 11:32:37 PM »
I think that I have eventually found and fixed this issue, which was caused by too short a buffer in loadsave.cc (see this commit). In principle, this problem ought to affect Standard, too, so I am moving this to the Standard board, as the fix that I have applied in Experimental ought to work for Standard.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9516
  • Languages: De,EN,JP
This cannot affect standard, as sizeof(SAVEGAME_PREFIX) is smaller than 77. If you want to play it save the buffer should have rather the size of char buf[sizeof(SAVEGAME_PREFIX)+sizeof(XML_SAVEGAME_PREFIX)+ 2 ]

Offline killwater

  • *
  • Posts: 221
Saving is working for me with RC11.9006

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Excellent! Thank you for testing.