godarklight / DarkMultiPlayer

DarkMultiPlayer - A multiplayer mod for Kerbal Space Program
MIT License
280 stars 120 forks source link

DMP Server crashing on disconnect #416

Closed 81ninja closed 7 years ago

81ninja commented 7 years ago

Environment

Description

Ever since KSP 1.3.0 / DMP 0.2.4.3, the server is sometimes crashing after the last player disconnects.

Additional Info

[19:51:42][DEBUG] : Saving 1 scenario modules from *****
[19:58:33][INFO] : Removed 0 debris
[20:00:20][INFO] : Disconnecting client *****, endpoint *****, Connection timed out
[20:00:20][DEBUG] : Online players is now: 0, connected: 0
[20:00:20][ERROR] : Fatal error thrown, exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at DarkMultiPlayerServer.Messages.WarpControl.DisconnectPlayer(ClientObject client)
   at DarkMultiPlayerServer.ClientHandler.DisconnectClient(ClientObject client)
   at DarkMultiPlayerServer.Messages.Heartbeat.CheckHeartBeat(ClientObject client)
   at DarkMultiPlayerServer.ClientHandler.ThreadMain()
[20:00:20][INFO] : Shutting down - Crashed!
[20:00:20][INFO] : Stopping HTTP server...
[20:00:20][DEBUG] : Stopping reporter
[20:00:20][INFO] : Goodbye!
81ninja commented 7 years ago

(Reproduced) The server was crashing if the/a player gets disconnected while on warp mode.

Need to test this with more players online, but I believe it's now fixed. The may be other implications in the warp list and/or subspaces, so I'm keeping this open to investigate.