ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (IGNITE-7153) Redis: BufferUnderflowException at GridRedisProtocolParser.readBulkStr for values > 8kb
Date Sun, 21 Oct 2018 14:00:00 GMT

    [ https://issues.apache.org/jira/browse/IGNITE-7153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16658224#comment-16658224
] 

ASF GitHub Bot commented on IGNITE-7153:
----------------------------------------

GitHub user mcfongtw opened a pull request:

    https://github.com/apache/ignite/pull/5044

    IGNITE-7153: Fix parser to handle incomplete Redis packet

    Add validation method to check packet completeness
    
    Add logic to store incomplete packet temporarily and assemble them until
    the final CRLF is seen.
    
    Implement test cases for data = 8k, 10k and 16k

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mcfongtw/ignite ignite-7153

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/ignite/pull/5044.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #5044
    
----

----


> Redis: BufferUnderflowException at GridRedisProtocolParser.readBulkStr for values >
8kb
> ---------------------------------------------------------------------------------------
>
>                 Key: IGNITE-7153
>                 URL: https://issues.apache.org/jira/browse/IGNITE-7153
>             Project: Ignite
>          Issue Type: Bug
>          Components: general
>    Affects Versions: 2.3
>         Environment: Win, PHP 7, php_redis-3.1.1-7.0
>            Reporter: Alexey Popov
>            Assignee: Roman Shtykh
>            Priority: Major
>              Labels: redis
>
> Exception:
> {noformat}
> [15:03:23,690][SEVERE][grid-nio-worker-tcp-rest-0-#36][GridTcpRestProtocol] Failed to
process selector key [ses=GridSelectorNioSessionImpl [worker=ByteBufferNioClientWorker [readBuf=java.nio.HeapByteBuffer[pos=28
lim=8192 cap=8192], super=AbstractNioClientWorker [idx=0, bytesRcvd=0, bytesSent=0, bytesRcvd0=0,
bytesSent0=0, select=true, super=GridWorker [name=grid-nio-worker-tcp-rest-0, igniteInstanceName=null,
finished=false, hashCode=396395638, interrupted=false, runner=grid-nio-worker-tcp-rest-0-#36]]],
writeBuf=null, readBuf=null, inRecovery=null, outRecovery=null, super=GridNioSessionImpl [locAddr=/127.0.0.1:6380,
rmtAddr=/127.0.0.1:51794, createTime=1512734602674, closeTime=0, bytesSent=0, bytesRcvd=8192,
bytesSent0=0, bytesRcvd0=8192, sndSchedTime=1512734602674, lastSndTime=1512734602674, lastRcvTime=1512734602674,
readsPaused=false, filterChain=FilterChain[filters=[GridNioCodecFilter [parser=GridTcpRestParser
[jdkMarshaller=JdkMarshaller [], routerClient=false], directMode=false]], accepted=true]]]
> java.nio.BufferUnderflowException
> 	at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:151)
> 	at org.apache.ignite.internal.processors.rest.protocols.tcp.redis.GridRedisProtocolParser.readBulkStr(GridRedisProtocolParser.java:107)
> 	at org.apache.ignite.internal.processors.rest.protocols.tcp.redis.GridRedisProtocolParser.readArray(GridRedisProtocolParser.java:86)
> 	at org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpRestParser.decode(GridTcpRestParser.java:150)
> 	at org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpRestParser.decode(GridTcpRestParser.java:70)
> 	at org.apache.ignite.internal.util.nio.GridNioCodecFilter.onMessageReceived(GridNioCodecFilter.java:114)
> 	at org.apache.ignite.internal.util.nio.GridNioFilterAdapter.proceedMessageReceived(GridNioFilterAdapter.java:109)
> 	at org.apache.ignite.internal.util.nio.GridNioServer$HeadFilter.onMessageReceived(GridNioServer.java:3392)
> 	at org.apache.ignite.internal.util.nio.GridNioFilterChain.onMessageReceived(GridNioFilterChain.java:175)
> 	at org.apache.ignite.internal.util.nio.GridNioServer$ByteBufferNioClientWorker.processRead(GridNioServer.java:1096)
> 	at org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.processSelectedKeysOptimized(GridNioServer.java:2272)
> 	at org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.bodyInternal(GridNioServer.java:2048)
> 	at org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.body(GridNioServer.java:1717)
> 	at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
> 	at java.lang.Thread.run(Thread.java:748)
> [15:03:23,691][SEVERE][grid-nio-worker-tcp-rest-0-#36][GridTcpRestProtocol] Closing NIO
session because of unhandled exception.
> class org.apache.ignite.internal.util.nio.GridNioException: null
> 	at org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.processSelectedKeysOptimized(GridNioServer.java:2296)
> 	at org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.bodyInternal(GridNioServer.java:2048)
> 	at org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.body(GridNioServer.java:1717)
> 	at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
> 	at java.lang.Thread.run(Thread.java:748)
> Caused by: java.nio.BufferUnderflowException
> 	at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:151)
> 	at org.apache.ignite.internal.processors.rest.protocols.tcp.redis.GridRedisProtocolParser.readBulkStr(GridRedisProtocolParser.java:107)
> 	at org.apache.ignite.internal.processors.rest.protocols.tcp.redis.GridRedisProtocolParser.readArray(GridRedisProtocolParser.java:86)
> 	at org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpRestParser.decode(GridTcpRestParser.java:150)
> 	at org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpRestParser.decode(GridTcpRestParser.java:70)
> 	at org.apache.ignite.internal.util.nio.GridNioCodecFilter.onMessageReceived(GridNioCodecFilter.java:114)
> 	at org.apache.ignite.internal.util.nio.GridNioFilterAdapter.proceedMessageReceived(GridNioFilterAdapter.java:109)
> 	at org.apache.ignite.internal.util.nio.GridNioServer$HeadFilter.onMessageReceived(GridNioServer.java:3392)
> 	at org.apache.ignite.internal.util.nio.GridNioFilterChain.onMessageReceived(GridNioFilterChain.java:175)
> 	at org.apache.ignite.internal.util.nio.GridNioServer$ByteBufferNioClientWorker.processRead(GridNioServer.java:1096)
> 	at org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.processSelectedKeysOptimized(GridNioServer.java:2272)
> 	... 4 more
> {noformat}
> Simple PHP reproducer with Redis client:
> {code:php}
> <?php
> $redis = new Redis();
> $redis->connect('localhost', 6380);
> $valueSize = 10000;
> $key = 'x';
> $value = str_repeat($key, $valueSize);
> $result = $redis->set($key, $value);
> printf("%s%s", $result === true ? "Setting key was successful" : "Setting key failed",
PHP_EOL);
> $retrievedResult = $redis->get($key);
> if ($retrievedResult === false) {
>     echo "Fetching key failed" . PHP_EOL;
> } else {
>     printf('Key successfully retrieved, length: %d%s', strlen($retrievedResult), PHP_EOL);
> }
> {code}
> It seems that the client set tcp socket buffer size > 8k. That is why unit test works
fine with default (8k) tcp socket size.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message