netty-socketio icon indicating copy to clipboard operation
netty-socketio copied to clipboard

if ack returns after the timeout trigger ,a IllegalStateException will be thrown

Open BianJianyu opened this issue 1 year ago • 8 comments

version:2.0.9

  1. onTimeout() will remove ackCallback,however ackCallback is necessary while package decoding. file:com/corundumstudio/socketio/ack/AckManager.java line:157 image file:com/corundumstudio/socketio/protocol/PacketDecoder.java line:300 image
  2. if callback is null, the byteBuf will not be read. And the the loop will run second time! file:com/corundumstudio/socketio/handler/InPacketHandler.java line:64 image
  3. however the data in the buffer is already wrong, so it cannot get the right type, and then throw the IllegalStateException file:com/corundumstudio/socketio/protocol/PacketType.java line:42 image

BianJianyu avatar Mar 08 '24 09:03 BianJianyu

if (callback != null) { ByteBufInputStream in = new ByteBufInputStream(frame); AckArgs args = jsonSupport.readAckArgs(in, callback); packet.setData(args.getArgs()); }else { frame.clear(); } what if I write it like this? @mrniko #965

malinGH avatar Mar 11 '24 07:03 malinGH

3A6E8155-C3B6-41e6-BD11-3EAC9929600D E853EA39-0E46-411E-83D0-1540D3F19ADE this is test result ,nothing exception

malinGH avatar Mar 19 '24 13:03 malinGH

@malinGH

What about the case then there are other packets next to this packet? they won't be parsed if bytebuf readIndex reset to zero

mrniko avatar Mar 22 '24 05:03 mrniko

It's better to use the code below.

frame.skipBytes(frame.readableBytes());

Now the buffer was consumed completely.

mrniko avatar Mar 22 '24 05:03 mrniko

let me try

malinGH avatar Mar 26 '24 10:03 malinGH

@mrniko Test is fail, You need to test this version, branch:master 截屏2024-03-27 15 53 23

malinGH avatar Mar 27 '24 02:03 malinGH

截屏2024-03-27 15 57 26

malinGH avatar Mar 27 '24 07:03 malinGH

6437A52C-EE5F-437a-B958-1BCE6E44AAAC

malinGH avatar Mar 27 '24 07:03 malinGH