BufferOverFlowException for ExtensionResponse

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

boourns
Posts: 14
Joined: 26 Apr 2012, 16:45

BufferOverFlowException for ExtensionResponse

Postby boourns » 27 Jun 2012, 10:46

I'm sending an SFSObject as a part of an EXTENSION_RESPONSE to an Android client.
The EXTENSION_RESPONSE is sent to the client from within the ROOM_JOIN handler on the server side

The EXTENSION_RESPONSE event never gets fired on the client side.
I have applied the patch from last month to the server so I don't know what to try next.

Code: Select all

 ERROR sfs2x.client.core.sockets.TCPSocketLayer - TCPSocketLayer: Socket error: android/util/Log
5181 [New I/O client worker #1-1] INFO sfs2x.client.core.EventDispatcher - Dispatching event OnError to 1 listeners
5181 [New I/O client worker #1-1] INFO sfs2x.client.core.EventDispatcher - Dispatching event ioError to 1 listeners
5181 [New I/O client worker #1-1] INFO sfs2x.client.core.EventDispatcher - Dispatching event OnDisconnect to 1 listeners
5181 [New I/O client worker #1-1] INFO sfs2x.client.core.EventDispatcher - Dispatching event OnData to 1 listeners
5181 [New I/O client worker #1-1] INFO sfs2x.client.core.SFSIOHandler - Handling Data: 357, previous state: 18017/966
java.nio.BufferOverflowException
   at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:165)
   at java.nio.ByteBuffer.put(ByteBuffer.java:813)
   at sfs2x.client.util.ByteArray.writeBytes(ByteArray.java:169)
   at sfs2x.client.core.SFSIOHandler.writeBytes(SFSIOHandler.java:448)
   at sfs2x.client.core.SFSIOHandler.handlePacketData(SFSIOHandler.java:267)
   at sfs2x.client.core.SFSIOHandler.onDataRead(SFSIOHandler.java:130)
   at sfs2x.client.bitswarm.BitSwarmClient.onSocketData(BitSwarmClient.java:357)
   at sfs2x.client.bitswarm.BitSwarmClient.access$200(BitSwarmClient.java:26)
   at sfs2x.client.bitswarm.BitSwarmClient$3.dispatch(BitSwarmClient.java:105)
   at sfs2x.client.core.EventDispatcher.dispatchEvent(EventDispatcher.java:52)
   at sfs2x.client.core.sockets.TCPSocketLayer.callOnData(TCPSocketLayer.java:144)
   at sfs2x.client.core.sockets.TCPSocketLayer.handleBinaryData(TCPSocketLayer.java:138)
   at sfs2x.client.core.sockets.TCPSocketLayer.access$700(TCPSocketLayer.java:23)
   at sfs2x.client.core.sockets.TCPSocketLayer$NettyIOHandler.messageReceived(TCPSocketLayer.java:273)
   at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:100)
   at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
   at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:540)
   at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
   at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
   at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:350)
   at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:281)
   at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:201)
   at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
   at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:680)
5184 [New I/O client worker #1-1] ERROR sfs2x.client.core.SFSIOHandler - Error handling data: null
5184 [New I/O client worker #1-1] ERROR sfs2x.client.bitswarm.BitSwarmClient - ## SocketDataError: null
5184 [New I/O client worker #1-1] INFO sfs2x.client.core.EventDispatcher - Dispatching event dataError to 1 listeners
5184 [New I/O client worker #1-1] INFO sfs2x.client.core.EventDispatcher - Dispatching event socketError to 1 listeners
5696 [New I/O client worker #1-1] INFO sfs2x.client.core.EventDispatcher - Dispatching event OnData to 1 listeners
5696 [New I/O client worker #1-1] ERROR sfs2x.client.bitswarm.BitSwarmClient - ## SocketDataError: null
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: BufferOverFlowException for ExtensionResponse

Postby rjgtav » 27 Jun 2012, 11:14

Hi. How big is the SFSObject you're trying to send? Can you try sending it in smaller parts?
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
boourns
Posts: 14
Joined: 26 Apr 2012, 16:45

Re: BufferOverFlowException for ExtensionResponse

Postby boourns » 27 Jun 2012, 12:10

Hi,
To test I removed everything I was adding and just put a an int value in, so the response is tiny.

I get the same error.
The chunk of data I was sending was small, a few hundred bytes.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: BufferOverFlowException for ExtensionResponse

Postby rjgtav » 27 Jun 2012, 14:37

Are you running the latest server patch 2.1.0 alongside with latest Java Android API?
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
boourns
Posts: 14
Joined: 26 Apr 2012, 16:45

Re: BufferOverFlowException for ExtensionResponse

Postby boourns » 04 Sep 2012, 10:30

This issue turned out to be caused by logging.
There was an android Log.e() call which was stopping everything.

When we took out the Log call it worked. Should have copped the "android/util/Log" but the TCPSocketLayer bit threw me off.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: BufferOverFlowException for ExtensionResponse

Postby rjgtav » 04 Sep 2012, 10:36

Glad you found the problem ;)
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Majestic-12 [Bot] and 51 guests