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

2.6.14706: ConcurrentBattleCalculator#calculate:200 - java.lang.IllegalStateException #12689

Open
tripleabuilderbot opened this issue Jul 4, 2024 · 4 comments
Labels
Error Report Issue reported via the in-game error reporter IllegalStateException java.lang.IllegalStateException

Comments

@tripleabuilderbot
Copy link
Contributor

Map

shogun_advanced / Shogun Advanced

Log Message

java.lang.IllegalStateException: sortedTargetsToPickFrom must have the same size as targetsToPickFrom list

TripleA Version

2.6.14706

Java Version

11.0.19

Operating System

Windows 11

Heap Size

1972M

Stack Trace

Exception: java.lang.IllegalStateException java.lang.IllegalStateException: sortedTargetsToPickFrom must have the same size as targetsToPickFrom list
java.lang.Exception
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:600)
	at java.base/java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:678)
	at java.base/java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:737)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateParallel(ReduceOps.java:919)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at games.strategy.triplea.odds.calculator.ConcurrentBattleCalculator.calculate(ConcurrentBattleCalculator.java:200)
	at games.strategy.triplea.ai.pro.util.ProOddsCalculator.callBattleCalc(ProOddsCalculator.java:249)
	at games.strategy.triplea.ai.pro.util.ProOddsCalculator.callBattleCalc(ProOddsCalculator.java:225)
	at games.strategy.triplea.ai.pro.util.ProOddsCalculator.calculateBattleResults(ProOddsCalculator.java:158)
	at games.strategy.triplea.ai.pro.util.ProOddsCalculator.calculateBattleResults(ProOddsCalculator.java:142)
	at games.strategy.triplea.ai.pro.ProPurchaseAi.purchaseDefenders(ProPurchaseAi.java:867)
	at games.strategy.triplea.ai.pro.ProPurchaseAi.purchase(ProPurchaseAi.java:296)
	at games.strategy.triplea.ai.pro.AbstractProAi.purchase(AbstractProAi.java:248)
	at games.strategy.triplea.ai.AbstractAi.start(AbstractAi.java:509)
	at games.strategy.engine.framework.ServerGame.waitForPlayerToFinishStep(ServerGame.java:593)
	at games.strategy.engine.framework.ServerGame.runStep(ServerGame.java:450)
	at games.strategy.engine.framework.ServerGame.setUpGameForRunningSteps(ServerGame.java:331)
	at games.strategy.engine.framework.ServerGame.startGame(ServerGame.java:310)
	at games.strategy.engine.framework.startup.launcher.LocalLauncher.launchInternal(LocalLauncher.java:92)
	at games.strategy.engine.framework.startup.launcher.LocalLauncher.lambda$launch$0(LocalLauncher.java:60)
	at java.base/java.lang.Thread.run(Thread.java:829)


Exception: java.lang.IllegalStateException sortedTargetsToPickFrom must have the same size as targetsToPickFrom list
java.lang.Exception
	at games.strategy.triplea.delegate.battle.casualty.CasualtySelector.selectCasualties(CasualtySelector.java:118)
	at games.strategy.triplea.delegate.battle.steps.fire.SelectMainBattleCasualties$Select.apply(SelectMainBattleCasualties.java:157)
	at games.strategy.triplea.delegate.battle.steps.fire.SelectMainBattleCasualties.apply(SelectMainBattleCasualties.java:57)
	at games.strategy.triplea.delegate.battle.steps.fire.SelectMainBattleCasualties.apply(SelectMainBattleCasualties.java:28)
	at games.strategy.triplea.delegate.battle.steps.fire.SelectCasualties.execute(SelectCasualties.java:71)
	at games.strategy.triplea.delegate.ExecutionStack.execute(ExecutionStack.java:34)
	at games.strategy.triplea.delegate.battle.MustFightBattle.fight(MustFightBattle.java:688)
	at games.strategy.triplea.odds.calculator.BattleCalculator.calculate(BattleCalculator.java:115)
	at games.strategy.triplea.odds.calculator.ConcurrentBattleCalculator.lambda$calculate$4(ConcurrentBattleCalculator.java:188)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceTask.doLeaf(ReduceOps.java:952)
	at java.base/java.util.stream.ReduceOps$ReduceTask.doLeaf(ReduceOps.java:926)
	at java.base/java.util.stream.AbstractTask.compute(AbstractTask.java:327)
	at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)


@tripleabuilderbot tripleabuilderbot added the Error Report Issue reported via the in-game error reporter label Jul 4, 2024
@asvitkine
Copy link
Contributor

Same as: #11610

We desperately need a repro.

@TheDog-GH do you know who submitted this report?

asvitkine added a commit to asvitkine/triplea-1 that referenced this issue Jul 6, 2024
Since we'll need to debug this code for triplea-game#12689, this is a prelim cleanup to make the code easier to understand.

It splits out the core logic into an impl function, with the caching logic being a wrapper around it. Also improves some comments and uses some local variables to reduce wrapping.
asvitkine added a commit that referenced this issue Jul 6, 2024
Since we'll need to debug this code for #12689, this is a prelim cleanup to make the code easier to understand.

It splits out the core logic into an impl function, with the caching logic being a wrapper around it. Also improves some comments and uses some local variables to reduce wrapping.

No functional changes.
@merleyn
Copy link
Contributor

merleyn commented Jul 10, 2024

@asvitkine I forwarded this error, it was freezing the game, and I never seen it before, allready traced down its possible origin ( while working on local Update of Shogun Advanced) and it seems connected with a Unit that has Attack value = 0 ) Aftr some testing last days it seems solved by changing 0 into 1... let you know it still occurs

@asvitkine
Copy link
Contributor

@merleyn if you have a version of the map that can trigger this error and either reliable repro steps or a save game, it would be helpful to debug the problem in the engine.

@merleyn
Copy link
Contributor

merleyn commented Jul 12, 2024

sorry, I went to fast in improving the map.... only have a saved game but not the coresponding Game.xml, but error didnot occur anymore since I abstained from using " attack = 0 unit"

@frigoref frigoref added the IllegalStateException java.lang.IllegalStateException label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Report Issue reported via the in-game error reporter IllegalStateException java.lang.IllegalStateException
Projects
None yet
Development

No branches or pull requests

4 participants