Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race conditons between GC instances allow registering/deregistering multiple servers with the same invite code #79

Open
frosch123 opened this issue Nov 3, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@frosch123
Copy link
Member

Race condition to registering a server

Steps:

  1. Start two servers with the same openttd.cfg / on the same machine as "local".
  2. Switch both servers to "invite" or "public" at the same time.

Now both servers connect to different GC instances and try to register with the same invite code.
There is a window of about 2 seconds, where both registrations succeed.

  • Both GC instances will think they own the server, and report success to the server.
  • One server will win in redis, but that does not matter unless the GC instances restart.

Race condition to deregistering a server

Steps:

  1. Same as above
  2. Exit both servers at the same time, e.g. using killall -9 openttd.

Now both GC instances will

  • detect that their server exited,
  • will delete the server, and
  • inform the other instance of the deletion.

This can cause a KeyError exception in coordinator.py: remove_server()

  • The invite code is checked at the beginning of remove_server()
  • During any await inside remove_server() the remove-notification from the other instance may be received.
  • The del at the end throws, because the server was already deleted.
@TrueBrain TrueBrain added the bug Something isn't working label Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants