BufferOverflowException

52 views
Skip to first unread message

nancy debruyne

unread,
Jun 8, 2014, 6:54:59 PM6/8/14
to kryone...@googlegroups.com
Hello all,

Having some problems with sending an packet (with an int).

This is my code: http://pastebin.com/UkRSK2zc
The problem is at line 12, where I'm getting following exception:

Exception in thread "Server" java.nio.BufferOverflowException
    at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:183)
    at com.esotericsoftware.kryo.io.ByteBufferOutputStream.write(ByteBufferOutputStream.java:42)
    at com.esotericsoftware.kryo.io.Output.flush(Output.java:154)
    at com.esotericsoftware.kryonet.KryoSerialization.write(KryoSerialization.java:51)
    at com.esotericsoftware.kryonet.TcpConnection.send(TcpConnection.java:192)
    at com.esotericsoftware.kryonet.Connection.sendTCP(Connection.java:59)
    at x.ServerHandler.sendTileData(ServerHandler.java:71)
    at x.ServerHandler.received(ServerHandler.java:33)
    at com.esotericsoftware.kryonet.Server$1.received(Server.java:61)
    at com.esotericsoftware.kryonet.Connection.notifyReceived(Connection.java:246)
    at com.esotericsoftware.kryonet.Server.update(Server.java:208)
    at com.esotericsoftware.kryonet.Server.run(Server.java:356)
    at java.lang.Thread.run(Thread.java:722)

I'm suspecting there is something going wrong with the x and y values. The buffer overflows are happening when the x value is > 70. I have no idea what is causing this.

The packet that is being sent is just int x, int y, String id.

Hope anyone can help.

Thanks

Nate

unread,
Jun 8, 2014, 6:57:34 PM6/8/14
to kryone...@googlegroups.com
Turn on Kryo's debug or trace logging and see what is being serialized.

-Nate


--
You received this message because you are subscribed to the "kryonet-users" group.
http://groups.google.com/group/kryonet-users
---
You received this message because you are subscribed to the Google Groups "kryonet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kryonet-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

nancy debruyne

unread,
Jun 9, 2014, 4:30:20 AM6/9/14
to kryone...@googlegroups.com
I tried that, but it is killing my console. And since it only happens after a certain x value, it is quite impossible to see the log when it crashes.
Is there a possibility to output to a file?

Op maandag 9 juni 2014 00:57:34 UTC+2 schreef Nate:

Nate

unread,
Jun 9, 2014, 4:39:25 AM6/9/14
to kryone...@googlegroups.com
Direct stdout to a file.


James Hooker

unread,
Jun 9, 2014, 4:39:43 AM6/9/14
to kryone...@googlegroups.com
You should be able to pipe it out to a file using '>'..i.e java -jar server.jar > output.msg 2> output.err. This will output stdout output to 'output.msg', and stderr output to 'output.err' for further inspection.

nancy debruyne

unread,
Jun 9, 2014, 5:01:53 AM6/9/14
to kryone...@googlegroups.com
Okay, I tried it with the file. For some reason the server doesn't work properly when outputting to a file. Is it possible that it is because I'm sending way too much packets in one time? I'm sending 1024 packets all in once.

nancy debruyne

unread,
Jun 9, 2014, 5:07:02 AM6/9/14
to kryone...@googlegroups.com
I think the problem is at the amount of packets being send. I decreased the packet size a lot (from 16 * 64 to 16 * 20) and the issue seems gone. I think I probably squeeze all tile data as an array in the chunk data packet. Not sure. I tried that before, but it was giving me errors of packet sizes being too big.
Reply all
Reply to author
Forward
0 new messages