News:

Want to praise Simutrans?
Your feedback is important for us ;D.

Desyncs and crashes attempting to connect to an online server

Started by DrSuperGood, December 01, 2017, 03:57:36 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DrSuperGood

It is not possible for me to play on the server. Map transfers and loads fine, but server takes about 5-10 minutes to unpause. When it unpauses I am immediately dropped for being out of sync by the game, and some times my client crashes as a result. My client is running with threads set to 8 (to match the total number of available processing units on my CPU, which is a quad core with HT).

Edit:
Setting threads to 6 results in no desync. This points towards a possible race condition? Loading times for the server are still excessive. It also eventually desynced after 30 minutes or so of playing.

The crash seems to be a null pointer dereference after desyncing once, reconnecting again and then desyncing again while threads is set to 8.

jamespetts

Thank you for testing the server - that is most helpful. I have split this thread and moved it to the development forum as this is principally a bug report.

I have yet to have time to test this (and I am away this week-end), but the desync appears as if it might be caused by a failure properly to load/save the number of threads: the number needs to be the same on client and server, and the server is currently running with 6 threads. The code is designed so that, in a multi-player game, the number of threads specified on the server overrides the number of threads specified on the client, but it appears from your report as if this may not be working.

I am not sure what causes the crash, which I shall have to investigate. I did fix some time ago some crashes that occurred when clients lost synchronisation; I am not sure whether this is of a similar sort. That fix was to an issue that existed at the time in Standard. It is also possible that the problem is connected with the issue discussed above relating to the number of threads.

In relation to the excessive time that the server takes to load the game, I am not sure what is causing this. The server appears to perform acceptably in other operations (saving, transferring and running the game; if it were slow in the latter, clients would desync quickly in a developed game such as the test game that was formerly on the server, yet testing showed that clients were able to stay in sync), so the performance of the server generally does not appear to be an issue. Loading a saved game also does not seem to be a problem for the clients, which do it in a small fraction of time that it takes the server to do it. It is very difficult to imagine what thing might be specific to both the server and to loading a game that causes the performance problem that cannot be generalised either to the server or to loading a game when those two things do not come together.

May I ask whether this has ever been observed (even on a smaller scale, as the maps there tend to be smaller) on Standard?

Edit: In relation to the server loading times, I note that the adding of buildings to the world list is ordered when in network mode and non-ordered when not in network mode, which would well be relevant (as this is very computationally intensive when there are many buildings), but this does not explain why the client (also in network mode) takes a fraction of the time to load the game compared to the server.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

DrSuperGood

You have not mentioned the CPU the server is using. For example a Core2Quad is extremely slow compared with a modern generation i7, even if that i7 is at a slower clock speed. My client is running a second generation quad core with HT i7, and modern i7 processors are clock for clock about twice as fast.

jamespetts

I do not know what the server is using: it is a VPS. I was planning to check its CPU performance when I get a chance.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

jamespetts

I have just run a general CPU performance test on the server (albeit this may not be as accurate as it might be on account of the server running Simutrans-Extended in the background whilst this test was performed).

I get the following results:



Maximum prime number checked in CPU test: 20000


Test execution summary:
    total time:                          26.2488s
    total number of events:              10000
    total time taken by event execution: 26.2445
    per-request statistics:
         min:                                  2.48ms
         avg:                                  2.62ms
         max:                                 11.43ms
         approx.  95 percentile:               3.17ms

Threads fairness:
    events (avg/stddev):           10000.0000/0.00
    execution time (avg/stddev):   26.2445/0.00
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.