Triplea: SEVERE: Not in an event, but trying to add child

Created on 21 Dec 2018  路  6Comments  路  Source: triplea-game/triplea

Engine version


1.10.13296

My Operating System

Windows 10/64 bit

Map name

ww2global40_2nd_edition.xml

Can you describe how to trigger the error? (eg: what sequence of actions will recreate it?)

I do not know how to recreate it. Here is how it occurred: I was beginning Germany's combat move phase. Combat started for strategic bomb raid resolutions. The game generated an SEVERE message (see below). I saved the game almost immediately after the SEVERE WARNING occurred. Zip is attached - if you load the saved game, and look at the combat history you will see a battle showing "???" Germans attacks [sic] with 2 units heading to Novgorod.

Do you have the exact error text? Please copy/paste if so

Dec 20, 2018 8:42:36 PM games.strategy.engine.message.unifiedmessenger.UnifiedMessenger invoke
WARNING: Cant add an event, not a step. Must be in a step to add an event to the step. 
Trying to add event: Air Battle in Novgorod
java.lang.IllegalStateException: Cant add an event, not a step. Must be in a step to add an event to the step. 
Trying to add event: Air Battle in Novgorod
    at games.strategy.engine.history.HistoryWriter.startEvent(HistoryWriter.java:120)
    at games.strategy.engine.framework.ServerGame$1.startHistoryEvent(ServerGame.java:114)
    at games.strategy.engine.framework.ServerGame$1.startHistoryEvent(ServerGame.java:105)
    at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at games.strategy.engine.message.unifiedmessenger.EndPoint.invokeSingle(EndPoint.java:150)
    at games.strategy.engine.message.unifiedmessenger.EndPoint.invokeMultiple(EndPoint.java:133)
    at games.strategy.engine.message.unifiedmessenger.EndPoint.invokeLocal(EndPoint.java:119)
    at games.strategy.engine.message.unifiedmessenger.UnifiedMessenger.invoke(UnifiedMessenger.java:142)
    at games.strategy.engine.message.UnifiedInvocationHandler.invoke(UnifiedInvocationHandler.java:48)
    at com.sun.proxy.$Proxy13.startHistoryEvent(Unknown Source)
    at games.strategy.engine.history.DelegateHistoryWriter.startEvent(DelegateHistoryWriter.java:29)
    at games.strategy.triplea.delegate.GameDelegateHistoryWriter.startEvent(GameDelegateHistoryWriter.java:32)
    at games.strategy.triplea.delegate.AirBattle.fight(AirBattle.java:105)
    at games.strategy.triplea.delegate.BattleTracker.fightAirRaidsAndStrategicBombing(BattleTracker.java:1129)
    at games.strategy.triplea.delegate.BattleTracker.fightAirRaidsAndStrategicBombing(BattleTracker.java:1113)
    at games.strategy.triplea.delegate.BattleDelegate.start(BattleDelegate.java:101)
    at games.strategy.engine.framework.ServerGame.startStep(ServerGame.java:512)
    at games.strategy.engine.framework.ServerGame.runStep(ServerGame.java:410)
    at games.strategy.engine.framework.ServerGame.startGame(ServerGame.java:282)
    at java.util.Optional.ifPresent(Unknown Source)
    at games.strategy.engine.framework.startup.launcher.LocalLauncher.launchInNewThread(LocalLauncher.java:41)
    at games.strategy.engine.framework.startup.launcher.AbstractLauncher.lambda$launch$0(AbstractLauncher.java:49)
    at java.lang.Thread.run(Unknown Source)

Dec 20, 2018 8:42:37 PM games.strategy.engine.history.HistoryWriter addChildToEvent
SEVERE: Not in an event, but trying to add child:Germans attacks with 2 units heading to Novgorod current is:Combat

Instead of this error, what should have happened?

Strategic bombing should have been resolved without anomalous error messages

Any additional information that may help

Problem

Most helpful comment

I've a improved the logging around the history writer so that if this happens again we'll have a better idea of what's causing it #4466. This error shouldn't have any negative impact on game play just that the history panel shows a missing message.

I do think its a race condition of some sort as looking at the error message and the code, this is what happens:

  1. It tries to write the event node "Air Battle in Novgorod" but fails as it isn't in a step node (should be "Combat")
  2. It tries to write the child node "Germans attacks with 2 units heading to Novgorod" but fails as the event node didn't write (step 1) so it instead adds "???" as the event
  3. It writes the child node "Germans attacks with 2 units heading to Novgorod" under the added "???"

The question is why does the first step fail and the current logging doesn't show what the current node was when that occurred so I've added that detail to the logging.

Closing this for now until we either get new info or can reproduce.

All 6 comments

@drockken Can you please add the savegame? It is missing...

Also: Which Java version are you running?

Weird, I had added it. Let me try again.
cae.zip

Thank you, @drockken.

Attached you will find two savegames.
The file howitshouldwork.tsvg shows, well, how it should work. Russia is asked to launch interceptors and after that the SBR is conducted regularly. I used a slightly modified startup postion to test the correct process in general.
The file caetest1.tsvg is a savegame extracted from the game history, saved at the end of the last round. Continuing from there shows that at least the SBR is conducted but the prior air raid does not take place.
The above error message appears to be air battle related, too.

Conclusion:

In a "fresh", non ai-involved game, the SBR is played out correctly.

In an ai-involved game the scenario is concluded irregularly: I did not get the above error message, but the air battle step has been skipped. (We know that saving games from the history causes quirks, so that is no 1:1 reproduction of the original scenario.)

@ron-murhammer Does the ai support air battles prior to SBR? Can you please take a look here?

@drockken Please let us know your Java version, just to be sure...

savedGames.zip

Java 1.8.0_144-b01 according to TripleA
Java 1.8.0_121-b13 according to the Java Control Panel

@panther2 I looked over all the save games and can't reproduce the error. I re-created his combat moves and it seems to play out fine with the Hard AI as Russia. Here is the save at the end of Germany's combat move with the same moves made:
test.zip

I'll take a closer look at the code but the error message indicates it doesn't have anything to do with the AI. If anything there might be some sort of race condition where the air battle is trying to start before the history is ready to record it.

I've a improved the logging around the history writer so that if this happens again we'll have a better idea of what's causing it #4466. This error shouldn't have any negative impact on game play just that the history panel shows a missing message.

I do think its a race condition of some sort as looking at the error message and the code, this is what happens:

  1. It tries to write the event node "Air Battle in Novgorod" but fails as it isn't in a step node (should be "Combat")
  2. It tries to write the child node "Germans attacks with 2 units heading to Novgorod" but fails as the event node didn't write (step 1) so it instead adds "???" as the event
  3. It writes the child node "Germans attacks with 2 units heading to Novgorod" under the added "???"

The question is why does the first step fail and the current logging doesn't show what the current node was when that occurred so I've added that detail to the logging.

Closing this for now until we either get new info or can reproduce.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RoiEXLab picture RoiEXLab  路  3Comments

ZjelcoP picture ZjelcoP  路  5Comments

panther2 picture panther2  路  6Comments

DanVanAtta picture DanVanAtta  路  5Comments

DanVanAtta picture DanVanAtta  路  5Comments