Spawning a probe core locks up the game (1.8)
millenniumtree opened this issue ยท 7 comments
Turn the debug spawn parts option on, try to spawn a probe core such as a probodobodyne HECS2. The inventory window turns grey, and the game locks and must be restarted.
Spawning other parts don't appear to do this.
How do you spawn it? Could you please try reproducing it in a pristine game? I tried to spawn HECS2 in kerbals inventory - it worked just fine. But my game has a minimum mods setup.
I spent some time swapping mods out. Indeed, with no mods at all, it works fine.
The minimum requirements for reproducing the error are:
KIS (I used 1.23)
MechJeb2-2.9.1.0
Enable itemDebug in settings.cfg, start a new game, put jeb in a lander can, spawn the HECS2. Probably other cores do the same - I first saw it while I was on minmus, hand-crafting a jump ship from spawned parts. I needed any probe at all to control the craft, so I tried several different types, and they all did the same thing.
The inventory window goes gray and you can't do anything. The game appears to be locked up, but it's not COMPLETELY frozen - you just get about 1 frame every 10-60 seconds.
I've got a log file for you. It's our old friend the NullReferenceException: Object reference not set to an instance of an object.
KSP.log
Perhaps the bug belongs to MechJeb, or they're not getting along, but that's how you reproduce it.
Well, bad news. After 1.8
release I had to significantly refactor the way of making part snapshots. And one of the compromises was providing null
proto vessel to the snapshot engine. It works fine with the stock code, but MechJeb
wants to save the vessel modules on snapshot. Bummer!
I'll see if a better snapshotting method can be made (no obvious solution in my mind at this moment) or if MechJeb
can be fixed. For now the only feasible fix is not blocking the game when it happens. UI freeze is a bug in the spawn dialog GUI. But it's triggered by a failure that comes from MechJeb
.
The error comes from:
191206T222857.539 [ERROR] [KSPDev.GUIUtils.GuiActionsList.ExecutePendingGuiActions] GUI action failed: System.NullReferenceException: Object reference not set to an instance of an object
at MuMech.VesselExtensions.GetModules[T] (Vessel vessel) [0x000a0] in <3ddb09b54c5e42379c1671957c9d0f6f>:0
at MuMech.VesselExtensions.GetMasterMechJeb (Vessel vessel) [0x00046] in <3ddb09b54c5e42379c1671957c9d0f6f>:0
at MuMech.MechJebCore.OnSave (ConfigNode sfsNode) [0x00016] in <3ddb09b54c5e42379c1671957c9d0f6f>:0
at PartModule.Save (ConfigNode node) [0x00125] in <9d71e4043e394d78a6cf9193ad011698>:0
at ProtoPartModuleSnapshot..ctor (PartModule module) [0x0007f] in <9d71e4043e394d78a6cf9193ad011698>:0
at ProtoPartSnapshot..ctor (Part PartRef, ProtoVessel protoVessel, System.Boolean preCreate) [0x0033f] in <9d71e4043e394d78a6cf9193ad011698>:0
at ProtoPartSnapshot..ctor (Part PartRef, ProtoVessel protoVessel) [0x00000] in <9d71e4043e394d78a6cf9193ad011698>:0
at KISAPIv1.PartNodeUtilsImpl.PartSnapshot (Part part) [0x00071] in <469326da24904f9f8a355fbfc77512c6>:0
at KIS.KIS_Item..ctor (Part part, KIS.ModuleKISInventory inventory, System.Int32 quantity) [0x0003b] in <469326da24904f9f8a355fbfc77512c6>:0
at KIS.KIS_Item.CreateItemFromScenePart (Part part, KIS.ModuleKISInventory inventory, System.Int32 quantity) [0x00001] in <469326da24904f9f8a355fbfc77512c6>:0
at KIS.ModuleKISInventory.AddItem (Part p, System.Int32 qty, System.Int32 slot) [0x000aa] in <469326da24904f9f8a355fbfc77512c6>:0
at KIS.Debug.SpawnItemDialog.GuiSpawnItems (AvailablePart avPart) [0x00074] in <469326da24904f9f8a355fbfc77512c6>:0
at KIS.Debug.SpawnItemDialog+<>c__DisplayClass10_0.<GuiMain>b__1 () [0x00000] in <469326da24904f9f8a355fbfc77512c6>:0
at KSPDev.GUIUtils.GuiActionsList.ExecutePendingGuiActions () [0x00023] in <bbf9c445226849f18377b67b9edc46aa>:0
It's something very specific to MechJeb
that tries to save the vessel modules, given only one part is being saved.
At this moment I don't have spare time to investigate it. Given it's about a debug functionality, we can live with it as long the game is not crashing (it doesn't starting from v1.24).
FYI @sarbian, if MechJeb
could verify that the protovessel is not null
, it would solve the issue.
I am not exactly moved at the idea of checking something that should not happen. The only way to have an NRE in this part of the code is having either vessel.Parts null or part.Modules null for one of the vessel Part. Neither is a normal state and I doubt other mods would fare better than MJ in this case.
Thanks for looking into it! I'll try to find a workaround.
As of " checking something that should not happen", well, the whole KIS is something that should not have happen. KSP is completely not designed to allow arbitrary parts to be spawned in flight. The game can only tolerate a new vessel be spawned, but it's a significantly different matter.