thomaswp / BeaverBuddies

GNU General Public License v3.0
16 stars 2 forks source link

Host sometimes hangs after client quits #6

Open thomaswp opened 7 months ago

thomaswp commented 7 months ago

Important: Do not restart Timberborn after your bug has happened. This will overwrite your log file, which is important for diagnosing bugs! You can close the game, but do not restart it until you have submitted this report.

Describe the bug Sometimes when a client disconnects the host's game will freeze, seemingly in an infinite loop.

Logs: Unfortunately, nothing gets written to the log.

To Reproduce: I'm unable to reproduce consistently, but times it has happened include

  1. The client exists while loading the map.
  2. The client desyncs and then quits.
  3. Possible when tabbing out for a while on client/server during disconnects. Not clear if these are all the same issues.

I've tried to look for possible infinite loops, but the only while loops I can find are in async Tasks or in dequeuing loops, which seem relatively save...

thomaswp commented 7 months ago

I think this is because sending events does not happen on a thread, and as a result TimberServer.SendEventToClients() hangs on the lock. I don't think there's any reason every send needs to even lock this...