NorthstarLauncher icon indicating copy to clipboard operation
NorthstarLauncher copied to clipboard

Server not retrying registration after failure

Open GeckoEidechse opened this issue 3 years ago • 7 comments

With https://github.com/R2Northstar/NorthstarMasterServer/pull/67 a server auto-restarting after a crash might be blocked by its ghosted hogging the ip:port combo until timeout. The problem is that if the restarted server doesn't retry for registration (with some timeout between attempts) it will never re-register and as such not display on server browser.

From a client's perspective it will look like the server never came back after crashing.

GeckoEidechse avatar May 05 '22 11:05 GeckoEidechse

Here's what I know about this:

  • If a server tries to register more than 30 seconds after the remnant of it's last heartbeat it should be added fine
  • Calling server/remove_server from the dedicated server on close should fix this issue entirely

barnabwhy avatar May 06 '22 09:05 barnabwhy

Calling server/remove_server from the dedicated server on close should fix this issue entirely

That sadly wouldn't solve the case where a server hard-crashes and then gets restarted by e.g. docker-compose. In such a case due to the hard crash the server never had the chance to call /server/remove_server.

Simply retrying registration if it fails on start-up (depending on error response) seems like the simplest solution to me ^^ (We should obviously still have servers call /server/remove_server on normal shutdown.)

GeckoEidechse avatar May 06 '22 10:05 GeckoEidechse

Simply retrying registration if it fails on start-up (depending on error response) seems like the simplest solution to me ^^ (We should obviously still have servers call /server/remove_server on normal shutdown.)

https://github.com/RomeoCantCode/NorthstarLauncher/commit/37b38d6d52deef7f095bcc0314c4de7621a339ec 😄

Also I think the server should check if it was gracefully shut down before. If not it should call /server/remove_server using the previous serverID (would require storing the serverID and like a gracefulshutdown flag on FS).

Also as a side note. If you gracefully shut down the server (using quit command) it will call /server/remove_server but it seems not doing so if you close the console / close server process in some other way.

faky1337 avatar May 06 '22 17:05 faky1337

using the previous serverID (would require storing the serverID and like a gracefulshutdown flag on FS).

I doubt the server could save ID on crash if it can't call /server/remove. We could obviously store it before but we have edge cases like the docker container, where most files are immutable and not stored back to disk. I think the 30s wait to re-register server on crash is honestly fine, so as long as we retry we shouldn't really have an issue. ^^

GeckoEidechse avatar May 06 '22 19:05 GeckoEidechse

RomeoCantCode@37b38d6 smile

You maybe wanna PR that? :3

GeckoEidechse avatar May 10 '22 20:05 GeckoEidechse

RomeoCantCode@37b38d6 smile

You maybe wanna PR that? :3

Needs testing also I don't like goto 😞 also this leads to clients trying to auth as server every 30s while playing because report to master server is enabled by default.

faky1337 avatar May 11 '22 09:05 faky1337

Needs testing also I don't like goto :disappointed:

Agreed but I'd still suggest making one as a draft so it's clear that someone started to look into it :P

GeckoEidechse avatar May 11 '22 11:05 GeckoEidechse