promotional bannermobile promotional banner

Server crash fixes

There are a number of hytale server bugs that can cause the server to crash in certain scenarios, this plugin aims to fix and limit impact of those bugs.

Server fixes 1.1.1

This plugin aims to fix (or reduce impact from) a number of bug in the hytale server jar which can lead to the server crashing, or world threads crashing. See below for information on the fixes.

Fixes

Null pickup item targetRef crash

Exception

java.lang.NullPointerException: Cannot invoke "com.hypixel.hytale.component.Ref.isValid()" because "targetRef" is null; at com.hypixel.hytale.server.core.modules.entity.item.PickupItemSystem.tick(PickupItemSystem.java:69); at com.hypixel.hytale.component.system.tick.EntityTickingSystem.doTick(EntityTickingSystem.java:92); at com.hypixel.hytale.component.system.tick.EntityTickingSystem.tick(EntityTickingSystem.java:36); at com.hypixel.hytale.component.Store.tick(Store.java:1971); 
...  

Why is this happening?

This happens if a PickupItemComponent is created without using the constructors which set the targetRef (for example spawned or loaded from data using the codec) or if some plugin/mod accidentally passes a null value.

How does ServerFixes fix this?

Serverfixes monitors for invalid PickupItem entities and will remove them during world ticks before the PickupItemSystem, preventing the crash, this logs to console when it happens.

MountedComponent archetype crash mitigation

Exception

Exception in thread Thread\[#72,WorldThread - default,5,InnocuousForkJoinWorkerThreadGroup\]:  
java.lang.IllegalArgumentException: ComponentType is not in archetype: ComponentType{} ……..  
at com.hypixel.hytale.component.Archetype.validateComponentType(Archetype.java:146)  
at com.hypixel.hytale.component.Holder.removeComponent(Holder.java:304)  
at com.hypixel.hytale.component.Store.removeComponent(Store.java:1254)  
at com.hypixel.hytale.component.CommandBuffer.lambda$removeComponent$0(CommandBuffer.java:430)  
at com.hypixel.hytale.component.CommandBuffer.consume(CommandBuffer.java:520)  

Why is this happening?

This happens because there is a validateComponentType check on ECS events which checks to ensure that the component actually exists. If the command queue contains more than one RelativeMovement or AbsoluteMovement update which is very possible on a busy server, the command buffer ends up containing multiple "remove MountedComponent" commands, the first one changes the entities archetype (at this point the component is gone) and then the second removal hits validateComponentType(…) and will throw

How does ServerFixes fix this?

Serverfixes will monitor the PlayerInput.getMovementUpdateQueue and trim it to ensure it only contains one movement event when a player is mounted after 600ms. This may cause small movement jitter in game but that's a small visual thing that will only happen in cases where the world would otherwise crash.

NullPointerException Cannot read the array length because "<local15>" is null in npcReferences onEntityRemove

Exception

Exception in thread Thread[#151,WorldThread - default,5,InnocuousForkJoinWorkerThreadGroup]:
java.lang.NullPointerException: Cannot read the array length because "<local15>" is null
at com.hypixel.hytale.server.npc.systems.SpawnReferenceSystems$MarkerAddRemoveSystem.onEntityRemove(SpawnReferenceSystems.java:166)
at com.hypixel.hytale.component.Store.removeEntity(Store.java:848)
at com.hypixel.hytale.component.CommandBuffer.lambda$removeEntity$0(CommandBuffer.java:292) at com.hypixel.hytale.component.CommandBuffer.consume(CommandBuffer.java:520)
...

Why is this happening?

When the server removes an NPC, it runs a cleanup hook that updates the NPC’s spawn marker, During cleanup, the server does “remove this NPC from the marker’s list” by looping over that list. But because the list is null, Java crashes immediately when it tries to loop (“can’t read array length because it’s null”), and the world thread dies. In the failing case, the spawn marker is in an inconsistent state where:

  • it still thinks there are NPCs spawned (spawnCount > 0)
  • but its internal list of NPC references (npcReferences) is missing (null)

How does ServerFixes fix this?

ServerFixes adds a small pre-cleanup guard that runs before the server’s buggy cleanup code.

  • If the NPC is being removed and the linked spawn marker has spawnCount > 0 and npcReferences == null (the exact crash condition), ServerFixes adjusts the marker’s spawnCount so that the server’s cleanup code skips the branch that would loop the null array.

HELP! My server is impacted by a fatal server bug causing crashes but Server Fixes doesn't include a fix

Feel free to reach out to me via my discord server linked on this post, or DMing me on discord (jamo.sh) and I'd be happy to look at your log and implement a fix where possible.

Links

Plugin discord server

Server owners community

The Server crash fixes Team

profile avatar
Owner
  • 3
    Followers
  • 2
    Projects
  • 8.6K
    Downloads

More from Jamo_sh