Hi Saint K,
Thanks for posting here about your problems.
I'm Lewin, one of the KaM Remake developers. I wrote most of the network/server code. Krom wrote most of the render code, and we write the game code about 50/50
I wasn't aware that the Linux version of the server was so unstable, we haven't received many other complaints about it. Unfortunately I'm not an expert on network code and writing servers. I'm not sure if I'm using the network library correctly, there are two separate libraries for Linux and Windows so the Windows one has been much more thoroughly tested because I only have Linux VMs. I spent the past few hours working on the network code to try and resolve your problems, I'll answer each one separately. Are you interested in helping sort this out? I've posted a "testing" version of the server at the end of this message which you can try it out and see if it solves your issues.
1. Exception: This is a bug. I don't know why it happened, I can't see any obvious reason by looking at the code, but I've made the server print out a full stack dump so I can see where it came from and hopefully figure out why it happened. If you can update to this testing version (which I will post below) and send me their log file after this exception occurs I should be able to figure out why and fix the bug.
2. Failing to restart after the exception: You are right, it should pause after closing the server before restarting. I've added a 5 second pause and fixed another bug so it now closes the server properly. I've also made it retry over and over if it fails to restart the server (with 5 second pauses between each attempt) Hopefully this is completely fixed.
3. Low performance: How are you measuring performance? By ping shown in the KaM Remake lobby? Ping measurements in the KaM Remake will be higher than in other games, because it's not just measuring the network delay, it's also measuring the time it takes for the client to respond. We don't use threads in networking so the game cycles between 3 states:
- Updating game state/menus
- Rendering
- Processing network messages
While it is in one of the first two states it won't be responding to pings, and because updating/rendering can take quite a few milliseconds you'll notice a higher ping than you would in another game. If we put networking in a separate thread it would show pings the same as other games, but it wouldn't actually improve the game quality because the network messages cannot be used until the game has finished updating/rendering (you can't update/render the game at the same time as changing it due to the network)
However, you said that renicing it improved the performance? In what way and by how much? (Lower pings? Or something else?) Renicing doesn't make any difference to me but it could be different on a server. I've tweaked the way the server idles (waiting between messages) so it doesn't actually sleep now, instead it just gives the OS a 1ms timeout when asking for updates about sockets, I didn't realise this was possible. Maybe because it was sleeping before the OS moved the process off the CPU (sleeping ends the allocated timeslice as far as I know) This might improve performance for you, please let me know.
Here is a testing version of the server: (Linux x86_64 version only, I can build the x86 one if you want it)
http://lewin.hodgman.id.au/temp/KaM_Ser ... x86_64.zip
It is for clients running r3392 (the current public release) so it should work just the same as the one on our download page, except hopefully it won't have some of the issues you posted about. Please let me know how it goes and send me your log file after a few days or if an exception/crash occurs.
If you're not interested in testing the new version (or don't have time) that's no problem, I can probably get someone else to test it during the beta phase of the next release.
Cheers,
Lewin.