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

MustFightBattle#execute:1344 - java.lang.IllegalStateException #11966

Closed
tripleabuilderbot opened this issue Sep 16, 2023 · 4 comments
Closed
Labels
2.6 Error Report Issue reported via the in-game error reporter

Comments

@tripleabuilderbot
Copy link
Contributor

Map

ww2_path_to_victory

Log Message

Round 10,000 reached in a battle. Something must be wrong. Please report this to TripleA.
Territory: Northern Manchuria Attacker: Germans Attacking unit types: tactical_bomber,mech_infantry,fighter,infantry,artillery,armour, Defending unit types: bomber,infantry,armour

TripleA Version

2.6.14477

Java Version

11.0.19

Operating System

Windows 11

Stack Trace

Exception: java.lang.IllegalStateException Round 10,000 reached in a battle. Something must be wrong. Please report this to TripleA.
 Territory: Northern Manchuria Attacker: Germans Attacking unit types: tactical_bomber,mech_infantry,fighter,infantry,artillery,armour, Defending unit types: bomber,infantry,armour
java.lang.Exception
	at games.strategy.triplea.delegate.battle.MustFightBattle$29.execute(MustFightBattle.java:1344)
	at games.strategy.triplea.delegate.ExecutionStack.execute(ExecutionStack.java:34)
	at games.strategy.triplea.delegate.battle.MustFightBattle.fight(MustFightBattle.java:714)
	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.ForkJoinTask.doInvoke(ForkJoinTask.java:408)
	at java.base/java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:736)
	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.odds.calculator.BattleCalculatorPanel.lambda$updateStats$13(BattleCalculatorPanel.java:1173)
	at java.base/java.lang.Thread.run(Thread.java:829)


@tripleabuilderbot tripleabuilderbot added 2.6 Error Report Issue reported via the in-game error reporter labels Sep 16, 2023
@asvitkine
Copy link
Contributor

This one's bizarre. The lists of units seem like they should be able to hit each other...

I also tried running the map with all-AIs and didn't see any issue.

Theoretically, if we're very unlikely, it could be that the battle couldn't finish in 10k rounds if all the units rolled poorly... But that seems very unlikely.

@Cernelius
Copy link
Contributor

@asvitkine This is a well known problem which happens when you have edit mode enabled when you open the battle-calculator. This is due to the fact that, with edit mode enabled, nothing gets hit in battle. You can reproduce it by simply enabling edit mode and thereafter opening the battle-calculator and using it.

In the past, having edit mode enabled during battle allowed you to ignore hits if you so wanted. This had no effects on the battle-calculator, as the default auto-selection did not change (you just had the option to take less hits than you should have had). At some point this changed to edit mode enabled forcing all hits being ignored. I guess this was an unwanted change.

My suggestion would be being impossible to enable edit mode during battle phases, having edit mode being automatically disabled, if currently enabled, as soon as any battle phase starts, and edit mode having no effects on casualties selection or anything else battle-related (so that opening the battle-calculator when edit mode is enabled is no different than otherwise).


About this, I've tested what I said, and it made me make this error report (whereas I was expecting it would link me to this issue):
#11975

@Cernelius
Copy link
Contributor

Cernelius commented Sep 20, 2023

On a second thought, I'm now thinking that this error has been obtained by actually making the battle for that many combat rounds while Edit Mode was already enabled (and most likely the AI was in control of both sides or at least of the attacking one or the battle offered no retreat or anything else that would not require you to stay actively at your keyboard or mouse for 10,000 rounds of combat), as that forces all hits being ignored.

In order to reproduce it, assign Germans to yourself and assign every other player to Fast (AI). During the Germans turn, enable edit mode and skip the turn (leaving Edit Mode enabled) (and wait for a very long time). If you want to be sure to reproduce, set Japanese at War with all Allies with Edit Mode, but it seems that Japanese will actually declare war and attack the Allies on their first turn, eventually causing this issue (so my steps should be just as good).

If you use Hard (AI) instead of Fast (AI), it will cause the other error (#11975) instead (because the AI uses the battle-calculator).

@asvitkine
Copy link
Contributor

Closing in favor of #12488

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.6 Error Report Issue reported via the in-game error reporter
Projects
None yet
Development

No branches or pull requests

3 participants