Immersive Engineering

Immersive Engineering

134M Downloads

Kicked with IndexOutOfBoundsException

Derkades opened this issue ยท 4 comments

commented

Minecraft Version

1.19

Immersive Engineering Version

9.0.0-153

Expected Behavior

N/A

Actual Behavior

After enabling debug logging, I found the following in debug.log:

[26Oct2022 17:50:56.598] [Netty Client IO #0/DEBUG] [net.minecraft.network.Connection/]: Failed to sent packet
java.lang.IndexOutOfBoundsException: readerIndex(5) + length(4) exceeds writerIndex(5): PooledUnsafeDirectByteBuf(ridx: 5, widx: 5, cap: 5)
	at io.netty.buffer.AbstractByteBuf.checkReadableBytes0(AbstractByteBuf.java:1442) ~[netty-buffer-4.1.77.Final.jar%2380!/:4.1.77.Final]
	at io.netty.buffer.AbstractByteBuf.readInt(AbstractByteBuf.java:809) ~[netty-buffer-4.1.77.Final.jar%2380!/:4.1.77.Final]
	at net.minecraft.network.FriendlyByteBuf.readInt(FriendlyByteBuf.java:1108) ~[client-1.19.2-20220805.130853-srg.jar%23197!/:?]
	at blusunrize.immersiveengineering.common.network.MessageBlockEntitySync.<init>(MessageBlockEntitySync.java:39) ~[ImmersiveEngineering-1.19.2-9.0.0-153.jar%23151!/:?]
	at net.minecraftforge.network.simple.IndexedMessageCodec.lambda$tryDecode$0(IndexedMessageCodec.java:107) ~[forge-1.19.2-43.1.47-universal.jar%23202!/:?]
	at java.util.Optional.map(Optional.java:260) ~[?:?]
	at net.minecraftforge.network.simple.IndexedMessageCodec.tryDecode(IndexedMessageCodec.java:107) ~[forge-1.19.2-43.1.47-universal.jar%23202!/:?]
	at net.minecraftforge.network.simple.IndexedMessageCodec.consume(IndexedMessageCodec.java:153) ~[forge-1.19.2-43.1.47-universal.jar%23202!/:?]
	at net.minecraftforge.network.simple.SimpleChannel.networkEventListener(SimpleChannel.java:63) ~[forge-1.19.2-43.1.47-universal.jar%23202!/:?]
	at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:260) ~[eventbus-6.0.3.jar%23106!/:?]
	at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:252) ~[eventbus-6.0.3.jar%23106!/:?]
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.3.jar%23106!/:?]
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.3.jar%23106!/:?]
	at net.minecraftforge.network.NetworkInstance.dispatch(NetworkInstance.java:68) ~[forge-1.19.2-43.1.47-universal.jar%23202!/:?]
	at net.minecraftforge.network.NetworkHooks.lambda$onCustomPayload$1(NetworkHooks.java:77) ~[forge-1.19.2-43.1.47-universal.jar%23202!/:?]
	at java.util.Optional.map(Optional.java:260) ~[?:?]
	at net.minecraftforge.network.NetworkHooks.onCustomPayload(NetworkHooks.java:77) ~[forge-1.19.2-43.1.47-universal.jar%23202!/:?]
	at net.minecraft.client.multiplayer.ClientPacketListener.m_7413_(ClientPacketListener.java:1674) ~[client-1.19.2-20220805.130853-srg.jar%23197!/:?]
	at net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket.m_5797_(ClientboundCustomPayloadPacket.java:57) ~[client-1.19.2-20220805.130853-srg.jar%23197!/:?]
	at net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket.m_5797_(ClientboundCustomPayloadPacket.java:7) ~[client-1.19.2-20220805.130853-srg.jar%23197!/:?]
	at net.minecraft.network.Connection.m_129517_(Connection.java:163) ~[client-1.19.2-20220805.130853-srg.jar%23197!/:?]
	at net.minecraft.network.Connection.channelRead0(Connection.java:148) ~[client-1.19.2-20220805.130853-srg.jar%23197!/:?]
	at net.minecraft.network.Connection.channelRead0(Connection.java:48) ~[client-1.19.2-20220805.130853-srg.jar%23197!/:?]
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) ~[netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:327) [netty-codec-4.1.77.Final.jar%2381!/:4.1.77.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:299) [netty-codec-4.1.77.Final.jar%2381!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:327) [netty-codec-4.1.77.Final.jar%2381!/:4.1.77.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:299) [netty-codec-4.1.77.Final.jar%2381!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:327) [netty-codec-4.1.77.Final.jar%2381!/:4.1.77.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:299) [netty-codec-4.1.77.Final.jar%2381!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [netty-codec-4.1.77.Final.jar%2381!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) [netty-handler-4.1.77.Final.jar%2382!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496) [netty-transport-4.1.77.Final.jar%2384!/:4.1.77.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:995) [netty-common-4.1.77.Final.jar%2379!/:4.1.77.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.77.Final.jar%2379!/:4.1.77.Final]
	at java.lang.Thread.run(Thread.java:833) [?:?]

It mentions immersive engineering in the backtrace so I suspect it is related

Steps to reproduce

Unfortunately, I can't come up with any specific reproduction steps. Happened when joining an "Open to LAN" server and moving about for a bit.

Debug Crash Log

https://gist.github.com/Derkades/21c9382805842cb8c7dcec78ab5b9b1c

commented

Mostly as a note for myself, I found a potentially related issue (but apparently fixed in Forge): mekanism/Mekanism#7577

commented

I've found a semi-reliable reproduction setup on 121b7ae:

  1. Run 2 dev clients with different usernames. Run config definition for the second client:
client2 {
    parent runs.client
    args "--username=Dev2"
}
  1. Enter a test world in the first instance (Dev), open to LAN and join with the second instance (Dev2)
  2. Repeatedly place and break a minecart. I did this as Dev2, but it will probably work with the Dev player as well.

This reproduces the error maybe once in 5-10 place/break cycles. In most (all?) of the other cycles you get an error Received empty payload on channel immersiveengineering:main in the console for Dev2.

I suspect that this is actually a Forge issue rather than one in IE, but I'll need to do more debugging until I can make a proper report to them.

commented

@Derkades can you check if this still happens on the latest Forge build (43.1.53)? MinecraftForge/MinecraftForge#9157 may have fixed this.

commented

Closing this due to lack of response