AnarkisGaming / ATC-Feedback

Public bug reports and feature requests for our game, After The Collapse.
https://www.anarkisgaming.com/
0 stars 0 forks source link

saved failed collection was modified; enumeration operation cannot be executed #39

Closed IvanBajlo closed 3 years ago

IvanBajlo commented 3 years ago

second attempt worked normally

image

IvanBajlo commented 3 years ago

from debug log

2021-10-16 20:16:07,234 [18] ERROR AG.GameProject.ATC.Program - [SaveScreen] Error saving game:0862 test 2021-10-16 20:16:07,362 [18] ERROR AG.GameProject.ATC.Program - ------------------- Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.List`1.Enumerator.MoveNextRare() at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType) at AG.GameProject.ATC.SRLSaveSystem.ThreadSaveGame()

SerialKicked commented 3 years ago

I've seen it happen, most likely the cause of a the save processing a list of active ingame elements directly instead of looking at the copy i made for it to process. The issue with the post report is that it can't tell me which list, so there's some guess work needed. It's rare too.

IvanBajlo commented 3 years ago

its maybe rare but when it hits it can really cause problems... like not having a recent save file after 5 settlers wonder off (probably trying to get that exoskeleton guarded by scorpion queens :-p ) and get themselves killed (good thing I've started with 81)... I'm still trying to figure out how to replicate it, as if the game knows the best moment to screw me up ;-)

0863 enumaration bug.zip

image

SerialKicked commented 3 years ago

There's not "trigger" for you to find/guess. It's purely a problem of thread synchronization. I need to spend a day or two looking at this problem and this problem only to figure it out.

SerialKicked commented 3 years ago

Oki, the bad news is that I can't entirely eradicate this bug without massively tanking performances and memory requirements during save operations. The good news is that, instead, I reduced the likelihood of that bug to happen by a hell lot and I will make sure that a save completes successfully before rotating auto/quick save slots.

SerialKicked commented 3 years ago

So i guess i can close this one. Not really a "wontfix" more like a "did_what_i_could" tag :p