View Issue Details

IDProjectCategoryLast Update
0025604AI War 2Crash/ExceptionOct 2, 2021 12:03 am
ReporterBadgerBadger Assigned ToChris_McElligottPark  
Severityminor 
Status resolvedResolutionfixed 
Product VersionBeta 3.704 Unexpected Turbo Sim Speed 
Fixed in VersionBeta 3.704 Unexpected Turbo Sim Speed 
Summary0025604: Some errors on exiting the game
DescriptionFrom the most recent SVN

I hit these errors as I quit a game

10/1/2021 4:51:01 PM 3.704 SINGLEP DELAYED3: Hit exception debugCode 400 in sappers stage 2 System.NullReferenceException: Object reference not set to an instance of an object
  at Arcen.AIW2.External.AllegianceHelper.Helper_IsThereASpecificRelationshipToSetAndThenSkip (Arcen.AIW2.Core.Faction thisFaction, Arcen.AIW2.Core.Faction otherFaction) [0x00171] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.External.AllegianceHelper.AllyThisFactionToHumans (Arcen.AIW2.Core.Faction thisFaction) [0x0001a] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.External.SappersFactionBaseInfo.UpdateAllegiance () [0x00070] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.External.SappersFactionBaseInfo.DoPerSecondLogic_Stage2Aggregating_OnMainThreadAndPartOfSim_ClientAndHost (Arcen.AIW2.Core.ArcenClientOrHostSimContextCore Context) [0x0002d] in <9d44943b30804e9b9c23d174fa59b68e>:0
10/1/2021 4:51:01 PM 3.704 SINGLEP DELAYED4: Exception in DoPerSecondLogic_Stage3Main_OnMainThreadAndPartOfSim_ClientAndHost for faction Anti-Player Zombie(Index 7), so will not run any more of those until a reload of the save.
System.NullReferenceException: Object reference not set to an instance of an object
  at Arcen.AIW2.External.AllegianceHelper.AllyThisFactionToAI (Arcen.AIW2.Core.Faction thisFaction) [0x0004d] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.External.ZombieAntiPlayerFactionBaseInfo.DoPerSecondLogic_Stage3Main_OnMainThreadAndPartOfSim_ClientAndHost (Arcen.AIW2.Core.ArcenClientOrHostSimContextCore Context) [0x0001b] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.Core.Faction.Safe_BaseInfo_DoPerSecondLogic_Stage3Main_OnMainThreadAndPartOfSim_ClientAndHost (Arcen.AIW2.Core.ArcenClientOrHostSimContextCore Context) [0x00070] in /home/arcengames_aiw-ultra/CodeMain/ArcenAIW2Core/src/Logic/GameState/Faction/Faction.cs:2316
10/1/2021 4:51:01 PM 3.704 SINGLEP DELAYED5: Exception in DoPerSecondLogic_Stage3Main_OnMainThreadAndPartOfSim_HostOnly for faction AI Reserves(Index 4), so will not run any more of those until a reload of the save.
System.NullReferenceException: Object reference not set to an instance of an object
  at Arcen.AIW2.External.FactionUtilityMethods+<GetHighestAIDifficulty>c__AnonStoreyF.<>m__0 (Arcen.AIW2.Core.Faction faction) [0x0001a] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.Core.World_AIW2.DoForFactions (Arcen.AIW2.Core.Faction+ProcessorDelegate Processor) [0x00015] in /home/arcengames_aiw-ultra/CodeMain/ArcenAIW2Core/src/Logic/GameState/World_AIW2.cs:3747
  at Arcen.AIW2.External.FactionUtilityMethods.GetHighestAIDifficulty () [0x0000e] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.External.FactionUtilityMethods.GetHighestAIDifficulty_AsDifficulty () [0x00001] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.External.AIReservesFactionDeepInfo.DoPerSecondLogic_Stage3Main_OnMainThreadAndPartOfSim_HostOnly (Arcen.AIW2.Core.ArcenHostOnlySimContext Context) [0x00024] in <c6048bcda58047a1857dd0fc64beb0e5>:0
  at Arcen.AIW2.Core.Faction.Safe_DeepInfo_DoPerSecondLogic_Stage3Main_OnMainThreadAndPartOfSim_HostOnly (Arcen.AIW2.Core.ArcenHostOnlySimContext Context) [0x0007b] in /home/arcengames_aiw-ultra/CodeMain/ArcenAIW2Core/src/Logic/GameState/Faction/Faction.cs:2159
10/1/2021 4:51:01 PM 3.704 SINGLEP DELAYED6: Error! Called GetExternalBaseInfoAs<Arcen.AIW2.External.AISentinelsFactionBaseInfo>() when BaseInfo was null on AI
  at System.Environment.get_StackTrace () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at Arcen.Universal.ArcenDebugging.ArcenDebugLog (System.String Message, Arcen.Universal.Verbosity Verbosity) [0x00012] in /home/arcengames_aiw-ultra/CodeCrossProject/ArcenUniversal/src/UtilityLibraries/ArcenDebugging.cs:253
  at Arcen.AIW2.Core.Faction.GetExternalBaseInfoAs[T] () [0x00044] in /home/arcengames_aiw-ultra/CodeMain/ArcenAIW2Core/src/Logic/GameState/Faction/Faction.cs:1452
  at Arcen.AIW2.External.AISentinelsFactionBaseInfoExtensions.GetAISentinelsCoreData (Arcen.AIW2.Core.Faction ParentObject) [0x00000] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.External.AIHunterFactionDeepInfo.DoPerSecondLogic_Stage3Main_OnMainThreadAndPartOfSim_HostOnly (Arcen.AIW2.Core.ArcenHostOnlySimContext Context) [0x00000] in <c6048bcda58047a1857dd0fc64beb0e5>:0
  at Arcen.AIW2.Core.Faction.Safe_DeepInfo_DoPerSecondLogic_Stage3Main_OnMainThreadAndPartOfSim_HostOnly (Arcen.AIW2.Core.ArcenHostOnlySimContext Context) [0x0007b] in /home/arcengames_aiw-ultra/CodeMain/ArcenAIW2Core/src/Logic/GameState/Faction/Faction.cs:2159
  at Arcen.AIW2.External.EntitySimLogicImplementation_BaseInfo+<DoWorldSecondLogic_FromSimBGThread>c__AnonStorey1C.<>m__6 (Arcen.AIW2.Core.Faction faction) [0x00000] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.Core.World_AIW2.DoForFactions (Arcen.AIW2.Core.Faction+ProcessorDelegate Processor) [0x00015] in /home/arcengames_aiw-ultra/CodeMain/ArcenAIW2Core/src/Logic/GameState/World_AIW2.cs:3747
  at Arcen.AIW2.External.EntitySimLogicImplementation_BaseInfo.DoWorldSecondLogic_FromSimBGThread (Arcen.AIW2.Core.ArcenClientOrHostSimContextCore Context) [0x00000] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.External.EntitySimLogicImplementation_BaseInfo.DoWorld_Second_PerSecondLogic (Arcen.AIW2.Core.ArcenClientOrHostSimContextCore Context) [0x00000] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.External.EntitySimLogicImplementation_BaseInfo.DoWorldStepLogic_ClientOrHost_FromSimBGThread (Arcen.AIW2.Core.ArcenClientOrHostSimContextCore Context) [0x00000] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.External.SimExecution.Execute () [0x00000] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.External.ArcenClientOrHostSimPlanningContext.InnerRun () [0x00000] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.External.ArcenExecutionContext.InnerRun () [0x00000] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.External.ArcenThread.InternalActualThreadFunction () [0x00000] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Threading.ThreadHelper.ThreadStart () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0

10/1/2021 4:51:01 PM 3.704 SINGLEP DELAYED7: Error in thread for execution context 'executionContext'
NullReferenceException
Object reference not set to an instance of an object
===STACK FRAMES (with file info)===
FILE METHOD IL_OFFSET NATIVE_OFFSET LINE_NUMBER COLUMN_NUMBER
/home/arcengames_aiw-ultra/CodeMain/ArcenAIW2Core/src/Logic/GameState/Faction/Faction.cs GetDisplayNameInternal 47 76 1949 0
/home/arcengames_aiw-ultra/CodeMain/ArcenAIW2Core/src/Logic/GameState/Faction/Faction.cs GetDisplayName 3 15 1933 0
/home/arcengames_aiw-ultra/CodeMain/ArcenAIW2Core/src/Logic/GameState/Faction/Faction.cs Safe_DeepInfo_DoPerSecondLogic_Stage3Main_OnMainThreadAndPartOfSim_HostOnly 168 683 2168 0
    <>m__6 100 199 0 0
/home/arcengames_aiw-ultra/CodeMain/ArcenAIW2Core/src/Logic/GameState/World_AIW2.cs DoForFactions 21 61 3747 0
    DoWorldSecondLogic_FromSimBGThread 323 1467 0 0
    DoWorld_Second_PerSecondLogic 102 307 0 0
    DoWorldStepLogic_ClientOrHost_FromSimBGThread 165 315 0 0
    Execute 224 492 0 0
===RAW STACK TRACE===
  at Arcen.AIW2.Core.Faction.GetDisplayNameInternal (System.Boolean GetShortVersion) [0x0002f] in /home/arcengames_aiw-ultra/CodeMain/ArcenAIW2Core/src/Logic/GameState/Faction/Faction.cs:1949
  at Arcen.AIW2.Core.Faction.GetDisplayName () [0x00003] in /home/arcengames_aiw-ultra/CodeMain/ArcenAIW2Core/src/Logic/GameState/Faction/Faction.cs:1933
  at Arcen.AIW2.Core.Faction.Safe_DeepInfo_DoPerSecondLogic_Stage3Main_OnMainThreadAndPartOfSim_HostOnly (Arcen.AIW2.Core.ArcenHostOnlySimContext Context) [0x000a8] in /home/arcengames_aiw-ultra/CodeMain/ArcenAIW2Core/src/Logic/GameState/Faction/Faction.cs:2168
  at Arcen.AIW2.External.EntitySimLogicImplementation_BaseInfo+<DoWorldSecondLogic_FromSimBGThread>c__AnonStorey1C.<>m__6 (Arcen.AIW2.Core.Faction faction) [0x00064] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.Core.World_AIW2.DoForFactions (Arcen.AIW2.Core.Faction+ProcessorDelegate Processor) [0x00015] in /home/arcengames_aiw-ultra/CodeMain/ArcenAIW2Core/src/Logic/GameState/World_AIW2.cs:3747
  at Arcen.AIW2.External.EntitySimLogicImplementation_BaseInfo.DoWorldSecondLogic_FromSimBGThread (Arcen.AIW2.Core.ArcenClientOrHostSimContextCore Context) [0x00143] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.External.EntitySimLogicImplementation_BaseInfo.DoWorld_Second_PerSecondLogic (Arcen.AIW2.Core.ArcenClientOrHostSimContextCore Context) [0x00066] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.External.EntitySimLogicImplementation_BaseInfo.DoWorldStepLogic_ClientOrHost_FromSimBGThread (Arcen.AIW2.Core.ArcenClientOrHostSimContextCore Context) [0x000a5] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.External.SimExecution.Execute () [0x000e0] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at System.Environment.get_StackTrace () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at Arcen.Universal.ArcenDebugging.ArcenDebugLog (System.String Message, Arcen.Universal.Verbosity Verbosity) [0x00012] in /home/arcengames_aiw-ultra/CodeCrossProject/ArcenUniversal/src/UtilityLibraries/ArcenDebugging.cs:253
  at Arcen.Universal.ArcenDebugging.LogException (System.Exception e, System.String message, Arcen.Universal.Verbosity verbosity) [0x001fe] in /home/arcengames_aiw-ultra/CodeCrossProject/ArcenUniversal/src/UtilityLibraries/ArcenDebugging.cs:555
  at Arcen.AIW2.External.SimExecution.Execute () [0x00000] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.External.ArcenClientOrHostSimPlanningContext.InnerRun () [0x00000] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.External.ArcenExecutionContext.InnerRun () [0x00000] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at Arcen.AIW2.External.ArcenThread.InternalActualThreadFunction () [0x00000] in <9d44943b30804e9b9c23d174fa59b68e>:0
  at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
TagsNo tags attached.

Activities

Chris_McElligottPark

Oct 1, 2021 11:42 pm

administrator   ~0062888

Hmm, this will handle part of it, but the rest of it I need to be more aggressive with, looks like.

* Hardened all of the methods in AllegianceHelper against errors during game quit. There were a number of places where they were vulnerable to cross-threading exceptions during game teardown.

Chris_McElligottPark

Oct 2, 2021 12:03 am

administrator   ~0062889

Thanks!

* The game is now a lot better about killing threads when it wants to go back to the main menu, or exit the game in general. Before it was possible that they could linger for a moment and throw errors.
** This is one of those "how did that ever work without errors all the time on exit?" sort of situations. Nevertheless, it was still rare even now.

* Okay, took a much more aggressive approach with on-quit errors. The fact is, we simply have too many threads with too much error-handling to guarantee that none will error a we pull down the walls around them. And there's no guarantee that a mod will properly handle ThreadAbortExceptions, let alone anything else more specific. So let's handle this centrally!
** When you quit the game or quit to the main menu, after it has done anything that we might care about (like saving an ironman save or something like that), it now gives a 3-second moratorium where it ignores any and all exceptions that are thrown. Those are all assumed to be spurious (because they are), and that means we don't have to worry about the fact that we can't halt a Parallel thread easily (that was one of many problems), or that certain code might not be set up properly for the abort codes.
** This has no net negative effect on the game, because essentially this is just stuff that was running that did not need to be, and it's not going to hurt any data.

Issue History

Date Modified Username Field Change
Oct 1, 2021 6:52 pm BadgerBadger New Issue
Oct 1, 2021 6:52 pm BadgerBadger Status new => assigned
Oct 1, 2021 6:52 pm BadgerBadger Assigned To => Chris_McElligottPark
Oct 1, 2021 11:42 pm Chris_McElligottPark Note Added: 0062888
Oct 2, 2021 12:03 am Chris_McElligottPark Status assigned => resolved
Oct 2, 2021 12:03 am Chris_McElligottPark Resolution open => fixed
Oct 2, 2021 12:03 am Chris_McElligottPark Fixed in Version => Beta 3.704 Unexpected Turbo Sim Speed
Oct 2, 2021 12:03 am Chris_McElligottPark Note Added: 0062889