The International Simutrans Forum

Simutrans Extended => Simutrans-Extended development => Simutrans-Extended bug reports => Topic started by: Vladki on February 23, 2019, 01:24:34 PM

Title: Train disappears in server game
Post by: Vladki on February 23, 2019, 01:24:34 PM
It happened to me already twice, that a train just disappeared in server game. (on the stephensons-siemens server). I was reconstructing the rail tracks and for a short while there might have been no route, but not for long (maybe a minute or two in real time). I got disconnected, and when connected back, one of the trains on the affected line was gone. At least I got some refund for it...    I would expect the train to get stuck and wait for player to fix the tracks....
Title: Re: Train disappears in server game
Post by: jamespetts on February 23, 2019, 01:57:52 PM
This, I think and if I recall correctly, is the emergency response when a train gets stuck and cannot get to any depot, even by teleporting. Were any suitable depots available anywhere for this to go to?
Title: Re: Train disappears in server game
Post by: Vladki on February 23, 2019, 02:25:05 PM
Yes There was a suitable depot (at least for teleporting).
Title: Re: Train disappears in server game
Post by: jamespetts on February 23, 2019, 03:48:14 PM
Can you upload a saved game in which this can reliably be reproduced at a specific place and time?
Title: Re: Train disappears in server game
Post by: Vladki on February 23, 2019, 03:49:46 PM
I'll try if I can make it happen again. Usually the autosave is broken after that and the demo game is loaded.
Title: Re: Train disappears in server game
Post by: jamespetts on February 23, 2019, 03:54:10 PM
Quote from: Vladki on February 23, 2019, 03:49:46 PM
I'll try if I can make it happen again. Usually the autosave is broken after that and the demo game is loaded.

I am not sure that I follow what you mean by "after that and the demo game is loaded" - can you elaborate?
Title: Re: Train disappears in server game
Post by: Vladki on February 23, 2019, 04:29:36 PM
I'm not sure how it all went, but I think I got disconnected, and when tried to load the automatic save-on-quit game simutrans crashed, and next time showed the demo game...
Whatever I do not recall exactly what happened, and it would be quite hard to replicate...
Title: Re: Train disappears in server game
Post by: jamespetts on February 23, 2019, 05:46:17 PM
I see - if you do manage to produce a reproduction case for either this or the original issue, please do let me know.
Title: Re: Train disappears in server game
Post by: Vladki on April 09, 2019, 07:01:31 PM
Ok, it happened again. I somewhat thought it could happen, but did not save the game before....
I have deleted a rail bridge on active line. Soon after that a train reported no route, and before I managed to finish the earthworks for new bridge I was disconnected from the game. When I returned, the train was sold. It did not take more than a minute between deleting the bridge and disconnecting.
Title: Re: Train disappears in server game
Post by: jamespetts on April 09, 2019, 09:07:05 PM
Is this reliably reproducible; i.e., does it always happen when deleting a railway bridge on an active line? I will not be able to investigate this without being able to reproduce it reliably.
Title: Re: Train disappears in server game
Post by: Vladki on April 17, 2019, 11:44:18 PM
I tried to prepare a test case by removing one tile of track and that went without any problems - no route was shown for several minutes, and I had plenty of time to rebuild it and got no desync. However, later when I played and rebuilt tunnels for higher speed (longer curves), I got desynced and lost my train. I seems that it desynced just at the moment when the new track was finished.
Title: Re: Train disappears in server game
Post by: jamespetts on April 18, 2019, 12:24:21 AM
This appears to relate to a loss of synchronisation issue rather than a train disappearing.

I should note that I have recently fixed a bug that would cause trains to teleport in some cases where a token block signal and a choose signal were used in certain combinations; I wonder whether that might have fixed your issue.
Title: Re: Train disappears in server game
Post by: ACarlotti on April 18, 2019, 01:02:08 AM
The loss of synchronisation could occur if you managed to make changes to the world without (or before) triggering any of the blocks of code that wait for the convoy routing to stop. If that were the cause of the desync, then it would only be triggered by actions taken on one particular step (per convoy) every 25s (the length of time between consecutive route searches for a convoy), so it would be hard to reliably reproduce. However, one approach might be to identify a save game and a precise sequence of clicks that sometimes leads to a desync (on the last click), and then one of us could try setting a breakpoint at the point where the tool action is carried out and stepping through the code from there to see what happens.
Title: Re: Train disappears in server game
Post by: jamespetts on April 22, 2019, 11:49:30 PM
Can I ask whether anyone is able to reproduce this issue with to-morrow's nightly build?
Title: Re: Train disappears in server game
Post by: Vladki on May 16, 2019, 08:32:14 PM
It happened again. This time I was not modyfing the tracks at all. For some unknown reason one train started to complain that the tracks on its way have lower axle load than necessary, which was not true. I also noticed that the train had "reverse schedule" checked, which was also not expected (the schedule does not use the mirror schedule feature). When I opened the train schedule, removed the reversal mark and closed, the train stopped complaining and departed, but shortly after that I got desynced.The train continued its journey in the local disconnected game, but disappeared from server. I just wonder why it is "sold immediately" instead of teleporting to depot in case of routing problems?
Title: Re: Train disappears in server game
Post by: jamespetts on May 16, 2019, 09:54:35 PM
Thank you for the report. May I ask whether there is any means of producing a reliable reproduction case for this?
Title: Re: Train disappears in server game
Post by: ACarlotti on May 16, 2019, 10:50:28 PM
The first step could be to try reproducing it from the save that you were using before the desync (if you have it). I think this is available in the directory that contains the save directory - you can probably identify the correct save by looking at the most recently modified files.

In this case I do also have a recent save from the server; if the train is already in the unexpected state in that save, I might be able to try reproducing it locally. Which particular train was it?
Title: Re: Train disappears in server game
Post by: Vladki on May 16, 2019, 11:07:31 PM
It was two days ago on siemens game - train departing from turningford towards gosish... Engine was probably LBSCR class J
I do not think that desync produces a save. Saving an online game desyncs by itself. I do not think that save after desync would be useful.
I tried several times to create a no-route situation but never succeded to recreate the desync.
Title: Re: Train disappears in server game
Post by: ACarlotti on May 17, 2019, 12:35:04 AM
I forgot that this probably wasn't Bridgewater-Brunel.

When you connect to the server, the server needs to save the game before sending it to the client, and the client needs to write that save to a file before loading it. Any other clients also need to save the game to a file. So at any time you can find the save game that was last loaded by your client. For instance, I just started up a server and connected two clients to it on my laptop. I can then find the save games in the folder ~/simutrans - in this instance the server wrote its save to ~/simutrans/server13353-network.sve, the first client wrote to ~/simutrans/client2-network.sve, and the second client wrote to ~/simutrans/client3-network.sve. The first and third files are identical since they were both saves from the server; the second file differed in size, but hopefully not in any manner that would affect synchronisation (as an example, currently open windows would cause save files to differ). If you think you might want to try reproducing something that happened in a server game, then you should make a copy of the relevant file (and if you copy it into the save directory, then you can load it directly onto a locally-running server).
Title: Re: Train disappears in server game
Post by: Vladki on August 27, 2019, 11:10:25 PM
Now I witnessed similar behavior. This time the train which could not find route disappeared (sold), but without desync. It was when electric train had part of electrification missing on its way. However, the electrification was rebuilt shortly after the no route message. I thought that such vehicles will be teleported to depot, instead of being sold. Also I would expect that before teleporting or selling the convoy, a last attempt at finding the route would be done.
Title: Re: Train disappears in server game
Post by: Vladki on January 26, 2020, 09:10:14 PM
I think I have a reproduction case. Use the stephenson siemens game, switch to "great beltwell railroad", and wait for train to arrive to lakebourne.
While it is waiting for departure, rotate the one way sign at (123,682). Wait for no route message, some time after second repetition of the message you should get desync. After reconnecting, the train is gone. Usually it will desync even if you manage to put the sign back in original position.

I tried similar trick at (888,911) as "raven express transport" but that worked fine - no desync happened and train continued normally even after quite some repeated messages.

The differences may be: there is a passing loop (i.e. signal) between lakebourne and  (123,682), which is not at (888,911).
So I tried to switch an underground one way sign at (43,731) - in an underground passing loop, exacly the same signalling config as at (888,911). It seemed to be OK - no route message disappeared, train started reversing and then I got desync, and train was lost again

Also it may be that there is something wrong with GBR player. It has a checkbox in the list of players, who knows what it means?

Title: Re: Train disappears in server game
Post by: Elemental on January 26, 2020, 10:06:23 PM
I think that is the checkbox used to activate AI players
Title: Re: Train disappears in server game
Post by: Mariculous on January 26, 2020, 10:18:49 PM
Quote from: Vladki on January 26, 2020, 09:10:14 PMAlso it may be that there is something wrong with GBR player. It has a checkbox in the list of players, who knows what it means?
It was started as AI.
Title: Re: Train disappears in server game
Post by: jamespetts on January 27, 2020, 01:05:56 AM
Vladki - because the server game changes state regularly, can you upload a saved game representing a point in time in the server game where this can reliably be reproduced based on these instructions? That would be most helpful - thank you.
Title: Re: Train disappears in server game
Post by: Vladki on January 27, 2020, 08:10:54 AM
I think it should work any time