[Fixed] 2 Battle results workers aborted by exception
-
Using 1.10.14030
Feb 09, 2019 4:17:57 PM games.strategy.triplea.odds.calculator.ConcurrentOddsCalculator calculate SEVERE: 2 Battle results workers aborted by exception java.lang.NullPointerException at games.strategy.triplea.delegate.DiceRoll.getTotalPowerAndRolls(DiceRoll.java:665) at games.strategy.triplea.delegate.DiceRoll.getTotalPower(DiceRoll.java:650) at games.strategy.triplea.delegate.BattleCalculator.sortUnitsForCasualtiesWithSupport(BattleCalculator.java:719) at games.strategy.triplea.delegate.BattleCalculator.getDefaultCasualties(BattleCalculator.java:603) at games.strategy.triplea.delegate.BattleCalculator.selectCasualties(BattleCalculator.java:488) at games.strategy.triplea.delegate.Fire.selectCasualties(Fire.java:162) at games.strategy.triplea.delegate.Fire.access$100(Fire.java:25) at games.strategy.triplea.delegate.Fire$2.execute(Fire.java:217) at games.strategy.triplea.delegate.ExecutionStack.execute(ExecutionStack.java:41) at games.strategy.triplea.delegate.MustFightBattle.fight(MustFightBattle.java:357) at games.strategy.triplea.odds.calculator.OddsCalculator.calculate(OddsCalculator.java:144) at games.strategy.triplea.odds.calculator.OddsCalculator.calculate(OddsCalculator.java:117) at games.strategy.triplea.odds.calculator.OddsCalculator.call(OddsCalculator.java:159) at games.strategy.triplea.odds.calculator.OddsCalculator.call(OddsCalculator.java:21) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Feb 09, 2019 4:17:57 PM org.triplea.game.client.HeadedGameRunner lambda$main$0 SEVERE: java.lang.NullPointerException java.lang.IllegalStateException: java.lang.NullPointerException at games.strategy.triplea.odds.calculator.ConcurrentOddsCalculator.calculate(ConcurrentOddsCalculator.java:308) at games.strategy.triplea.odds.calculator.ConcurrentOddsCalculator.setCalculateDataAndCalculate(ConcurrentOddsCalculator.java:322) at games.strategy.triplea.ai.pro.util.ProOddsCalculator.callBattleCalculator(ProOddsCalculator.java:143) at games.strategy.triplea.ai.pro.util.ProOddsCalculator.callBattleCalculator(ProOddsCalculator.java:122) at games.strategy.triplea.ai.pro.util.ProOddsCalculator.calculateBattleResults(ProOddsCalculator.java:94) at games.strategy.triplea.ai.pro.ProCombatMoveAi.determineUnitsToAttackWith(ProCombatMoveAi.java:892) at games.strategy.triplea.ai.pro.ProCombatMoveAi.doCombatMove(ProCombatMoveAi.java:124) at games.strategy.triplea.ai.pro.ProAi.move(ProAi.java:148) at games.strategy.triplea.ai.AbstractAi.start(AbstractAi.java:462) at games.strategy.engine.framework.ServerGame.waitForPlayerToFinishStep(ServerGame.java:532) at games.strategy.engine.framework.ServerGame.runStep(ServerGame.java:422) at games.strategy.engine.framework.ServerGame.startGame(ServerGame.java:285) at games.strategy.engine.framework.startup.launcher.LocalLauncher.launchInternal(LocalLauncher.java:46) at games.strategy.engine.framework.startup.launcher.LocalLauncher.launchInternal(LocalLauncher.java:27) at games.strategy.engine.framework.startup.launcher.AbstractLauncher.lambda$launch$0(AbstractLauncher.java:18) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.NullPointerException at games.strategy.triplea.delegate.DiceRoll.getTotalPowerAndRolls(DiceRoll.java:665) at games.strategy.triplea.delegate.DiceRoll.getTotalPower(DiceRoll.java:650) at games.strategy.triplea.delegate.BattleCalculator.sortUnitsForCasualtiesWithSupport(BattleCalculator.java:719) at games.strategy.triplea.delegate.BattleCalculator.getDefaultCasualties(BattleCalculator.java:603) at games.strategy.triplea.delegate.BattleCalculator.selectCasualties(BattleCalculator.java:488) at games.strategy.triplea.delegate.Fire.selectCasualties(Fire.java:162) at games.strategy.triplea.delegate.Fire.access$100(Fire.java:25) at games.strategy.triplea.delegate.Fire$2.execute(Fire.java:217) at games.strategy.triplea.delegate.ExecutionStack.execute(ExecutionStack.java:41) at games.strategy.triplea.delegate.MustFightBattle.fight(MustFightBattle.java:357) at games.strategy.triplea.odds.calculator.OddsCalculator.calculate(OddsCalculator.java:144) at games.strategy.triplea.odds.calculator.OddsCalculator.calculate(OddsCalculator.java:117) at games.strategy.triplea.odds.calculator.OddsCalculator.call(OddsCalculator.java:159) at games.strategy.triplea.odds.calculator.OddsCalculator.call(OddsCalculator.java:21) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ... 1 more
-
For the record: I had a quick glance at the error, but IMO it should be impossible this happens but I get the same error too.
Developer Information:
InBattleCalculator:718
unitPowerAndRollsMap
seems to have fever values thansortedUnitsList
sometimes, which really shouldn't happen causingunitPowerAndRollsMap.get(u)
to return null.
I'd assume this has something to do with duplicate values insortedUnitsList
and/or bad equals/hashcode implementations but I'm not sure. -
I created a PR with a fix for this https://github.com/triplea-game/triplea/pull/4706