Skip to content

Fix join-point reload cache crash - #938

Merged
notfood merged 5 commits into
rwmt:devfrom
NemusForks:fix/cache-crash
Jun 1, 2026
Merged

Fix join-point reload cache crash#938
notfood merged 5 commits into
rwmt:devfrom
NemusForks:fix/cache-crash

Conversation

@NemuruYama

Copy link
Copy Markdown
image

Alternative fix for the join-point reload crash described in #935.

Fixes a crash while creating a join-point snapshot during multiplayer reload. The old reload cache copied internal world/grid state across reload boundaries, which could leave the freshly loaded WorldGrid in an invalid state and throw from CacheForReloading during World.ExposeData.

The fix removes unsafe cache restoration for reloads and replaces it with a narrower join-point reload optimization: skip the faction-restore map drawer rebuild while the snapshot is being created, then regenerate map drawers once after the snapshot is complete.

I have never had this on the steam version, but I couldn't get the local dev branch to work untill I removed the caching.
I tried to add back some optimisations.

Mod List:

- zetrith.prepatcher
- nemuruyama.disablesteammods
- ludeon.rimworld
- ludeon.rimworld.royalty
- ludeon.rimworld.ideology
- ludeon.rimworld.biotech
- ludeon.rimworld.anomaly
- ludeon.rimworld.odyssey
- rwmt.multiplayer
SaveableFromNode exception: System.Reflection.TargetInvocationException
System.NullReferenceException: Object reference not set to an instance of an object.
   at Multiplayer.Client.WorldGridCachePatch.Prefix (...)
   in Multiplayer/Saving/CacheForReloading.cs:76
   at RimWorld.Planet.WorldGrid..ctor_Patch1(...)
Exception from long event: System.NullReferenceException: Object reference not set to an instance of an object.
  at Multiplayer.Client.WorldGridCachePatch.Prefix (
      RimWorld.Planet.WorldGrid __instance,
      System.Int32& ___cachedTraversalDistance,
      System.Int32& ___cachedTraversalDistanceForStart,
      System.Int32& ___cachedTraversalDistanceForEnd
  ) [0x00036] in Multiplayer/Saving/CacheForReloading.cs:76
  at RimWorld.Planet.GameSetupStep_Grids.GenerateFresh ()
  at RimWorld.Planet.WorldGenerator.GenerateWithoutWorldData (System.String seedString)
  at RimWorld.Planet.World.ExposeData ()
  at Verse.Game.LoadGame_Patch3(Verse.Game)
  at Multiplayer.Client.LoadPatch.Prefix () in Multiplayer/Saving/LoadPatch.cs:27
  at Verse.SavedGameLoaderNow.LoadGameFromSaveFileNow_Patch1(string)
  at Multiplayer.Client.SaveLoad.LoadInMainThread (...) in Multiplayer/Saving/SaveLoad.cs:135
  at Multiplayer.Client.SaveLoad.SaveAndReload (System.Boolean cache) in Multiplayer/Saving/SaveLoad.cs:86
  at Multiplayer.Client.AsyncTime.AsyncWorldTimeComp.CreateJoinPointAndSendIfHost ()
      in Multiplayer/AsyncTime/AsyncWorldTimeComp.cs:279
Random state stack is not empty. There were more calls to PushState than PopState. Fixing.

Exception in UIRootUpdate: System.NullReferenceException
  at RimWorld.UIRoot_Play.UIRootUpdate ()

Root level exception in Update(): System.NullReferenceException
  at RimWorld.Planet.WorldRendererUtility.get_CurrentWorldRenderMode_Patch1()
  at RimWorld.Planet.WorldRendererUtility.get_WorldSelected ()
  at Multiplayer.Client.SetMapTimeForUI.Prefix (...)

@notfood

notfood commented May 27, 2026

Copy link
Copy Markdown
Member

Can you check the test? It seems to be failing.

@notfood notfood added fix Fixes for a bug or desync. 1.6 Fixes or bugs relating to 1.6 (Not Odyssey). labels May 28, 2026
@notfood notfood moved this to In review in 1.6 and Odyssey May 28, 2026
@NemuruYama

Copy link
Copy Markdown
Author

Can you check the test? It seems to be failing.

They are passing locally.
It is because I made some net48 tests that honestly don't add enough to change the CI workflow.
So I removed them.

@notfood
notfood merged commit 6aef95e into rwmt:dev Jun 1, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from In review to Done in 1.6 and Odyssey Jun 1, 2026
This was referenced Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.6 Fixes or bugs relating to 1.6 (Not Odyssey). fix Fixes for a bug or desync.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants