View Issue Details

IDProjectCategoryLast Update
0022404AI War 2Bug - GameplayJan 28, 2020 10:23 am
ReporterChthonic One Assigned ToChris_McElligottPark  
Status resolvedResolutionfixed 
Product Version1.023 Cloaking Variagation 
Fixed in VersionBETA 1.314 Achieve Those 
Summary0022404: Possible race condition involving Hive golem (and other drone carriers) when reloading drones
DescriptionI preface this with the fact that I don't know for sure it's happening with all drone carriers, but it would make sense that it would, and wouldn't get noticed much with others. The Hive golem is special in that it holds 300 such drones, so it's got more opportunity for this error, and is more obvious.

When the hive golem loads it's drones up, if it loads a large number at once in a single update, you will notice the number of drones for the fleet actually drops. Likely this is a race condition where multiple drones are trying to maintain their count at once.

Furthermore, at times this can be severe. You can have 300 almost undamaged drones out, and when they load up at once, you could end up with as few as 92 drones inside the carrier.

I've attached a save with a hive golem. To get this to happen, go romp around a bit cleaning up threat while watching it's drone count. Bonus points if you get stuck on a planet with a cloaked ship long enough to have 300 drones out at one time. When the cloaked ship is discovered and killed, or it goes away, make sure to try to load as many drones up as fast as possible. You will see the drone count drop dramatically.

I'm not sure why it's doing this with drones and not normal ships, though the normal ships do have counting errors that correct themselves likely due to the same race conditions. It's likely that a check is being done with normal ships to fix the count that isn't also done with drones.
TagsNo tags attached.

Relationships

related to 0022665 resolvedChris_McElligottPark Destroyed units in stacks are not properly removed from the game 
related to 0022411 feedbackChris_McElligottPark Ships with drones will deploy them, but not actually create ships when viewing galaxy map 
related to 0022581 resolvedChris_McElligottPark Automatic Ships/Drones disappear sometimes when entering or leaving their flagship 
related to 0022531 resolvedChris_McElligottPark Yellow Jacket dissapearing when entering Golem Ark 

Activities

Chthonic One

Dec 22, 2019 6:30 pm

reporter  

Hive error.save (1,148,635 bytes)
Hive error.savemet (97 bytes)

Chris_McElligottPark

Dec 23, 2019 10:11 am

administrator   ~0055094

Last edited: Dec 23, 2019 10:11 am

Thanks! For 1.024:

* Possible fix to a problem with getting drones back into their source.
** It was suspected that this might be a race condition, but from code analysis it seems that the only things that increment this are on the same thread. We've renamed some methods to be clear what thread they need to happen on or what thread they do happen on, and made sure that nothing is calling something from a thread that can be a race condition.
** If this doesn't work, then there are a couple of other things we can do, such as using a lock on the counter or changing it to a list structure or similar. The fact that this never happens with transported units but only drone units makes some sense given that they are completely different code paths and data structure types, but it's not clear why the drones were having a problem.
** The most likely thing with the drones having a problem is what we fixed in this build, which is that we were incrementing their value AFTER despawning them, and that may have been causing some problems. If that's not it (this is hard enough to reproduce that we can't be sure), then we'll take more extreme measures.

Chris_McElligottPark

Dec 23, 2019 10:22 am

administrator   ~0055095

Also for that one:

* One other change has been made to drones being put back into their parent. Essentially it was checking the number of stored drones against the effective squad cap... which you would think would be okay, but might have been missing some multipliers, we're not sure. At any rate, making a change to that we now just go ahead and increment the number means that for a frame or two there is a slight chance (somehow?) that there are too many drones stored in a drone carrier, but the game already checks for that and fixes drone overages, so it's probably safer to trust to that for the moment.

Thanks!

Chthonic One

Dec 24, 2019 12:44 am

reporter   ~0055114

As requested, here is a save where the wasps will enter the hive golem as soon as the system is clear.
Hive Error 2.save (1,332,560 bytes)

Chris_McElligottPark

Jan 28, 2020 10:23 am

administrator   ~0055799

Thanks!

* For both stacks and drones, put in some code to prevent cross-threading race conditions where they could in theory cause incorrect and confusing fluctuations.
** With stacks it seems like this only happened with very low stack count targets.
** With drones it seems this was not actually the problem.

* For all of the non-planetary fleets, it no longer tries to clear excess ships above the cap that you have.
** This was potentially causing some problems with drones in particular where it was killing excess ships as they went back into the drone controller. This may also have affected ships going into transports.
** Essentially it was counting some stuff that was queued for death but not yet dead. And in general with these we frankly don't care if they are over cap, as they wll die soon enough anyhow and it's unlikely that they would be over cap in the first place.
** The big thing with caps needing to clear excess ships is the command station fleets, since you can change command station types which massively adjusts your caps for things, and not handling these would be an exploit.
*** If a command station is ever given drones, then it's likely to be buggy like the hive golem and similar was in the past, and there's no simple solution for that. Don't give command stations drones. ;)
** This is confirmed to fix the hive golem bug and bug with drones in general.

Issue History

Date Modified Username Field Change
Dec 22, 2019 6:30 pm Chthonic One New Issue
Dec 22, 2019 6:30 pm Chthonic One File Added: Hive error.save
Dec 22, 2019 6:30 pm Chthonic One File Added: Hive error.savemet
Dec 23, 2019 10:11 am Chris_McElligottPark Note Added: 0055094
Dec 23, 2019 10:11 am Chris_McElligottPark Note Edited: 0055094
Dec 23, 2019 10:22 am Chris_McElligottPark Note Added: 0055095
Dec 23, 2019 10:22 am Chris_McElligottPark Assigned To => Chris_McElligottPark
Dec 23, 2019 10:22 am Chris_McElligottPark Status new => feedback
Dec 24, 2019 12:44 am Chthonic One File Added: Hive Error 2.save
Dec 24, 2019 12:44 am Chthonic One File Added: Hive Error 2.savemet
Dec 24, 2019 12:44 am Chthonic One Note Added: 0055114
Dec 24, 2019 12:44 am Chthonic One Status feedback => assigned
Dec 24, 2019 1:29 am Chthonic One Relationship added related to 0022411
Jan 11, 2020 6:15 pm RocketAssistedPuffin Relationship added related to 0022581
Jan 28, 2020 10:19 am Chris_McElligottPark Relationship added related to 0022665
Jan 28, 2020 10:19 am Chris_McElligottPark Relationship added related to 0022531
Jan 28, 2020 10:23 am Chris_McElligottPark Status assigned => resolved
Jan 28, 2020 10:23 am Chris_McElligottPark Resolution open => fixed
Jan 28, 2020 10:23 am Chris_McElligottPark Fixed in Version => BETA 1.314 Achieve Those
Jan 28, 2020 10:23 am Chris_McElligottPark Note Added: 0055799