I got the latest version of kryo and kryonet to sign properly. Now,
however, the server is throwing the following exception occasionally
and seemingly randomly.. Hundreds of these are output to the server's
console and then it stops and the server continues running normally.
java.lang.IllegalArgumentException
at java.nio.Buffer.position(Buffer.java:
218)
at
com.esotericsoftware.kryonet.TcpConnection.send(TcpConnection.java:
177)
at
com.esotericsoftware.kryonet.Connection.sendTCP(Connection.java:
58)
at
com.esotericsoftware.kryonet.Server.sendToAllTCP(Server.java:
394)
at
server.AllFoursServer.sendConstantMessage(AllFoursServer.java:
153)
at server.AllFoursServer.access$3(AllFoursServer.java:
143)
at server.AllFoursServer$3.run(AllFoursServer.java:128)
During the exception spam, players report all sorts of weird anomalies
like not being able to play a card or the wrong card being played.. I
might have to revert version of kryo and kryonet that I was using
before (the one with the buffer underflow) for the while.
--
You received this message because you are subscribed to the "kryonet-users" group.
http://groups.google.com/group/kryonet-users
To unsubscribe from this group, send email to kryonet-users+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
I see the following in TcpConnection.java in the latest kryonet:
int start = writeBuffer.position();
writeBuffer.position(start + 1); //exception reports this line
According to the javadocs (http://java.sun.com/j2se/1.4.2/docs/api/
java/nio/Buffer.html#position(int)), position(int newPosition) will
throw an IllegalArgumentException if newPosition is negative or
greater than the limit. Are either of these possible? Maybe start is
sometimes equal to the buffer limit and then the call to
position(start + 1) blows up?
To unsubscribe from this group, send email to kryonet-users+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
com.esotericsoftware.kryo.SerializationException: Unable to serialize
object of type: net.messages.ConstantMessage
at
com.esotericsoftware.kryonet.TcpConnection.send(TcpConnection.java:
190)
at
com.esotericsoftware.kryonet.Connection.sendTCP(Connection.java:
58)
at
com.esotericsoftware.kryonet.Server.sendToAllTCP(Server.java:
394)
at
server.AllFoursServer.sendConstantMessage(AllFoursServer.java:
153)
at server.AllFoursServer.access$3(AllFoursServer.java:
143)
at server.AllFoursServer$3.run(AllFoursServer.java:
128)
Caused by: com.esotericsoftware.kryo.SerializationException: Buffer
limit exceeded serializing object of type: net.messa
ges.ConstantMessage
at
com.esotericsoftware.kryo.Kryo.writeClassAndObject(Kryo.java:
352)
at
com.esotericsoftware.kryonet.TcpConnection.send(TcpConnection.java:
183)
... 5
more
Caused by:
java.nio.BufferOverflowException
at java.nio.Buffer.nextPutIndex(Buffer.java:
495)
at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:
245)
at
com.esotericsoftware.kryo.serialize.LongSerializer.put(LongSerializer.java:
53)
at
com.esotericsoftware.kryo.serialize.LongSerializer.writeObjectData(LongSerializer.java:
32)
at
com.esotericsoftware.kryo.Serializer.writeObject(Serializer.java:
41)
at
com.esotericsoftware.kryo.serialize.FieldSerializer.writeObjectData(FieldSerializer.java:
165)
at
com.esotericsoftware.kryo.Kryo.writeClassAndObject(Kryo.java:
348)
... 6 more
On Mar 28, 2:42 am, Nate <nathan.sw...@gmail.com> wrote:
> I agree it is possible for start + 1 to be >= limit. Pretty annoying that
> ByteBuffer throws IllegalArgumentException. It means any time KryoNet
> advances the position it has to do bounds checking, then the ByteBuffer does
> bounds checking for a second time... unless I want to catch
> IllegalArgumentException, which is a bit gross...
>
> Anyway, if start + 1 >= limit, it needs to throw a
> WriteBufferOverflowException exception because it is really a buffer
> overflow. This is caught in Connection#sendTCP, and the connection is
> closed.
>
> Over a long period of time that your server is up, do you see any warnings
> that say, "Write buffer overflow, position/limit/capacity: ..."? If so, then
> I could believe that every once in a while the write buffer happens to be
> filled up exactly by the last object written. This would cause position ==
> limit - 1 and the behavior you describe. The server keeps trying to write an
> object, and keeps blowing up with an IllegalArgumentException until the
> client disconnects.
>
> If you never see that warning, then it is quite unlikely that the last
> object written always fills up the buffer exactly. If this is the case, then
> I would guess that some combination of the objects you are sending have
> found a serialization bug.
>
> On a side note, I wonder if some sort of journal/playback mechanism would be
> useful.
>
> -Nate
>
> On Sat, Mar 27, 2010 at 9:27 PM, Hsaka <akash.harri...@gmail.com> wrote:
> > Hey Nate,
>
> > I see the following in TcpConnection.java in the latest kryonet:
>
> > int start = writeBuffer.position();
> > writeBuffer.position(start + 1); //exception reports this line
>
> > According to the javadocs (http://java.sun.com/j2se/1.4.2/docs/api/
> > java/nio/Buffer.html#position(int)<http://java.sun.com/j2se/1.4.2/docs/api/%0Ajava/nio/Buffer.html#posit...>),
To unsubscribe from this group, send email to kryonet-users+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
I'll let you know how it goes. BTW, is there a logo for kryo/kryonet
that I can include in the game?
Thanks alot.
To unsubscribe from this group, send email to kryonet-users+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Thanks for the logo, I added it.
No exceptions so far (: