OMLib

OMLib

21M Downloads

NPE console spam with OMT trying to write a null player?

LemADEC opened this issue ยท 1 comments

commented

As of omlib-1.12.2-3.2.0-256 + openmodularturrets-1.12.2-3.2.0-379, a console spam was observed which leads to a GC overload which caused a server crash. According to the player in the area, that turret got corrupted/missing at some point then reappeared randomly.
Notable call stack in the spam:

[15:44:19] [Server thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception
io.netty.handler.codec.EncoderException: java.lang.NullPointerException
	at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:106) ~[minecraft_server.1.12.2.jar:?]
	at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[minecraft_server.1.12.2.jar:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:738) ~[minecraft_server.1.12.2.jar:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:801) ~[minecraft_server.1.12.2.jar:?]
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:814) ~[minecraft_server.1.12.2.jar:?]
	at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:794) ~[minecraft_server.1.12.2.jar:?]
	at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:831) ~[minecraft_server.1.12.2.jar:?]
	at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1032) ~[minecraft_server.1.12.2.jar:?]
	at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:296) ~[minecraft_server.1.12.2.jar:?]
	at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendToAllTracking(SimpleNetworkWrapper.java:279) [SimpleNetworkWrapper.class:?]
	at omtteam.openmodularturrets.tileentity.TurretBase.informUpdate(TurretBase.java:352) [TurretBase.class:?]
	at omtteam.openmodularturrets.tileentity.TurretBase.TickCentral_TrueITickableUpdate(TurretBase.java:390) [TurretBase.class:?]
	at com.github.terminatornl.tickcentral.api.TickHub.trueUpdate(TickHub.java:48) [TickHub.class:3.2]
	at com.github.terminatornl.tickcentral.api.TickInterceptor.redirectUpdate(TickInterceptor.java:24) [TickInterceptor.class:3.2]
	at omtteam.openmodularturrets.tileentity.TurretBase.func_73660_a(TurretBase.java) [TurretBase.class:?]
	at org.spongepowered.common.event.tracking.TrackingUtil.tickTileEntity(TrackingUtil.java:237) [spongeforge-1.12.2-2838-7.3.0.jar:1.12.2-2838-7.3.0]
	at net.minecraft.world.WorldServer.updateTileEntity(WorldServer.java:4749) [oo.class:?]
	at net.minecraft.world.WorldServer.redirect$zlo000$onUpdateTileEntities(WorldServer.java:4733) [oo.class:?]
	at net.minecraft.world.World.func_72939_s(World.java:1838) [amu.class:?]
	at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:3931) [oo.class:?]
	at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:767) [MinecraftServer.class:?]
	at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:397) [nz.class:?]
	at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668) [MinecraftServer.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_262]
Caused by: java.lang.NullPointerException
	at omtteam.omlib.util.player.Player.writeToByteBuf(Player.java:45) ~[Player.class:?]
	at omtteam.openmodularturrets.network.messages.MessageTurretBase.toBytes(MessageTurretBase.java:118) ~[MessageTurretBase.class:?]
	at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:30) ~[SimpleIndexedCodec.class:?]
	at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:26) ~[SimpleIndexedCodec.class:?]
	at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.encode(FMLIndexedMessageToMessageCodec.java:81) ~[FMLIndexedMessageToMessageCodec.class:?]
	at io.netty.handler.codec.MessageToMessageCodec$1.encode(MessageToMessageCodec.java:67) ~[minecraft_server.1.12.2.jar:?]
	at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:88) ~[minecraft_server.1.12.2.jar:?]
	... 24 more

From a quick look at the callstack, it seems caused by a null player.
We've no clue at this point how the turret got corrupted, but sanitizing inputs from that Player.writeToByteBuf() function would save from crashing the server next time it happens.

commented

Interesting, I will check that out. Currently I am in the middle of rewriting the Turrets rendering stuff, so I do not exactly know when this will be fixed.