cseelhoff / RimThreaded

RimThreaded is a RimWorld mod designed to enable RimWorld to utilize multiple threads.
MIT License
117 stars 21 forks source link

[Fluffy Breakdowns] Dont Use Thread Safe Collections #667

Closed robinzilla closed 2 years ago

robinzilla commented 3 years ago

IMPORTANT:

Please first search existing bugs to ensure you are not creating a duplicate bug report!
Make sure you have the latest version of Rimworld!

Describe the bug

While Rimthreaded is enabled, I receive a steady tick of red errors that point back to Fluffy Breakdowns. While trying to track down this issue, I was told that it relates to how Fluffy Breakdowns handles collections in a way that is not thread safe and therefore conflicts with RimThreaded. Disabling RT does indeed correct the errors.

Steps to reproduce the behavior (VERY IMPORTANT)

  1. Load save.

  2. As soon as you let it go forward, you get a couple red errors.

  3. Let the game move forward for a few minutes and you will see more red errors tick by.

System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
  at System.Collections.Generic.Dictionary`2+Enumerator[TKey,TValue].MoveNext () [0x00016] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at Fluffy_Breakdowns.MapComponent_Durability.MapComponentTick () [0x00146] in <e618f1fde99b40e1a68cb2027c8d0840>:0 
  at Verse.MapComponentUtility.MapComponentTick (Verse.Map map) [0x00013] in <b64badbf3c3d41018b3ca5d3e8c77771>:0  
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 39)

HugsLib log

https://gist.github.com/7621f15bd15b12da9fd87f85373216e5

Save file

ModTest (RT Enabled;Fluffy Breakdown Enabled).zip

Mod list (Preferably a RimPy compatible list.)

ModTest (RT+Fluffy Breakdowns).txt