Jump to content

[1.8.9] [SOLVED] Packet too long..?


LEGOlord208

Recommended Posts

I have done tons of research based on this error:

It seems to come when I send a too long packet from the server.

If I shorten it it works.

Also I tried "shortening" it (just an attempt) by converting to Base64.

 

Code for getting packet:

public void fromBytes(ByteBuf buf){
	System.out.println("Error...?");
	message = new String(Base64.getDecoder().decode(ByteBufUtils.readUTF8String(buf)),
			StandardCharsets.UTF_;
	System.out.println("Finished the creepy code");
}

 

In the console, I of course get the first packets sent:

:36]: Error...?
[09:22:54] [Netty Client IO #1/INFO] [sTDOUT]: [com.legolord208.pistoncraft.connection.StringPacket:fromBytes:39]: Finished the creepy code
[09:22:54] [Netty Client IO #1/INFO] [sTDOUT]: [com.legolord208.pistoncraft.connection.StringPacket:fromBytes:36]: Error...?
[09:22:54] [Netty Client IO #1/INFO] [sTDOUT]: [com.legolord208.pistoncraft.connection.StringPacket:fromBytes:39]: Finished the creepy code

No problems there.

 

Then the big beast comes (it's really not that long though)

fromBytes:36]: Error...?
[09:23:04] [Netty Client IO #1/ERROR] [FML]: FMLIndexedMessageCodec exception caught
io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: index: 2, length: 11452 (expected: range(0, 189))

 

Whole error message is pasted here:

 

[09:23:04] [Netty Client IO #1/ERROR] [FML]: FMLIndexedMessageCodec exception caught
io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: index: 2, length: 11452 (expected: range(0, 189))
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:4.0.23.Final]
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) [DefaultChannelPipeline.class:4.0.23.Final]
at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:4.0.23.Final]
at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:90) [FMLProxyPacket.class:?]
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:158) [NetworkManager.class:?]
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:54) [NetworkManager.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [simpleChannelInboundHandler.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleClientSideCustomPacket(NetworkDispatcher.java:389) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:255) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:53) [NetworkDispatcher.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [simpleChannelInboundHandler.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163) [byteToMessageDecoder.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163) [byteToMessageDecoder.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163) [byteToMessageDecoder.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHandler.java:150) [ReadTimeoutHandler.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) [DefaultChannelPipeline.class:4.0.23.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:130) [AbstractNioByteChannel$NioByteUnsafe.class:4.0.23.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [NioEventLoop.class:4.0.23.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [NioEventLoop.class:4.0.23.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [NioEventLoop.class:4.0.23.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [NioEventLoop.class:4.0.23.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [singleThreadEventExecutor$2.class:4.0.23.Final]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_73]
Caused by: java.lang.IndexOutOfBoundsException: index: 2, length: 11452 (expected: range(0, 189))
at io.netty.buffer.AbstractByteBuf.checkIndex(AbstractByteBuf.java:1143) ~[AbstractByteBuf.class:4.0.23.Final]
at io.netty.buffer.SlicedByteBuf.nioBuffer(SlicedByteBuf.java:261) ~[slicedByteBuf.class:4.0.23.Final]
at io.netty.buffer.AbstractByteBuf.toString(AbstractByteBuf.java:964) ~[AbstractByteBuf.class:4.0.23.Final]
at net.minecraftforge.fml.common.network.ByteBufUtils.readUTF8String(ByteBufUtils.java:119) ~[byteBufUtils.class:?]
at com.legolord208.pistoncraft.connection.StringPacket.fromBytes(StringPacket.java:37) ~[stringPacket.class:?]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:17) ~[simpleIndexedCodec.class:?]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:7) ~[simpleIndexedCodec.class:?]
at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:85) ~[FMLIndexedMessageToMessageCodec.class:?]
at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:21) ~[FMLIndexedMessageToMessageCodec.class:?]
at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:4.0.23.Final]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:4.0.23.Final]
... 40 more
[09:23:04] [Netty Client IO #1/ERROR] [FML]: SimpleChannelHandlerWrapper exception
io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: index: 2, length: 11452 (expected: range(0, 189))
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:4.0.23.Final]
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) [DefaultChannelPipeline.class:4.0.23.Final]
at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:4.0.23.Final]
at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:90) [FMLProxyPacket.class:?]
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:158) [NetworkManager.class:?]
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:54) [NetworkManager.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [simpleChannelInboundHandler.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleClientSideCustomPacket(NetworkDispatcher.java:389) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:255) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:53) [NetworkDispatcher.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [simpleChannelInboundHandler.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163) [byteToMessageDecoder.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163) [byteToMessageDecoder.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163) [byteToMessageDecoder.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHandler.java:150) [ReadTimeoutHandler.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) [DefaultChannelPipeline.class:4.0.23.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:130) [AbstractNioByteChannel$NioByteUnsafe.class:4.0.23.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [NioEventLoop.class:4.0.23.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [NioEventLoop.class:4.0.23.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [NioEventLoop.class:4.0.23.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [NioEventLoop.class:4.0.23.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [singleThreadEventExecutor$2.class:4.0.23.Final]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_73]
Caused by: java.lang.IndexOutOfBoundsException: index: 2, length: 11452 (expected: range(0, 189))
at io.netty.buffer.AbstractByteBuf.checkIndex(AbstractByteBuf.java:1143) ~[AbstractByteBuf.class:4.0.23.Final]
at io.netty.buffer.SlicedByteBuf.nioBuffer(SlicedByteBuf.java:261) ~[slicedByteBuf.class:4.0.23.Final]
at io.netty.buffer.AbstractByteBuf.toString(AbstractByteBuf.java:964) ~[AbstractByteBuf.class:4.0.23.Final]
at net.minecraftforge.fml.common.network.ByteBufUtils.readUTF8String(ByteBufUtils.java:119) ~[byteBufUtils.class:?]
at com.legolord208.pistoncraft.connection.StringPacket.fromBytes(StringPacket.java:37) ~[stringPacket.class:?]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:17) ~[simpleIndexedCodec.class:?]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:7) ~[simpleIndexedCodec.class:?]
at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:85) ~[FMLIndexedMessageToMessageCodec.class:?]
at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:21) ~[FMLIndexedMessageToMessageCodec.class:?]
at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:4.0.23.Final]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:4.0.23.Final]
... 40 more
[09:23:04] [Netty Client IO #1/ERROR] [FML]: There was a critical exception handling a packet on channel pc
io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: index: 2, length: 11452 (expected: range(0, 189))
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:4.0.23.Final]
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) ~[DefaultChannelPipeline.class:4.0.23.Final]
at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:4.0.23.Final]
at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:90) [FMLProxyPacket.class:?]
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:158) [NetworkManager.class:?]
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:54) [NetworkManager.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [simpleChannelInboundHandler.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleClientSideCustomPacket(NetworkDispatcher.java:389) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:255) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:53) [NetworkDispatcher.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [simpleChannelInboundHandler.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163) [byteToMessageDecoder.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163) [byteToMessageDecoder.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163) [byteToMessageDecoder.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHandler.java:150) [ReadTimeoutHandler.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) [DefaultChannelPipeline.class:4.0.23.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:130) [AbstractNioByteChannel$NioByteUnsafe.class:4.0.23.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [NioEventLoop.class:4.0.23.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [NioEventLoop.class:4.0.23.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [NioEventLoop.class:4.0.23.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [NioEventLoop.class:4.0.23.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [singleThreadEventExecutor$2.class:4.0.23.Final]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_73]
Caused by: java.lang.IndexOutOfBoundsException: index: 2, length: 11452 (expected: range(0, 189))
at io.netty.buffer.AbstractByteBuf.checkIndex(AbstractByteBuf.java:1143) ~[AbstractByteBuf.class:4.0.23.Final]
at io.netty.buffer.SlicedByteBuf.nioBuffer(SlicedByteBuf.java:261) ~[slicedByteBuf.class:4.0.23.Final]
at io.netty.buffer.AbstractByteBuf.toString(AbstractByteBuf.java:964) ~[AbstractByteBuf.class:4.0.23.Final]
at net.minecraftforge.fml.common.network.ByteBufUtils.readUTF8String(ByteBufUtils.java:119) ~[byteBufUtils.class:?]
at com.legolord208.pistoncraft.connection.StringPacket.fromBytes(StringPacket.java:37) ~[stringPacket.class:?]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:17) ~[simpleIndexedCodec.class:?]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:7) ~[simpleIndexedCodec.class:?]
at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:85) ~[FMLIndexedMessageToMessageCodec.class:?]
at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:21) ~[FMLIndexedMessageToMessageCodec.class:?]
at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:4.0.23.Final]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:4.0.23.Final]
... 40 more

 

And if you prefer pastebin: http://pastebin.com/yAipirFJ

 

Notice that the "Finished the Creepy code" is (obviously) never printed at last.

And if I ever helped anyone with anything, let me know

I am a noob in forge

Link to comment
Share on other sites

Erm.. I did not fully understand that  ;D

I read data when they were sent by the server.

When player join:

 

- Send secret joining message

- Send info about players

 

When I do a command

 

- Send data

 

And that last bit is the error. If the data sent when I do the command is a little bit smaller everything works.

For example I removing ONE CHARACTER... And that worked, but then... I do need that character and also the size of the text varies. I guess I could try to send them in different sets but that would require some heavy code from me. Feels like this shouldn't be a problem. The string isn't more than around 50 - 100 characters long...

And if I ever helped anyone with anything, let me know

I am a noob in forge

Link to comment
Share on other sites

Hmmmm I wanted to avoid this, but ok!

 

Trust me, I've coded Java for two years, it's not some magical error by registering the methods wrong. I am using eclipse also which tells me (Eclipse, I am probably the first one to use it.... right.... lel #Irony).

 

I am only goin to paste the long things on pastebin.

 

Variable:

public static SimpleNetworkWrapper network;

 

On init:

network = NetworkRegistry.INSTANCE.newSimpleChannel(/*CENSORED CHANNEL*/);

 

Now registering the packet:

network.registerMessage(Handler.class, StringPacket.class, 0, Side.CLIENT);

 

StringPacket:

http://pastebin.com/6hk9i1Kb

The error should be on line 20,

ByteBufUtils.readUTF8String(buf)

I removed the debugging lines though.

 

Handler- onMessage:

public IMessage onMessage(StringPacket message, MessageContext ctx){
	Minecraft.getMinecraft().addScheduledTask(() -> {

 

 

15253786530th time's EDIT: I am using the latest, 1.8.9 - 11.15.1.1763

And if I ever helped anyone with anything, let me know

I am a noob in forge

Link to comment
Share on other sites

How long is the string you are sending? You may have to split it up and send 2 packets after a certain length, but it takes a LOT of data to reach that point.

 

Also, why are you encoding it to base 64? You can read and write directly:

ByteBufUtils.writeUTF8String(buffer, this.message);

this.message = ByteBufUtils.readUTF8String(buffer);

Link to comment
Share on other sites

Sorry, but I did say why in the main post:

Also I tried "shortening" it (just an attempt) by converting to Base64.

It was an ATTEMPT, and I thought it didn't hurt to leave it there until the bug was fixed.

And if I ever helped anyone with anything, let me know

I am a noob in forge

Link to comment
Share on other sites

This is actually not a crash from a too long package, otherwise it would mention about something like the 32k border. Assuming you defenitly wont pass that point.

 

The actual problem is that you decode the recieved buffer wrong. Reading should be done in the exact same order as Writing. (Might have confused mc's read/write String method with the java's Buffer one). Your attempt to decrease the size of the packets are defenitly not helping in this case. So pharaps the 'bigger' packets you are sending are read in a different way than you are writing them

 

I hope this helps you a bit in the right direction.

Projects:

Discontinued:

- N2ConfigAPI

- Meachanical Crafting Table

 

Latest:

- CollectionUtils

 

Coöperations:

- InGameConfigManager

Link to comment
Share on other sites

Hmmmm true! Myself I had that idea a while ago, but I stopped because it wokedmwith small messages. From Bukkit, I use the Java buffer, because Bukkit does not have ByeByfUtils. I also tried String.getBytes() which was a failure. I have not clue what else to use in Bukkit.

And if I ever helped anyone with anything, let me know

I am a noob in forge

Link to comment
Share on other sites

What is the exact problem right now? You dont use the bukkit (partially?) system for some reason, so why not using the mc system instead? (If fixing read/write methods isnt possible?).

 

I would like to help, but right now I have no clear vision of your goal is. Besides, if there is no (complete) code of what you have tried already, its nearly impossible to help solving this bug.

 

So could you explain exactly what problem is still standing. And post some code of the things you have tried already.

Projects:

Discontinued:

- N2ConfigAPI

- Meachanical Crafting Table

 

Latest:

- CollectionUtils

 

Coöperations:

- InGameConfigManager

Link to comment
Share on other sites

I am sorry for the incovenience.

 

It looks like it's a problem with the encoding on the server side, which isn't Forge.

(You are the one spotting it, when I gave up on that idea before even posting)

 

Theoratically I should close this thread and open one on Bukkit instead.

 

I am using Bukkit on the server because the mod is optional.

 

I have tried to instead of sending from Java Byte Array Output Stream, send from String.getBytes() and explored ByteBuf.

The problem is that Bukkit seems to only have some of the Netty IO functions, not ByteBufUtils.

That makes me forced to use another system.

 

I have, just a very silly attempt, tried to convert the String to UTF-8.

Though, it doesn't work on the long string.

 

It's really weird, because I have no problems unless the encoded String is too long.

(You also gave an explaintion on this part)

 

The encoded String is not longer than double of the current URL in your browser.

(Assuming it's on the Minecraft Forge websites, which have pretty long URL's)

 

 

EDIT: Sorry for the very late answer. I got a 503 error for 10 minutes and had to wait for MinecraftForge to fix it

EDIT #2: When I first added this to the mod it worked like a charm... If I'm not mistaken it could have something to do with me updating it to 1.8.9 instead of 1.8, which pretty much proofs it's not a server error.....

And if I ever helped anyone with anything, let me know

I am a noob in forge

Link to comment
Share on other sites

So you are not 'writing' the messages? In that case you would need to use the bukkit/NettyIO system for reading. (Unfortunatly Im not verry familar with bukkit, though Im sure youll get it right.)

 

As for the 'longer messages crash', it is pretty wierd, either they are writtin differently, or this is a bug from Netty. Not sure wich version is used by MC right now. Though it sounds rather familar, I believe that a simular problem made me choose to use the java BufferUtils system instead (as I would advise you to use it as well, if possible).

 

Finally, have you updated the mod from 1.7 to 1.8 or 1.8 to 1.8.9?

In the fisrt case, recieving messages is moved to a sideThread. Otherwise no major changes have been made. Unless bukkit has changes their system, but you would know that better than me!

 

I hope this us enough info for you to go on, since I have no clue what else can be done, unless there is a flaw in your code(which I cannot see from here :P)

Projects:

Discontinued:

- N2ConfigAPI

- Meachanical Crafting Table

 

Latest:

- CollectionUtils

 

Coöperations:

- InGameConfigManager

Link to comment
Share on other sites

So you are not 'writing' the messages?

I am the one writing the messages.

 

use the bukkit/NettyIO system for reading

Either way that sounds like a plan!

Is it better to change the server side?

 

Finally, have you updated the mod from 1.7 to 1.8 or 1.8 to 1.8.9?

 

From 1.8 to 1.8.9

 

EDIT: Removed irrelevant parts

 

EDIT #2:

 

Bukkit encoding code:

 

ByteArrayOutputStream bytes = new ByteArrayOutputStream();
	DataOutputStream stream = new DataOutputStream(bytes);
	try{
		stream.writeUTF(str);
		stream.flush();
	}
	catch(IOException e){
		e.printStackTrace();
	}
	finally{
		try{
			stream.close();
		}
		catch(IOException e){
			e.printStackTrace();
		}
	}
	return bytes.toByteArray();

 

http://pastebin.com/SDZ5615S

 

EDIT #3:

MUCH easier way (still giving errors on long strings though)

 

ByteArrayDataOutput bytes = ByteStreams.newDataOutput();
	bytes.writeUTF(str);
	return bytes.toByteArray();

And if I ever helped anyone with anything, let me know

I am a noob in forge

Link to comment
Share on other sites

Thats what I was afraid of. The writeUTF (UTF16) method is not compatible with readUTF8String (UTF8). Use either readUTF or writeUTF8String instead.

 

Ps. Dont change both parts, or the same problem will occure again :P.

Projects:

Discontinued:

- N2ConfigAPI

- Meachanical Crafting Table

 

Latest:

- CollectionUtils

 

Coöperations:

- InGameConfigManager

Link to comment
Share on other sites

Ps. Dont change both parts, or the same problem will occure again :P.

 

LOLOLOL

 

Use either readUTF or writeUTF8String instead

writeUTF8String doesn't exist in Bukkit, so I guess I'll have to change the client.

 

EDIT: I don't see any way to read UTF-16 yet though

 

EDIT #2: I found one, but it doesn't seem to work. I gotta go too. I'll mark this as solved when I find something

And if I ever helped anyone with anything, let me know

I am a noob in forge

Link to comment
Share on other sites

So now the filesize is too long :(

 

ByteBufInputStream i = new ByteBufInputStream(buf);
	try{
		message = i.readUTF();
	}
	catch(IOException e){
		e.printStackTrace();
	}
	finally{
		try{
			i.close();
		}
		catch(IOException e){
			e.printStackTrace();
		}
	}

 

Gives the error messages

 

omBytes:27]: java.io.EOFException: fieldSize is too long! Length is 35939, but maximum is 139
at io.netty.buffer.ByteBufInputStream.checkAvailable(ByteBufInputStream.java:253)
at io.netty.buffer.ByteBufInputStream.readFully(ByteBufInputStream.java:174)
at java.io.DataInputStream.readUTF(Unknown Source)
at io.netty.buffer.ByteBufInputStream.readUTF(ByteBufInputStream.java:228)
at com.legolord208.pistoncraft.connection.StringPacket.fromBytes(StringPacket.java:24)
at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:17)
at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:7)
at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:85)
at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:21)
at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89)
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787)
at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169)
at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:90)
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:158)
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:54)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleClientSideCustomPacket(NetworkDispatcher.java:389)
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:255)
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:53)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
at io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHandler.java:150)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:130)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
at java.lang.Thread.run(Unknown Source)

And if I ever helped anyone with anything, let me know

I am a noob in forge

Link to comment
Share on other sites

Just look at what writeUTF8String does, it is pretty straightforward

1. I was just gonna post that I fixed it lol

2. I did a bunch of times.

 

 while ((toWrite & -128) != 0)
        {
            to.writeByte(toWrite & 127 | 128);
            toWrite >>>= 7;
        }

That is not what I call "Straight Forward".

 

 

FIX:

 

1.

 

Sendning. From Bukkit, send

ByteArrayDataOutput b = ByteStreams.newDataOutput();
	b.writeUTF(str);
	return b.toByteArray();

 

2.

 

Recieving. In forge, break the rules and make up your own:

 

ByteArrayDataInput input = ByteStreams.newDataInput(buf.array());
	message = input.readUTF();

 

If somebody thinks "Hey lego why not String.getBytes and new String() instead?? Stopid lego guy"

Answer: I tried. Forge complains when recieving because the discriminator is missing.

And if I ever helped anyone with anything, let me know

I am a noob in forge

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.