ably/ably-java

onMessage Exception

zhangyongjiang opened this issue · 3 comments

Stack Trace:

(ERROR): io.ably.lib.transport.WebSocketTransport: Unexpected exception processing received binary message
io.ably.lib.types.AblyException: java.lang.IndexOutOfBoundsException: toIndex = 9
at io.ably.lib.types.AblyException.fromThrowable(AblyException.java:54)
at io.ably.lib.transport.ConnectionManager.onMessage(ConnectionManager.java:1187)
at io.ably.lib.transport.WebSocketTransport.receive(WebSocketTransport.java:104)
at io.ably.lib.transport.WebSocketTransport$WsClient.onMessage(WebSocketTransport.java:198)
at org.java_websocket.client.WebSocketClient.onWebsocketMessage(WebSocketClient.java:641)
at org.java_websocket.drafts.Draft_6455.processFrameBinary(Draft_6455.java:959)
at org.java_websocket.drafts.Draft_6455.processFrame(Draft_6455.java:912)
at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:401)
at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:233)
at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:516)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.IndexOutOfBoundsException: toIndex = 9
at java.base/java.util.AbstractList.subListRangeCheck(AbstractList.java:507)
at java.base/java.util.ArrayList.subList(ArrayList.java:1108)
at io.ably.lib.transport.ConnectionManager$PendingMessageQueue.ack(ConnectionManager.java:1698)
at io.ably.lib.transport.ConnectionManager.onAck(ConnectionManager.java:1318)
at io.ably.lib.transport.ConnectionManager.onMessage(ConnectionManager.java:1173)
... 9 more

┆Issue is synchronized with this Jira Bug by Unito

Thanks for the bug report @zhangyongjiang; the SDK definitely shouldn't be crashing. A couple of questions which will help us to investigate:

  1. Please could you tell us your steps to reproduce? Is it something that you can reproduce consistently?
  2. It looks like you're using ably-java 1.2.38, is that right?

@lawrence-forooghian
Yes, we are using ably-java 1.2.38.
I cannot reproduce the bug always. You may try these steps back and forth.

  1. create few ably realtime instances,
  2. for each ably realtime instance
  • subscribe to a channel (same channel for all instances).
  • use a thread to publish messages to the channel every 10 seconds
  1. disconnect the network (turn off wifi) for few minutes
  2. turn on network, wait for couple minutes
  3. repeat step 6 and 7

Hey @zhangyongjiang,

We have released version 1.2.39 of ably-java, which includes a fix for the reported issue. If you continue to experience the problem after updating, please feel free to reopen the issue.