[RESOLVED] Main-thread entity enumeration failure-storms while heavily modded.

X-Mag-X X-Mag-X · 20 days ago

Log report for Underground Pipes

I found a direct case involving Underground Pipes v1.3.1 (PipeTerrainIgnoreMod) while the demolition tool was active.

The mod first reported:

[PipeTerrainIgnore] Abriss-Untergrundanzeige wurde nach einem Fehler deaktiviert:
Set changed while enumerating.

Stack:

PipeTerrainIgnoreMod.PipeBlueprintVisibilityPatch.RefreshBuriedPipesForDemolition()
PipeTerrainIgnoreMod.PipeDemolitionVisibilityPatch.RefreshBuriedPipes(...)
Mafi.Unity.Ui.Controllers.Tools.DeleteEntityInputController.InputUpdate_Patch2(...)
Mafi.Unity.InputControl.UnityInputManager.inputUpdate(...)
Mafi.Core.GameLoop.GameRunner.performInputUpdate()

Later, COI produced an entity-enumerator aassertion failure from the same main/input-thread path:

Outer enumerator finished first?

Mafi.Core.Entities.EntitiesManager.GetAllEntitiesOfType.MoveNext()
PipeTerrainIgnoreMod.PipeConnectorVisibility.RefreshBuiltConnectors(...)
PipeTerrainIgnoreMod.PipeBlueprintVisibilityPatch.RefreshExistingPipeOverlays(...)
PipeTerrainIgnoreMod.PipeBlueprintVisibilityPatch.RefreshBuriedPipesForDemolition()
PipeTerrainIgnoreMod.PipeDemolitionVisibilityPatch.RefreshBuriedPipes(...)
Mafi.Unity.Ui.Controllers.Tools.DeleteEntityInputController.InputUpdate_Patch2(...)

This path appeared in 11 entity-enumerator assertions during the session. (Sessions with heavy use of demolition may have 100s)

A COI developer advised that accessing simulation collections from the main thread is generally unsafe and that the sync phase should usually be used to transfer simulation data to the main thread.

Could you check whether RefreshBuiltConnectors / RefreshExistingPipeOverlays is enumerating the live entity collection from InputUpdate?


This is a COI wide mod incompatibility issue. Many mods are suddenly failing to read and write their data properly in new and existing worlds accross many different mod combinations.

For more information i've made an issue post here to track every mod observed in log storms in hopes hotfixes can be rolled out. Many popular mod combinations are currently displaying frequent enumeration failures which in some cases have shown to lead to feature failures, crashing and data corruption over extended play time.
https://discord.com/channels/803508556325584926/1552336216199008388/1552336216199008388

In the case for Underground Pipes, none of it's observable features seem to fail, however it has the highest recorded frequency of data collisions with other mods in sessions that used the demolition tool, which can cause instability for other mods still not hotfixed.


Edit: Thanks for new updates! 🙏

Edited 17 days ago
KleineEule93 KleineEule93 · 17 days ago

Thanks for the detailed report and the call stacks. I checked the source code and can confirm your finding: the demolition tool’s InputUpdate path reaches RefreshExistingPipeOverlays and then RefreshBuiltConnectors, which enumerates the live entity collections through GetAllEntitiesOfType when rebuilding its cache.

The existing exception handling does not make that access safe. I’ll work on moving the required data collection to an appropriate synchronization phase and having the visualization use a safely transferred snapshot.

I haven’t yet verified the broader effects on other mods or save data, but this access pattern needs fixing. Thanks for pointing it out so clearly. I’ll prepare and test a hotfix.

❤️ 1 💯 1
X-Mag-X X-Mag-X · 17 days ago

I haven’t yet verified the broader effects on other mods or save data, but this access pattern needs fixing. Thanks for pointing it out so clearly. I’ll prepare and test a hotfix.

I appreciate it! And while I can say the same, It has been promising so far in the logs, for the mods combinations now attempting these types of snapshot changes for collections; seeing cleaner 300 kb logs with no enumeration throws and real unrelated errors become clearer to identify.

I will gladly continue testing for any adverse side effects mod features and i have marked the mod aware of issue. Thank u very much

Best wishes!

Edited 17 days ago
🙂 1
KleineEule93 KleineEule93 · 15 days ago

Have you ever had underground pipes break while finishing the build? If so, shoot me a message on Discord.

Here’s the link.
https://discord.com/channels/803508556325584926/1537976498563059752

76 Showing 1–4 of 4