[ 
https://issues.apache.org/jira/browse/GEODE-2517?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

nabarun updated GEODE-2517:
---------------------------
    Description: 
*Situation*:
1. Create a server and client.
2. Fill the server with a large amount of data. 
3. Create a query that will result in over 600,000 entries as result.
4. Chunk the result set in such a way that one chunk will result in a size 
greater than 2GB
5. Execute the query from the client.

*Expected*:
Message too large exception.

*Cause / Fix for the issue*:
If the number of parts to be transmitted is one then in sendBytes()

{code:title=Message.java}
for (int i = 0; i < this.numberOfParts; i++) {
          Part part = this.partsList[i];
          headerLen += PART_HEADER_SIZE;
          totalPartLen += part.getLength();
        }
{code}

* Here the part.getLength() is an int, so if the size if greater than 2GB we 
have already overflowed the int barrier and we are putting a negative value in 
totalPartLen

so when we do the below check :
{code:title=Message.java}
if ((headerLen + totalPartLen) > Integer.MAX_VALUE) {
          throw new MessageTooLargeException(
              "Message size (" + (headerLen + totalPartLen) + ") exceeds 
maximum integer value");
        }
{code}

The comparison is between a negative number and positive number 
[Integer.MAX_VALUE] hence it will always skip this loop.

and ultimately result in this exception.

{noformat}
java.io.IOException: Part length ( -508,098,123 ) and number of parts ( 1 ) 
inconsistent
        at 
com.gemstone.gemfire.internal.cache.tier.sockets.Message.readPayloadFields(Message.java:836)
        at 
com.gemstone.gemfire.internal.cache.tier.sockets.ChunkedMessage.readChunk(ChunkedMessage.java:276)
        at 
com.gemstone.gemfire.internal.cache.tier.sockets.ChunkedMessage.receiveChunk(ChunkedMessage.java:220)
        at 
com.gemstone.gemfire.cache.client.internal.ExecuteRegionFunctionOp$ExecuteRegionFunctionOpImpl.processResponse(ExecuteRegionFunctionOp.java:482)
        at 
com.gemstone.gemfire.cache.client.internal.AbstractOp.processResponse(AbstractOp.java:215)
        at 
com.gemstone.gemfire.cache.client.internal.AbstractOp.attemptReadResponse(AbstractOp.java:153)
        at 
com.gemstone.gemfire.cache.client.internal.AbstractOp.attempt(AbstractOp.java:369)
        at 
com.gemstone.gemfire.cache.client.internal.ConnectionImpl.execute(ConnectionImpl.java:252)
        at 
com.gemstone.gemfire.cache.client.internal.pooling.PooledConnection.execute(PooledConnection.java:319)
        at 
com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.executeWithPossibleReAuthentication(OpExecutorImpl.java:933)
        at 
com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:158)
        at 
com.gemstone.gemfire.cache.client.internal.PoolImpl.execute(PoolImpl.java:716)
        at 
com.gemstone.gemfire.cache.client.internal.ExecuteRegionFunctionOp.execute(ExecuteRegionFunctionOp.java:159)
        at 
com.gemstone.gemfire.cache.client.internal.ServerRegionProxy.executeFunction(ServerRegionProxy.java:801)
        at 
com.gemstone.gemfire.internal.cache.execute.ServerRegionFunctionExecutor.executeOnServer(ServerRegionFunctionExecutor.java:212)
        at 
com.gemstone.gemfire.internal.cache.execute.ServerRegionFunctionExecutor.executeFunction(ServerRegionFunctionExecutor.java:165)
        at 
com.gemstone.gemfire.internal.cache.execute.ServerRegionFunctionExecutor.execute(ServerRegionFunctionExecutor.java:363)
        at com.bookshop.buslogic.TestClient.run(TestClient.java:40)
        at com.bookshop.buslogic.TestClient.main(TestClient.java:21)
{noformat}

  was:
*Situation*:
1. Create a server and client.
2. Fill the server with a large amount of data. 
3. Create a query that will result in over 600,000 entries as result.
4. Chunk the result set in such a way that one chunk will result in a size 
greater than 2GB
5. Execute the query from the client.

*Expected*:
Message too large exception.

*Cause / Fix of the issue*:
If the number of parts to be transmitted is one then in sendBytes()

{code:title=Message.java}
for (int i = 0; i < this.numberOfParts; i++) {
          Part part = this.partsList[i];
          headerLen += PART_HEADER_SIZE;
          totalPartLen += part.getLength();
        }
{code}

* Here the part.getLength() is an int, so if the size if greater than 2GB we 
have already overflowed the int barrier and we are putting a negative value in 
totalPartLen

so when we do the below check :
{code:title=Message.java}
if ((headerLen + totalPartLen) > Integer.MAX_VALUE) {
          throw new MessageTooLargeException(
              "Message size (" + (headerLen + totalPartLen) + ") exceeds 
maximum integer value");
        }
{code}

The comparison is between a negative number and positive number 
[Integer.MAX_VALUE] hence it will always skip this loop.

and ultimately result in this exception.

{noformat}
java.io.IOException: Part length ( -508,098,123 ) and number of parts ( 1 ) 
inconsistent
        at 
com.gemstone.gemfire.internal.cache.tier.sockets.Message.readPayloadFields(Message.java:836)
        at 
com.gemstone.gemfire.internal.cache.tier.sockets.ChunkedMessage.readChunk(ChunkedMessage.java:276)
        at 
com.gemstone.gemfire.internal.cache.tier.sockets.ChunkedMessage.receiveChunk(ChunkedMessage.java:220)
        at 
com.gemstone.gemfire.cache.client.internal.ExecuteRegionFunctionOp$ExecuteRegionFunctionOpImpl.processResponse(ExecuteRegionFunctionOp.java:482)
        at 
com.gemstone.gemfire.cache.client.internal.AbstractOp.processResponse(AbstractOp.java:215)
        at 
com.gemstone.gemfire.cache.client.internal.AbstractOp.attemptReadResponse(AbstractOp.java:153)
        at 
com.gemstone.gemfire.cache.client.internal.AbstractOp.attempt(AbstractOp.java:369)
        at 
com.gemstone.gemfire.cache.client.internal.ConnectionImpl.execute(ConnectionImpl.java:252)
        at 
com.gemstone.gemfire.cache.client.internal.pooling.PooledConnection.execute(PooledConnection.java:319)
        at 
com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.executeWithPossibleReAuthentication(OpExecutorImpl.java:933)
        at 
com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:158)
        at 
com.gemstone.gemfire.cache.client.internal.PoolImpl.execute(PoolImpl.java:716)
        at 
com.gemstone.gemfire.cache.client.internal.ExecuteRegionFunctionOp.execute(ExecuteRegionFunctionOp.java:159)
        at 
com.gemstone.gemfire.cache.client.internal.ServerRegionProxy.executeFunction(ServerRegionProxy.java:801)
        at 
com.gemstone.gemfire.internal.cache.execute.ServerRegionFunctionExecutor.executeOnServer(ServerRegionFunctionExecutor.java:212)
        at 
com.gemstone.gemfire.internal.cache.execute.ServerRegionFunctionExecutor.executeFunction(ServerRegionFunctionExecutor.java:165)
        at 
com.gemstone.gemfire.internal.cache.execute.ServerRegionFunctionExecutor.execute(ServerRegionFunctionExecutor.java:363)
        at com.bookshop.buslogic.TestClient.run(TestClient.java:40)
        at com.bookshop.buslogic.TestClient.main(TestClient.java:21)
{noformat}


> Data transfer of size > 2GB from server to client results in a hang and 
> eventual timeout exception
> --------------------------------------------------------------------------------------------------
>
>                 Key: GEODE-2517
>                 URL: https://issues.apache.org/jira/browse/GEODE-2517
>             Project: Geode
>          Issue Type: Bug
>          Components: client/server
>            Reporter: nabarun
>
> *Situation*:
> 1. Create a server and client.
> 2. Fill the server with a large amount of data. 
> 3. Create a query that will result in over 600,000 entries as result.
> 4. Chunk the result set in such a way that one chunk will result in a size 
> greater than 2GB
> 5. Execute the query from the client.
> *Expected*:
> Message too large exception.
> *Cause / Fix for the issue*:
> If the number of parts to be transmitted is one then in sendBytes()
> {code:title=Message.java}
> for (int i = 0; i < this.numberOfParts; i++) {
>           Part part = this.partsList[i];
>           headerLen += PART_HEADER_SIZE;
>           totalPartLen += part.getLength();
>         }
> {code}
> * Here the part.getLength() is an int, so if the size if greater than 2GB we 
> have already overflowed the int barrier and we are putting a negative value 
> in totalPartLen
> so when we do the below check :
> {code:title=Message.java}
> if ((headerLen + totalPartLen) > Integer.MAX_VALUE) {
>           throw new MessageTooLargeException(
>               "Message size (" + (headerLen + totalPartLen) + ") exceeds 
> maximum integer value");
>         }
> {code}
> The comparison is between a negative number and positive number 
> [Integer.MAX_VALUE] hence it will always skip this loop.
> and ultimately result in this exception.
> {noformat}
> java.io.IOException: Part length ( -508,098,123 ) and number of parts ( 1 ) 
> inconsistent
>       at 
> com.gemstone.gemfire.internal.cache.tier.sockets.Message.readPayloadFields(Message.java:836)
>       at 
> com.gemstone.gemfire.internal.cache.tier.sockets.ChunkedMessage.readChunk(ChunkedMessage.java:276)
>       at 
> com.gemstone.gemfire.internal.cache.tier.sockets.ChunkedMessage.receiveChunk(ChunkedMessage.java:220)
>       at 
> com.gemstone.gemfire.cache.client.internal.ExecuteRegionFunctionOp$ExecuteRegionFunctionOpImpl.processResponse(ExecuteRegionFunctionOp.java:482)
>       at 
> com.gemstone.gemfire.cache.client.internal.AbstractOp.processResponse(AbstractOp.java:215)
>       at 
> com.gemstone.gemfire.cache.client.internal.AbstractOp.attemptReadResponse(AbstractOp.java:153)
>       at 
> com.gemstone.gemfire.cache.client.internal.AbstractOp.attempt(AbstractOp.java:369)
>       at 
> com.gemstone.gemfire.cache.client.internal.ConnectionImpl.execute(ConnectionImpl.java:252)
>       at 
> com.gemstone.gemfire.cache.client.internal.pooling.PooledConnection.execute(PooledConnection.java:319)
>       at 
> com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.executeWithPossibleReAuthentication(OpExecutorImpl.java:933)
>       at 
> com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:158)
>       at 
> com.gemstone.gemfire.cache.client.internal.PoolImpl.execute(PoolImpl.java:716)
>       at 
> com.gemstone.gemfire.cache.client.internal.ExecuteRegionFunctionOp.execute(ExecuteRegionFunctionOp.java:159)
>       at 
> com.gemstone.gemfire.cache.client.internal.ServerRegionProxy.executeFunction(ServerRegionProxy.java:801)
>       at 
> com.gemstone.gemfire.internal.cache.execute.ServerRegionFunctionExecutor.executeOnServer(ServerRegionFunctionExecutor.java:212)
>       at 
> com.gemstone.gemfire.internal.cache.execute.ServerRegionFunctionExecutor.executeFunction(ServerRegionFunctionExecutor.java:165)
>       at 
> com.gemstone.gemfire.internal.cache.execute.ServerRegionFunctionExecutor.execute(ServerRegionFunctionExecutor.java:363)
>       at com.bookshop.buslogic.TestClient.run(TestClient.java:40)
>       at com.bookshop.buslogic.TestClient.main(TestClient.java:21)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to