View Issue Details

IDProjectCategoryLast Update
0023111AI War 2[All Projects] Crash/ExceptionApr 7, 2020 12:41 pm
ReporterBobAssigned Tox4000Bughunter 
Status resolvedResolutionfixed 
Product Version2.018 Hotfix 
Fixed in Version2.019 Regenerator Sanity 
Summary0023111: CTD on unit swap
DescriptionDuring one of my games I've experienced crashes whenever I try to swap units between fleets. In earlier saves it only happened with a specific unit in a single fleet, later on it affected all of them.

Found a workaround - I can swap loaded units if it's done starting with the last (lowest on the list) unit in a fleet and with an empty slot in a different fleet. Swapping unloaded units or loaded but not last seems to be a big no-no.

New games are working fine and the workaround is more than enough to finish the current campaing, but I'm leaving a report with a save file and player.log in case it's of any use
TagsNo tags attached.



Apr 7, 2020 9:20 am


Player.log (20,289 bytes)
Beatler.rar (341,750 bytes)


Apr 7, 2020 11:15 am

administrator   ~0056720

I can confirm the issue -- thank you! In this case it's an infinite loop, which eventually causes enough memory usage to cause an out of memory exception. I have 32GB of RAM and so it doesn't quite get to the crash part for me, but the infinite loop and memory climb is there. Should be able to fix based on this.


Apr 7, 2020 11:34 am

administrator   ~0056722

Wow, there is some gargantuanly large bad data in there. I'm not sure how this is functioning at all. Thanks for the rabbit hole to chase, this is kind of crazy. In the end it might be a big performance boost for the game at large if I've truly made a mistake of this sort, which right now I can't tell.


Apr 7, 2020 12:07 pm

administrator   ~0056723

Whoooa! Basically, despawning entities is creating things that they spawn on death. So this was causing enormous bugs. Who knows where else in the system where it's not an infinite loop, but still too many entities in the wrong lists, etc.

Adding: 227026 isAlreadyContained: False

  at System.Environment.get_StackTrace () [0x00000] in <1f0c1ef1ad524c38bbc5536809c46b48>:0
  at Arcen.Universal.ArcenDebugging.ArcenDebugLog (System.String Message, Arcen.Universal.DebugLogDestination Destination, System.Boolean IncludeStackTrace, Arcen.Universal.Verbosity Verbosity) [0x00000] in <579579e177fa4e6b9baa1037f7bd78cb>:0
  at Arcen.Universal.ArcenDebugging.ArcenDebugLog (System.String Message, Arcen.Universal.DebugLogDestination Destination, Arcen.Universal.Verbosity Verbosity) [0x00000] in <579579e177fa4e6b9baa1037f7bd78cb>:0
  at Arcen.Universal.ArcenDebugging.ArcenDebugLog (System.String Message, Arcen.Universal.Verbosity Verbosity) [0x00000] in <579579e177fa4e6b9baa1037f7bd78cb>:0
  at Arcen.Universal.ArcenLinkedList`1[ItemType].AddAndPotentiallyCreateDuplicate (ItemType Item) [0x00000] in <579579e177fa4e6b9baa1037f7bd78cb>:0
  at Arcen.AIW2.Core.Fleet+Membership.AddEntityToFleetMembership (Arcen.AIW2.Core.GameEntity_Squad Entity) [0x00000] in <8b69abc6eaff4716a8612a316ee410b9>:0
  at Arcen.AIW2.Core.GameEntity_Squad.CreateNew (Arcen.AIW2.Core.PlanetFaction PFaction, Arcen.AIW2.Core.GameEntityTypeData TypeData, System.Int32 CurrentMarkLevel, Arcen.AIW2.Core.Fleet FleetOrNullIfNotShip, System.Int32 UniqueTypeDataDifferentiatorForDuplicatesOrZero, Arcen.Universal.ArcenPoint StartingLocation, Arcen.AIW2.Core.ArcenSimContext Context) [0x00000] in <8b69abc6eaff4716a8612a316ee410b9>:0
  at Arcen.AIW2.Core.GameEntity_Squad.SpawnEntity (Arcen.AIW2.Core.GameEntityTypeData typeToSpawn, System.Int32 TargetMarkLevel, Arcen.AIW2.Core.Fleet FleetToBeIn, System.Int32 UniqueTypeDataDifferentiatorForDuplicatesOrZero, System.Int32 BehaviorRelatedFactionIndex, Arcen.AIW2.Core.ArcenSimContext Context, System.Boolean doFancySpawnEffect) [0x00000] in <8b69abc6eaff4716a8612a316ee410b9>:0
  at Arcen.AIW2.Core.GameEntity_Squad.DoOnAnyDeathInCombatLogic_AfterFullDeathOrPartOfStackDeath (System.Boolean IsFromOnlyPartOfStackDying, Arcen.AIW2.Core.EntitySystem FiringSystemOrNull, System.Int32 numStacksKilled, Arcen.AIW2.Core.ArcenSimContext Context) [0x00000] in <8b69abc6eaff4716a8612a316ee410b9>:0
  at Arcen.AIW2.Core.GameEntity_Squad.DoOnDeathInCombatLogic_OnlyAferFullStackDeath (Arcen.AIW2.Core.EntitySystem FiringSystemOrNull, System.Int32 numStacksKilled, Arcen.AIW2.Core.ArcenSimContext Context) [0x00000] in <8b69abc6eaff4716a8612a316ee410b9>:0
  at Arcen.AIW2.Core.GameEntity_Squad.DoOnDestructionLogic (System.Boolean PreventReversionToNeutral, Arcen.AIW2.Core.EntitySystem FiringSystemOrNull, System.Boolean wasAlive, System.Int32 numStacksKilled, Arcen.AIW2.Core.ArcenSimContext Context) [0x00000] in <8b69abc6eaff4716a8612a316ee410b9>:0
  at Arcen.AIW2.Core.GameEntity_Squad.TakeDamageDirectly (System.Int32 Damage, Arcen.AIW2.Core.EntitySystem FiringSystemOrNull, Arcen.AIW2.Core.GameEntity_Shot ShotThatHitOrNullOnlyUsedForKnockback, System.Boolean IsSelfDamage, System.Boolean PreventReversionToNeutral, System.Boolean HonorFiniteHitCountAOE, System.Int32 MaxStacksAllowedToKill, System.Boolean OnlyDamageShieldNotHull, System.Int32& ActualDamageDone, System.Int32& DamageAbortCode, Arcen.AIW2.Core.ArcenSimContext Context) [0x00000] in <8b69abc6eaff4716a8612a316ee410b9>:0
  at Arcen.AIW2.Core.GameEntity_Squad.Die (Arcen.AIW2.Core.ArcenSimContext Context, System.Boolean PreventReversionToNeutral, Arcen.AIW2.Core.EntitySystem FiringSystemOrNull) [0x00000] in <8b69abc6eaff4716a8612a316ee410b9>:0
  at Arcen.AIW2.Core.GameEntity_Squad.Despawn (Arcen.AIW2.Core.ArcenSimContext Context, System.Boolean PreventReversionToNeutral, Arcen.AIW2.Core.InstancedRendererDeactivationReason Reason) [0x00000] in <8b69abc6eaff4716a8612a316ee410b9>:0
  at Arcen.AIW2.External.GameCommand_EditFleetData.SwapFleetMemberWithEmpty (Arcen.AIW2.Core.GameCommand command, Arcen.AIW2.Core.Fleet fleetToManage, Arcen.AIW2.Core.ArcenSimContext context) [0x00000] in <a14b8e17cfc948ef8e5e949dee602a4e>:0
  at Arcen.AIW2.External.GameCommand_EditFleetData.Execute (Arcen.AIW2.Core.GameCommand command, Arcen.AIW2.Core.ArcenSimContext context) [0x00000] in <a14b8e17cfc948ef8e5e949dee602a4e>:0
  at Arcen.AIW2.Core.GameCommand.Execute (Arcen.AIW2.Core.ArcenSimContext Context) [0x00000] in <8b69abc6eaff4716a8612a316ee410b9>:0
  at Arcen.AIW2.Core.World_AIW2.OnClient_ExecuteGameCommandsReceivedFromServer (Arcen.AIW2.Core.ArcenSimContext Context) [0x00000] in <8b69abc6eaff4716a8612a316ee410b9>:0
  at Arcen.AIW2.External.SimPlannerImplementation.DoActualSimStep (System.Boolean& stalledWaitingOnConnections, System.Boolean& mayUpdateVisuals) [0x00000] in <a14b8e17cfc948ef8e5e949dee602a4e>:0
  at Arcen.AIW2.Core.Engine_AIW2.ProcessSimStep (System.Boolean& stalledWaitingOnConnections) [0x00000] in <8b69abc6eaff4716a8612a316ee410b9>:0
  at Arcen.Universal.Engine_Universal.OnUpdateFromMainThread () [0x00000] in <579579e177fa4e6b9baa1037f7bd78cb>:0
  at ArcenGameController.Update () [0x00000] in <80cde60bcb86476d8170a967c4bbb6a6>:0


Apr 7, 2020 12:41 pm

administrator   ~0056724

Got it now, thanks!

* For at least a month or so now, ever since we switched in the linked lists for storing entity lists instead of List<> and ArcenMob<>, and possibly slightly before that, if you were to do a swap between ship lines on a planet with a regenerator golem on it, you'd get a crash to desktop and a ton of extra ships in general.
** In general, for some time now it has been allowing for various things to happen when you self-kill units (by scrapping or otherwise) that should not have been happening. This includes things like zombification copies being made, entities spawning on death in terms of things like hydra heads out of hydras, dying to remains, and regenerator golems spawning replacement ships. In this particular instance it could cause an infinite loop, but it was problematic in general.
** There are still various other things that DO need to happen on-death even for scrapped units, like various loss conditions, AIP gains, and so on. And in the past, prior to us making some changes here that have led to this crash, we weren't running those things, which is problematic.
** The game now does a much better job of telling all the sub-factions and so on what is happening and letting it react properly in the event of death from self-damage. So that solves the most recent problems, but keeps the longer-term benefits we've had for a while now.

Issue History

Date Modified Username Field Change
Apr 7, 2020 9:20 am Bob New Issue
Apr 7, 2020 9:20 am Bob File Added: Beatler.rar
Apr 7, 2020 9:20 am Bob File Added: Player.log
Apr 7, 2020 10:50 am x4000Bughunter Assigned To => x4000Bughunter
Apr 7, 2020 10:50 am x4000Bughunter Status new => assigned
Apr 7, 2020 11:15 am x4000Bughunter Note Added: 0056720
Apr 7, 2020 11:34 am x4000Bughunter Note Added: 0056722
Apr 7, 2020 12:07 pm x4000Bughunter Note Added: 0056723
Apr 7, 2020 12:41 pm x4000Bughunter Status assigned => resolved
Apr 7, 2020 12:41 pm x4000Bughunter Resolution open => fixed
Apr 7, 2020 12:41 pm x4000Bughunter Fixed in Version => 2.019 Regenerator Sanity
Apr 7, 2020 12:41 pm x4000Bughunter Note Added: 0056724