cseelhoff / RimThreaded

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

[Autocleaner] error think node priority closest thing reachable `Exception in Verse.AI.ThinkNode_Priority TryIssueJobPackage: System.InvalidOperationException: Collection was modified;` #697

Open sealvessel opened 2 years ago

sealvessel commented 2 years ago

Describe the bug

Autocleaner error https://steamcommunity.com/sharedfiles/filedetails/?id=2051042827

Steps to reproduce the behavior (VERY IMPORTANT)

  1. Install autocleaners
  2. Make them do alot of jobs?

Error Logs

Exception in Verse.AI.ThinkNode_Priority TryIssueJobPackage: System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
  at System.ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource resource) [0x0000b] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at System.Collections.Generic.List`1+Enumerator[T].MoveNextRare () [0x00013] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at System.Collections.Generic.List`1+Enumerator[T].MoveNext () [0x0004a] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at System.Linq.Enumerable+WhereListIterator`1[TSource].MoveNext () [0x0004e] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 
  at Verse.GenClosest.ClosestThing_Global_Reachable (Verse.IntVec3 center, Verse.Map map, System.Collections.Generic.IEnumerable`1[T] searchSet, Verse.AI.PathEndMode peMode, Verse.TraverseParms traverseParams, System.Single maxDistance, System.Predicate`1[T] validator, System.Func`2[T,TResult] priorityGetter) [0x0011d] in <720a4e30fed64864bd8af057c96d4eb5>:0 
  at Autocleaner.JobGiverAutocleaner.TryGiveJob (Verse.Pawn pawn) [0x00134] in <e4c2f444e94c44f09f13b2249ae54797>:0 
  at Verse.AI.ThinkNode_JobGiver.TryIssueJobPackage (Verse.Pawn pawn, Verse.AI.JobIssueParams jobParams) [0x00000] in <720a4e30fed64864bd8af057c96d4eb5>:0 
  at Verse.AI.ThinkNode_Priority.TryIssueJobPackage (Verse.Pawn pawn, Verse.AI.JobIssueParams jobParams) [0x00022] in <720a4e30fed64864bd8af057c96d4eb5>:0 
UnityEngine.StackTraceUtility:ExtractStackTrace ()
(wrapper dynamic-method) Verse.Log:Verse.Log.Error_Patch2 (string)
Verse.AI.ThinkNode_Priority:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams)
RimThreaded.Pawn_JobTracker_Patch:DetermineNextJob2 (Verse.AI.Pawn_JobTracker,Verse.ThinkTreeDef&)
RimThreaded.Pawn_JobTracker_Patch:TryFindAndStartJob (Verse.AI.Pawn_JobTracker)
(wrapper dynamic-method) Verse.AI.Pawn_JobTracker:Verse.AI.Pawn_JobTracker.TryFindAndStartJob_Patch1 (Verse.AI.Pawn_JobTracker)
(wrapper dynamic-method) Verse.AI.Pawn_JobTracker:Verse.AI.Pawn_JobTracker.EndCurrentJob_Patch3 (Verse.AI.Pawn_JobTracker,Verse.AI.JobCondition,bool,bool)
Verse.AI.JobDriver:EndJobWith (Verse.AI.JobCondition)
Verse.AI.JobDriver:CheckCurrentToilEndOrFail ()
(wrapper dynamic-method) Verse.AI.JobDriver:Verse.AI.JobDriver.DriverTick_Patch0 (Verse.AI.JobDriver)
Verse.AI.Pawn_JobTracker:JobTrackerTick ()
Verse.Pawn:Tick ()
Autocleaner.PawnAutocleaner:Tick ()
RimThreaded.TickList_Patch:NormalThingTick ()
RimThreaded.RimThreaded:ExecuteTicks ()
RimThreaded.RimThreaded:ProcessTicks (RimThreaded.RimThreaded/ThreadInfo)
RimThreaded.RimThreaded:InitializeThread (object)
System.Threading.ThreadHelper:ThreadStart_Context (object)
System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object)
System.Threading.ThreadHelper:ThreadStart (object)

Player.log

https://controlc.com/2120c7b7

HugsLib log

https://gist.github.com/778832793e94e476fdf52782b404c1c2

Save file

!!! Please add a save file where the issue occurs to speed up testing and fixing of the issue !!!

Screenshots

image

Mod list (Preferably a RimPy compatible list.)

sealvessel commented 2 years ago

Still happens in latest experimental.

image

https://gist.github.com/b8d16ec0961a03126487b65a42c8ec5b