This object is in archive! 

Crash in MyTurretControlBlock.EndShoot

Guest shared this bug 2 years ago
Solved

Game version: 1.200.027

A player reported that every time a custom turret controller is using a crane is crashes his dedicated server.

How to reproduce:

Load the attached world into a Dedicated Server. It will crash right when the world loads.

Reproducibility: 100%

Dedicated Server logs attached, no client was needed to reproduce the issue.

Root cause:

I did not have enough time to fully root cause it yet, but the exception is very telling.

The likely cause is a logic bug, not disabling updates while moving grids between grid groups.

It also affects performance. Why does it update resource distribution before finishing the complete group merge?

Exception occurred: System.NullReferenceException: Object reference not set to an instance of an object.
at SpaceEngineers.Game.Entities.Blocks.MyTurretControlBlock.EndShoot(MyShootActionEnum action)
at SpaceEngineers.Game.Entities.Blocks.MyTurretControlBlock.OnStopWorking()
at System.Action`1.Invoke(T obj)
at Sandbox.Game.Entities.MyCubeBlock.UpdateIsWorking()
at SpaceEngineers.Game.Entities.Blocks.MyTurretControlBlock.PowerReceiver_IsPoweredChanged()
at System.Action.Invoke()
at System.DelegateExtensions.InvokeIfNotNull(Action handler)
at Sandbox.Game.EntityComponents.MyResourceSinkComponent.SetInputFromDistributor(MyDefinitionId resourceTypeId, Single newResourceInput, Boolean isAdaptible, Boolean fireEvents)
at Sandbox.Game.EntityComponents.MyResourceDistributorComponent.RecomputeResourceDistributionPartial(MyDefinitionId& typeId, Int32 startPriorityIdx, MySinkGroupData[] sinkDataByPriority, MySourceGroupData[] sourceDataByPriority, MyTuple`2& sinkSourceData, HashSet`1[] sinksByPriority, HashSet`1[] sourcesByPriority, List`1 sinkSourcePairs, MyList`1 stockpilingStorageList, MyList`1 otherStorageList, Single availableResource)
at Sandbox.Game.EntityComponents.MyResourceDistributorComponent.RecomputeResourceDistribution(MyDefinitionId& typeId, Boolean updateChanges)
at Sandbox.Game.EntityComponents.MyResourceDistributorComponent.UpdateBeforeSimulation()
at Sandbox.Game.Entities.Cube.MyCubeGridSystems.OnRemovedFromGroup(MyGridLogicalGroupData group)
at Sandbox.Game.Entities.MyCubeGrid.OnRemovedFromGroup(MyGridLogicalGroupData group)
at Sandbox.Game.Entities.MyGridLogicalGroupData.OnNodeRemoved[TGroupData](MyCubeGrid entity, TGroupData nextGroup)
at VRage.Groups.MyGroups`2.Node.set_m_group(Group value)
at VRage.Groups.MyGroups`2.MergeGroups(Group groupA, Group groupB)
at VRage.Groups.MyGroups`2.CreateLink(Int64 linkId, TNode parentNode, TNode childNode)
at Sandbox.Game.Entities.MyCubeGridGroups.CreateLink(GridLinkTypeEnum type, Int64 linkId, MyCubeGrid parent, MyCubeGrid child)
at Sandbox.Game.Entities.MyCubeBlock.OnConstraintAdded(GridLinkTypeEnum type, IMyEntity attachedEntity)
at Sandbox.Game.Entities.Blocks.MyMechanicalConnectionBlockBase.Attach(MyAttachableTopBlockBase topBlock, Boolean updateGroup)
at Sandbox.Game.Entities.Blocks.MyPistonBase.Attach(MyAttachableTopBlockBase topBlock, Boolean updateGroup)
at Sandbox.Game.Entities.Blocks.MyMechanicalConnectionBlockBase.UpdateAttachState()
at Sandbox.Game.Entities.Blocks.MyMechanicalConnectionBlockBase.UpdateOnceBeforeFrame()
at Sandbox.Game.Entities.Blocks.MyPistonBase.UpdateOnceBeforeFrame()
at Sandbox.Game.Entities.MyParallelEntityUpdateOrchestrator.DispatchOnceBeforeFrame()
at Sandbox.Game.Entities.MyEntities.UpdateBeforeSimulation()
at Sandbox.Game.World.MySector.UpdateBeforeSimulation()
at Sandbox.Game.World.MySession.UpdateComponents()
at Sandbox.Game.World.MySession.Update(MyTimeSpan updateTime)
at Sandbox.MySandboxGame.Update()
I have seen this exact same exception happening before in various situations when the custom turret controller intermittently lost power due rotor head attachment, which also causes a move between grid groups (MergeGroups).

Replies (4)

photo
1

Hello!


Thank you for your report. I reproduced the crash and reported it internally for further investigation.


Kind regards,

Keen Software House, QA Department

photo
1

I seem to have the same bug, but in single player, with an unfinished custom turret on a powered down grid. (It had two hinges and a camera but no guns.) The crash only seems to happen while loading a saved game and isn't totally consistent.

I backtracked backups to one where the grid I suspected of causing the problem was powered, and that save loaded. I saved it, saved it again with the grid off as a new save, then backed out and tried to load the save with it powered off. It worked. However, at the time I was some distance away from other grids, and the crash did happen later on (again) in an area with a bunch of grids, subgrids, and scripts. The vehicle in question wasn't connected to any of those grids either time. (Which is why it was shut down.) For now, I got rid of the turret controller until I'm ready to build the full turret and hopefully there won't be any more problems. (I have other custom turret controllers in use, but they should all be on powered grids and are finished functioning turrets.)

photo
1

Spoke too soon, the saved games where I got rid of the custom turret controller I thought was causing the problem are not loading now either. So the game is basically unplayable.

photo
photo
1

Related crash on grinding any active (shooting) turret. It crashes the game client, highly reproducible. It also crashes in multiplayer, but only the client, the server continues to run with no errors. This is a client side issue.

2022-04-03 03:22:05.842 - Thread:   1 ->  GC Memory: 2058.513 / 2058.513 MB2022-04-03 03:22:17.304 - Thread:   1 ->  Exception occurred: System.NullReferenceException: Object reference not set to an instance of an object.   at Sandbox.Game.Weapons.MyLargeTurretBase.UpdateShooting(Boolean shouldShoot)   at Sandbox.Game.Weapons.MyLargeTurretBase.OnEndShoot(MyShootActionEnum action)   at VRage.Network.CallSite`7.Invoke(BitStream stream, Object obj, Boolean validate)   at VRage.Network.MyReplicationLayer.Invoke(CallSite callSite, BitStream stream, Object obj, EndpointId source, MyClientStateBase clientState, Boolean validate)   at VRage.Network.MyReplicationClient.OnEvent(MyPacketDataBitStreamBase data, CallSite site, Object obj, IMyNetObject sendAs, Nullable`1 position, EndpointId source)   at VRage.Network.MyReplicationLayer.OnEvent(MyPacketDataBitStreamBase data, NetworkId networkId, NetworkId blockedNetId, UInt32 eventId, EndpointId sender, Nullable`1 position)   at VRage.Network.MyReplicationClient.OnEvent(MyPacketDataBitStreamBase data, NetworkId networkId, NetworkId blockedNetId, UInt32 eventId, EndpointId sender, Nullable`1 position)   at VRage.Network.MyReplicationLayer.ProcessEvent(MyPacketDataBitStreamBase data, EndpointId sender)   at VRage.Network.MyReplicationLayer.OnEvent(MyPacket packet)   at Sandbox.Engine.Multiplayer.MyTransportLayer.ProcessMessage(MyPacket p)   at Sandbox.Engine.Multiplayer.MyTransportLayer.HandleMessage(MyPacket p)   at Sandbox.Engine.Networking.MyReceiveQueue.Process(NetworkMessageDelegate handler)2022-04-03 03:22:17.305 - Thread:   1 ->  Packet processing error, disconnecting VRage.Network.Endpoint2022-04-03 03:22:17.308 - Thread:   1 ->  Exception occurred: System.NullReferenceException: Object reference not set to an instance of an object.   at Sandbox.Game.Weapons.MyLargeTurretBase.UpdateShooting(Boolean shouldShoot)   at Sandbox.Game.Weapons.MyLargeTurretBase.OnEndShoot(MyShootActionEnum action)   at VRage.Network.CallSite`7.Invoke(BitStream stream, Object obj, Boolean validate)   at VRage.Network.MyReplicationLayer.Invoke(CallSite callSite, BitStream stream, Object obj, EndpointId source, MyClientStateBase clientState, Boolean validate)   at VRage.Network.MyReplicationClient.OnEvent(MyPacketDataBitStreamBase data, CallSite site, Object obj, IMyNetObject sendAs, Nullable`1 position, EndpointId source)   at VRage.Network.MyReplicationLayer.OnEvent(MyPacketDataBitStreamBase data, NetworkId networkId, NetworkId blockedNetId, UInt32 eventId, EndpointId sender, Nullable`1 position)   at VRage.Network.MyReplicationClient.OnEvent(MyPacketDataBitStreamBase data, NetworkId networkId, NetworkId blockedNetId, UInt32 eventId, EndpointId sender, Nullable`1 position)   at VRage.Network.MyReplicationLayer.ProcessEvent(MyPacketDataBitStreamBase data, EndpointId sender)   at VRage.Network.MyReplicationLayer.OnEvent(MyPacket packet)   at Sandbox.Engine.Multiplayer.MyTransportLayer.ProcessMessage(MyPacket p)   at Sandbox.Engine.Multiplayer.MyTransportLayer.HandleMessage(MyPacket p)   at Sandbox.Engine.Networking.MyReceiveQueue.Process(NetworkMessageDelegate handler)   at Sandbox.Engine.Networking.MyNetworkReader.Process()   at Sandbox.MySandboxGame.Update()   at Sandbox.Engine.Platform.Game.UpdateInternal()   at Sandbox.Engine.Platform.Game.RunSingleFrame()   at Sandbox.Engine.Platform.FixedLoop.<>c__DisplayClass11_0.<Run>b__0()   at Sandbox.Engine.Platform.GenericLoop.Run(VoidAction tickCallback)   at Sandbox.Engine.Platform.Game.RunLoop()   at Sandbox.MySandboxGame.Run(Boolean customRenderLoop, Action disposeSplashScreen)   at SpaceEngineers.MyProgram.Main(String[] args)2022-04-03 03:22:17.308 - Thread:   1 ->  Showing message

photo
1

Hello, Engineers!

The fix for this is in v201

Thank you.

Kind Regards,

Keen Software House: QA Department

Leave a Comment
 
Attach a file