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