Hi,

I have successfully emulated a the packets to Ignite via pure Socket
connection per your request. Please let me know if this could help locate
the root cause of the problem. Thank you. Regards.


public void testSendingRawRedisSocket() throws Exception  {

    Socket socket = new Socket();
    socket = new Socket();

    socket.setReuseAddress(true);
    socket.setKeepAlive(true); // Will monitor the TCP connection is
    socket.setTcpNoDelay(true); // Socket buffer Whetherclosed, to
    // ensure timely delivery of data
    socket.setSoLinger(true, 0); // Control calls close () method,

    socket.connect(new InetSocketAddress("127.0.0.1", 6379), 2000);
    OutputStream outputStream = socket.getOutputStream();

    //In the content of ByteBuffer, GridNioServer.processRead() has
only read() partial data                                 ^- where
ByteBuffer index ends
    //2a 31 d a 24 34 d a 50 49 4e 47 d a 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|0 0 0 0 0 0 0
0 0 0 0 0 0 ...........

    byte[] errorRawPayload = new byte[]{0x2a, 0x31, 0xd, 0xa, 0x24,
0x34, 0xd, 0xa, 0x50, 0x49, 0x4e, 0x47, 0xd, 0xa, 0x2a, 0x33, 0xd,
0xa, 0x24, 0x33, 0xd, 0xa, 0x53, 0x45, 0x54, 0xd, 0xa, 0x24, 0x32,
0xd, 0xa, 0x62, 0x31, 0xd, 0xa, 0x24, 0x38, 0x31, 0x39, 0x32, 0xd,
0xa};
    outputStream.write(errorRawPayload);

    /*
     * Payload from successful run:
     * //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 6e 4e 32 58 54 6c 50 79 30 6f 61 78 64 49 52 68
77 71 4a 73 30 34 76 4f 46 < omitted for another 8000 bytes....>
     *  //78 63 30 73 51 4f 6c 6e 56 51 71 34 6d 6d 74 66 75 50 6a 50
78 4c 63 77 4e 46 43 39  d  a|
     */


    Thread.sleep(100);
    socket.close();
}


On Wed, Oct 31, 2018 at 1:06 PM Michael Fong <mcfong.o...@gmail.com> wrote:

> Hi Yakov,
>
> Thanks for your reply. :)
>
> Please allow me to explain the whole situation and how to reproduce
> the problem:
>
> In the PR of IGNITE-7153, I added a test case under
> RedisProtocolConnectSelfTest, sending some binary data via Jedis client,
> large enough (> 8192 bytes) to reproduce the original problem of
> IGNITE-7153 from my understanding.
> Later on, I found another problem which I explain in the previous email
> that payload is sometimes not fully read via
> GridNioServer.processRead(). This, however, does not seem to be a Redis
> protocol parsing problem. Unfortunately, the only way that I found to
> reproduce this NioServer packet-reading problem is to add a for-loop in the
> new test case. I would say 95% of time, it will occur, i.e.
>
> for(int i = 0; i < 100; i ++) {
>
>      String randomString1 = RandomStringUtils.random(8 << 10, true, true); 
> //8192
>
>      try (Jedis jedis = pool.getResource()) {
>           jedis.set("b1".getBytes(), randomString1.getBytes());
>           Assert.assertEquals(randomString1, jedis.get("b1"));
>
>           Thread.sleep(100);
>      }
>
> }
>
>
> For troubleshooting, I simply print out the content of ByteBuffer along
> the data flow, and that is how I got packet in the previous email. I could
> try to emulate the erroneous packet then add the added in another test case
> via pure socket connection per your request. Thanks!
>
> Regards,
>
> Michael
>
>
> On Tue, Oct 30, 2018 at 6:00 PM Yakov Zhdanov <yzhda...@apache.org> wrote:
>
>> Michael, can you please share a reproducer? Is it possible to snapshot a
>> packet that causes the error and just emulate packet send with manually
>> opened socket bypassing Redis client lib?
>>
>> --Yakov
>>
>

Reply via email to