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

Must Finish Battle in X Save Game Corrupted #3377

Closed
ron-murhammer opened this issue Apr 17, 2018 · 3 comments
Closed

Must Finish Battle in X Save Game Corrupted #3377

ron-murhammer opened this issue Apr 17, 2018 · 3 comments

Comments

@ron-murhammer
Copy link
Member

@ron-murhammer ron-murhammer commented Apr 17, 2018

Happened in the lobby on bot102 around 10:30PM CST (an hour or so before this issue was opened).

Here is the save game which even if you try to take a save from history from earlier in the round its still corrupted:
Bot103_Must_Finish_Battle_Error.zip

It appears that something happened during the battle in N.Turkey which caused it not to ever end and prevent any further battles from being fought.

@ron-murhammer

This comment has been minimized.

Copy link
Member Author

@ron-murhammer ron-murhammer commented Apr 17, 2018

So I pulled the logs and don't see any issues. Just appear to be one of the players lost connection and it took an autosave:

Apr 16 22:21:38 bot15_newark_nj run_bot.sh:  Attempting to stop game.
Apr 16 22:21:38 bot15_newark_nj run_bot.sh:  StopGame successful.
Apr 16 22:21:38 bot15_newark_nj run_bot.sh:  Connection lost to:Undying game is over.  Game saved to:Bot102_NEWARK_NJ_autosave.tsvg
Apr 16 22:21:38 bot15_newark_nj run_bot.sh:  Apr 17, 2018 3:21:38 AM games.strategy.engine.chat.ChatController leaveChatInternal
Apr 16 22:21:38 bot15_newark_nj run_bot.sh:  INFO: Chatter:Undying port:52200 ip:24.53.2.225 has left chat:games.strategy.engine.framework.ui.ServerStartup.CHAT_NAME
Apr 16 22:21:38 bot15_newark_nj run_bot.sh:  Apr 17, 2018 3:21:38 AM games.strategy.net.ServerMessenger removeConnection
Apr 16 22:21:38 bot15_newark_nj run_bot.sh:  INFO: Connection removed:Undying port:52200 ip:24.53.2.225
Apr 16 22:21:39 bot15_newark_nj run_bot.sh:  Game ended, going back to waiting.
Apr 16 22:21:39 bot15_newark_nj run_bot.sh:  Waiting for users to connect.
Apr 16 22:21:39 bot15_newark_nj run_bot.sh:  Game Status: Waiting For Players
@ron-murhammer

This comment has been minimized.

Copy link
Member Author

@ron-murhammer ron-murhammer commented Apr 17, 2018

From what I can tell, it appears that the autosave is taken after the battle is complete but before it sets "currentBattle" to null on this line:
https://github.com/triplea-game/triplea/blob/master/game-core/src/main/java/games/strategy/triplea/delegate/BattleDelegate.java#L222

Anyone familiar with how the autosave works when players disconnect? Essentially in this case, the battle is complete but since it doesn't clear the currentBattle variable it then stays stuck on that battle for eternity.

@ron-murhammer

This comment has been minimized.

Copy link
Member Author

@ron-murhammer ron-murhammer commented Apr 18, 2018

I was actually able to recreate the error in a new save game using break points:
Reproduced_Must_Create_Battle_Error.zip

There appears to be lots of locking magic in DelegateExecutionManager that I don't fully understand but essentially it appears to try to allow the delegate start() method to always finish as well as whatever current method even if its outside of that finish.

To reproduce I did the following:

  1. Put a break point towards the end of battle.fight sequence
  2. Fight a battle til the end so it pauses there
  3. Put a break point on currentBattle = null
  4. Save game
  5. Quickly resume (within 6 seconds) to hit second break point as game won't save until it can grab the lock which it appears to do once battle.fight returns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.