I have not checked the exact routine, but you need to reexecute read until it returns -1 or if known that all bytes that are expected have been read (if sockCh is based on some kind of input stream)
> Am 26.10.2018 um 04:24 schrieb Michael Fong <mcfong.o...@gmail.com>: > > Bump! > > Anyone who could help me solve this random issue? Thanks! > > Regards, > > > Michael > >> On Wed, Oct 24, 2018 at 10:32 PM Michael Fong <mcfong.o...@gmail.com> wrote: >> >> Hi, all, >> >> >> I was trying to fix IGNITE-7153 which relates to parsing incomplete REDIS >> packet larger than 8192 bytes. However, I found a random problem which is >> reproducible on TC as well. >> That said, GridNioServerRead.processRead() : >> - int cnt = sockCh.read(readBuf); >> >> sometimes does not read the payload fully as the length field in the >> header is larger than the ByteBuffer.limit(). As the result, the >> BufferUnderFlowException will be thrown. >> >> For example, in a erroneous round run with my IDE, a REDIS payload (sent >> by jedis client) looks like the following: >> >> 2a 33 d a 24 33 d a 53 45 54 d a 24 32 d a 62 31 d a 24 {38 31 39 32} d a | >> 65 >> d a ...etc >> >> GridRedisProtocolParser.readBulkStr(buf) invokes elCnt(buf) which gets >> {8192}. However, the limit of buf is 28 which ends at | position. Obviously, >> 8192 < limit(), therefore, the logic throws BufferUnderFlow soon after. >> >> I traced back and found sockCh.read(readBuf) only read 28 bytes for unknown >> reason >> >> The problem seems totally random. I wonder if this has anything to do with >> other NioWorker >> or Selector setting. >> >> >> Any help would be appreciated! >> >> >> Regards, >> >> >> Michael >> >>