Duplicate GameConnection for the same player
- Dominant language
- Python
- Stars
- 72
- Forks
- 84
- Avg merge
- 5h 11m
- Merged PRs (30d)
- 1
Description
Seeing a lot of errors like this in the logs, which appear to be caused by setting the result of a future that has already been completed.
```
2025-03-12 15:16:15.730 ERROR Mar 12 19:16:15 GameConnection.24457933 Something awful happened in a game thread! invalid state
2025-03-12 15:16:15.730 Traceback (most recent call last):
2025-03-12 15:16:15.730 File "/usr/local/lib/python3.10/site-packages/server/gameconnection.py", line 205, in handle_action
2025-03-12 15:16:15.730 await COMMAND_HANDLERS[command](self, *args)
2025-03-12 15:16:15.730 File "/usr/local/lib/python3.10/site-packages/server/gameconnection.py", line 468, in handle_game_state
2025-03-12 15:16:15.730 await self._handle_lobby_state()
2025-03-12 15:16:15.730 File "/usr/local/lib/python3.10/site-packages/server/gameconnection.py", line 136, in _handle_lobby_state
2025-03-12 15:16:15.730 self.game.set_hosted()
2025-03-12 15:16:15.730 File "/usr/local/lib/python3.10/site-packages/server/games/game.py", line 301, in set_hosted
2025-03-12 15:16:15.730 self._hosted_future.set_result(None)
2025-03-12 15:16:15.730 asyncio.exceptions.InvalidStateError: invalid state
```
Looking at all of the log messages associated with this particular game ID, it appears that the host player gets two `GameConnection` objects created for them which seems odd. Maybe this is causing duplicate handling of the game hosted message?
```
INFO Mar 12 19:16:14 CustomGame.24457933 Added game connection GameConnection(Player(Seraphim-Noob, 42707, Rating(mean=2448.57, dev=94.6473), Rating(mean=1803.53, dev=65.2503)), Game(24457933, Seraphim-Noob, maps/scmp_009.zip))
INFO Mar 12 19:16:14 CustomGame.24457933 Added game connection GameConnection(Player(Seraphim-Noob, 42707, Rating(mean=2448.57, dev=94.6473), Rating(mean=1803.53, dev=65.2503)), Game(24457933, Seraphim-Noob, maps/scmp_009.zip))
ERROR Mar 12 19:16:15 GameConnection.24457933 Something awful happened in a game thread! invalid state
INFO Mar 12 19:16:15 CustomGame.24457933 Removed game connection GameConnection(Player(Seraphim-Noob, 42707, Rating(mean=2448.57, dev=94.6473), Rating(mean=1803.53, dev=65.2503)), Game(24457933, Seraphim-Noob, maps/scmp_009.zip))
INFO Mar 12 19:16:15 CustomGame.24457933 Game cancelled pre launch
```
Requires investigation.
Contributor guide
Assessment
This issue has not been assessed yet.