EmbarkStudios / crash-handling

Collection of crates to deal with crashes
Apache License 2.0
138 stars 13 forks source link

Add stale client reaping #41

Closed Jake-Shadle closed 2 years ago

Jake-Shadle commented 2 years ago

On Windows we've noticed an issue where killing a client process, and thus not going through the normal client shutdown process, will cause the crash monitor process to stay alive indefinitely, either due to a bug in Windows handling of unix domain sockets, or just taking longer than is reasonable to reap the resources of the killed process. This PR adds a simple stale_timeout to the Server::run to optionally check that each client connection has sent a message within the specified window, and if not, close the connection on the server side. To help, a Client::ping method has been added so that pings can be sent to server to indicate the client is still alive, in case the client is not sending messages frequently to the server to indicate it is still alive.