EsotericSoftware / kryonet

TCP/UDP client/server library for Java, based on Kryo
BSD 3-Clause "New" or "Revised" License
1.81k stars 415 forks source link

Buffer Overflow In KryoNet Trying To Recive A Object Graph #151

Closed ImWuX closed 5 years ago

ImWuX commented 5 years ago

I'm sending an object which contains a 2X45x45 big 3-dimensional array. In every slot, there is a custom object which I also registered in kryonet. It seems to send fine but trying to recive it I keep getting this annoying error,

Exception in thread "Client" com.esotericsoftware.kryonet.KryoNetException: Unable to read object larger than read buffer: 12793 at com.esotericsoftware.kryonet.TcpConnection.readObject(TcpConnection.java:118) at com.esotericsoftware.kryonet.Client.update(Client.java:247) at com.esotericsoftware.kryonet.Client.run(Client.java:333) at java.lang.Thread.run(Unknown Source)

I'm not entirely sure why I am getting it but I've tried increasing the buffer size of the client by doing this in it's constructor,

client = new Client((20 * 1024), 2 * 1024); It doesn't seem to be doing much for me though. I've been trying to troubleshoot this for a while now, this is kind of my last resort. Does anyone have any idea what's going on and how I could solve this?

Also here's the object I'm sending for reference, it really shouldn't matter though since it seems to be sending fine:

public class MapDataPacket {

    public String id;
    public String name;
    public Block[][][] map;

    public MapDataPacket() {

    }

}
ImWuX commented 5 years ago

Fixed it

jcs090218 commented 5 years ago

@WuXeR Can you explain how you fixed this? I am just wondering what was the issue.