GeyserMC / MCProtocolLib

A library for communication with a Minecraft client/server.
MIT License
723 stars 201 forks source link

Failed to read chunk data. #198

Closed minecraftkeba closed 7 years ago

minecraftkeba commented 7 years ago

io.netty.handler.codec.DecoderException: java.io.IOException: Failed to read chunk data. at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:347) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:230) at io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103) at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:84) at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153) at io.netty.channel.PausableChannelEventExecutor.invokeChannelRead(PausableChannelEventExecutor.java:86) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:389) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:243) at io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103) at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:84) at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153) at io.netty.channel.PausableChannelEventExecutor.invokeChannelRead(PausableChannelEventExecutor.java:86) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:389) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:243) at io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103) at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:84) at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153) at io.netty.channel.PausableChannelEventExecutor.invokeChannelRead(PausableChannelEventExecutor.java:86) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:389) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:243) at io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103) at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:84) at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153) at io.netty.channel.PausableChannelEventExecutor.invokeChannelRead(PausableChannelEventExecutor.java:86) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:389) at io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHandler.java:149) at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:84) at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153) at io.netty.channel.PausableChannelEventExecutor.invokeChannelRead(PausableChannelEventExecutor.java:86) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:389) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:956) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:127) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:514) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:471) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:385) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:351) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) at io.netty.util.internal.chmv8.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1412) at io.netty.util.internal.chmv8.ForkJoinTask.doExec(ForkJoinTask.java:280) at io.netty.util.internal.chmv8.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:877) at io.netty.util.internal.chmv8.ForkJoinPool.scan(ForkJoinPool.java:1706) at io.netty.util.internal.chmv8.ForkJoinPool.runWorker(ForkJoinPool.java:1661) at io.netty.util.internal.chmv8.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:126) Caused by: java.io.IOException: Failed to read chunk data. at org.spacehq.mc.protocol.util.NetUtil.readColumn(NetUtil.java:267) at org.spacehq.mc.protocol.util.NetUtil.readColumn(NetUtil.java:265) at org.spacehq.mc.protocol.packet.ingame.server.world.ServerChunkDataPacket.read(ServerChunkDataPacket.java:41) at org.spacehq.packetlib.tcp.TcpPacketCodec.decode(TcpPacketCodec.java:41) at io.netty.handler.codec.ByteToMessageCodec$1.decode(ByteToMessageCodec.java:42) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:316) ... 42 more Caused by: java.lang.IllegalArgumentException: BitsPerEntry cannot be outside of accepted range. at org.spacehq.mc.protocol.data.game.chunk.FlexibleStorage.(FlexibleStorage.java:17) at org.spacehq.mc.protocol.data.game.chunk.BlockStorage.(BlockStorage.java:39) at org.spacehq.mc.protocol.util.NetUtil.readColumn(NetUtil.java:247)

This is the error code, as it has nothing to do with the function of my client this must be an error of the api.

Hope you can fix ii

Thanks

Lukario45 commented 7 years ago

What are you trying to read?

phase commented 7 years ago

Can you give code to reproduce this?

minecraftkeba commented 7 years ago

I got it to work by removing the non working part of the api. Cause this is not chnaging the function of my client, it´s not a problem for me.

PS: Using the 1.8 version of the api

On 14 November 2016 at 22:16, Jadon Fowler notifications@github.com wrote:

Can you give code to reproduce this?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Steveice10/MCProtocolLib/issues/198#issuecomment-260465218, or mute the thread https://github.com/notifications/unsubscribe-auth/AMWuFeoJW-9Qrxss33PHayNDaYkUUipHks5q-M_EgaJpZM4KR87g .

ghost commented 7 years ago

I'm having the same exact problem and I'm using the latest main build. For whatever reason randomly this error will occur even with the client not moving.

minecraftkeba commented 7 years ago

Correct, BUT I know that I occurs when the client gets teleported between 2 worlds.

On 19 November 2016 at 08:56, Michael notifications@github.com wrote:

I'm having the same exact problem and I'm using the latest main build. For whatever reason randomly this error will occur even with the client not moving.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Steveice10/MCProtocolLib/issues/198#issuecomment-261700016, or mute the thread https://github.com/notifications/unsubscribe-auth/AMWuFW6Q48nsut8ccjPFyxPiTjQgaU1dks5q_qvIgaJpZM4KR87g .

ghost commented 7 years ago

Just tested and this is exactly what's causing it as for my case when the bot gets sent to the afk world it gives the error. I fixed it by taking out line 41 in the class ServerChunkDataPacket. https://github.com/Steveice10/MCProtocolLib/blob/master/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerChunkDataPacket.java Edit: Only happening when I go to a world that is the end? Possibly happens when going to the nether as well.

ghost commented 7 years ago

@Steveice10 can somewhat confirm, as I'm using the MC 1.10 version. I fixed it by just commenting out "this.column = NetUtil.readColumn(data, x, z, fullChunk, false, chunkMask, tileEntities);" in https://github.com/Steveice10/MCProtocolLib/blob/master/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerChunkDataPacket.java .

ghost commented 7 years ago

@Steveice10 just tested with the most recent build and it still crashes. The error its giving is that its failing to read the chunk data.

ghost commented 7 years ago

@Steveice10 I did not duplicate the code as I'm using the jar version currently.

wgaylord commented 7 years ago

I can not duplicate this. (Only problem I have with 1.11 one is that while I am handling the ChunkData stuff it eventually disconnects for on apparent reason)