You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Alexandre SIMON (Jira)" <ji...@apache.org> on 2019/08/30 10:29:00 UTC

[jira] [Comment Edited] (IGNITE-3772) Large values are corrupted when saved via Memcached client

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

Alexandre SIMON edited comment on IGNITE-3772 at 8/30/19 10:28 AM:
-------------------------------------------------------------------

[~auszone] I even here have a limit of 2000 bytes with a PHP client.

 
{code:java}
<?php
$client = new Memcached();
$client->addServer("ignite1", 11211);
$client->setOption(Memcached::OPT_BINARY_PROTOCOL, true);

function storeAndAssert($key, $value) {
    global $client;

    echo "*** Test to store $key, len=".strlen($value)."***\n";

    if ($client->set($key, $value)) {
        echo "set return OK\n";

        if ($storedValue = $client->get($key) != $value) {
            echo "Server key value holding KO: ".$storedValue."\n";
        } else {
            echo "Server key value holding OK\n";
        }
    } else {
        echo "set return KO\n";
    }
}

function genValue($len) {
    return str_repeat('a', $len);
}

storeAndAssert('toto', 'val'.uniqid());
storeAndAssert('v1', genValue(100));
storeAndAssert('v1', genValue(500));
storeAndAssert('v1', genValue(1000));
storeAndAssert('v1', genValue(2000));
storeAndAssert('v1', genValue(1999));
{code}
Ouput :
{code:java}
*** Test to store toto, len=16***
set return OK
Server key value holding OK
*** Test to store v1, len=100***
set return OK
Server key value holding OK
*** Test to store v1, len=500***
set return OK
Server key value holding OK
*** Test to store v1, len=1000***
set return OK
Server key value holding OK
*** Test to store v1, len=2000***
set return OK
Server key value holding KO: 1
*** Test to store v1, len=1999***
set return OK
Server key value holding OK
{code}
As I suspect you would ask, PHP version is 7.2.21, libmemcached 1.0.18, pecl memcached 3.1.3.

here the configuration of the node :
{code:java}
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
       <property name="memoryConfiguration">
        <bean class="org.apache.ignite.configuration.MemoryConfiguration">
            <!-- Set the size of default memory region to 1GB. -->
            <property name="defaultMemoryPolicySize" value="#{1L * 1024 * 1024 * 1024}"/>
            <property name="concurrencyLevel" value="4"/>
            <property name="pageSize" value="8192"/>
        </bean>
       </property>
       <property name="cacheConfiguration">
            <list>
                <!-- Partitioned cache example configuration (Atomic mode).
                <bean class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="default"/>
                    <property name="atomicityMode" value="ATOMIC"/>
                    <property name="backups" value="1"/>
                </bean>
-->
               <bean class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="default"/>
                    <property name="cacheMode" value="REPLICATED"/>
                    <property name="atomicityMode" value="ATOMIC"/>
                    <property name="rebalanceMode" value="SYNC"/>
                </bean>            </list>
        </property>
<!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
        <property name="discoverySpi">
            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="ipFinder">
                    <!--
                        Ignite provides several options for automatic discovery that can be used
                        instead os static IP based discovery. For information on all options refer
                        to our documentation: http://apacheignite.readme.io/docs/cluster-config
                    -->
                    <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
                    <!-- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder"> -->
                    <!-- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> -->
                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
                        <property name="addresses">
                            <list>
                                <!-- In distributed environment, replace with actual host IP address. -->
                                <value>ignite2:47500</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
</beans>
{code}
 

But the more important thing is that with the same runtime and code client from a real memcached (1.5.16), everything is fine...

Any change this get resolved ?

 

Thanks.


was (Author: lexsimon):
[~auszone] I even here have a limit of 2000 bytes with a PHP client.

 
{code:java}
<?php
$client = new Memcached();
$client->addServer("ignite1", 11211);
$client->setOption(Memcached::OPT_BINARY_PROTOCOL, true);

function storeAndAssert($key, $value) {
    global $client;

    echo "*** Test to store $key, len=".strlen($value)."***\n";

    if ($client->set($key, $value)) {
        echo "set return OK\n";

        if ($storedValue = $client->get($key) != $value) {
            echo "Server key value holding KO: ".$storedValue."\n";
        } else {
            echo "Server key value holding OK\n";
        }
    } else {
        echo "set return KO\n";
    }
}

function genValue($len) {
    return str_repeat('a', $len);
}

storeAndAssert('toto', 'val'.uniqid());
storeAndAssert('v1', genValue(100));
storeAndAssert('v1', genValue(500));
storeAndAssert('v1', genValue(1000));
storeAndAssert('v1', genValue(2000));
storeAndAssert('v1', genValue(1999));
{code}
Ouput :
{code:java}
*** Test to store toto, len=16***
set return OK
Server key value holding OK
*** Test to store v1, len=100***
set return OK
Server key value holding OK
*** Test to store v1, len=500***
set return OK
Server key value holding OK
*** Test to store v1, len=1000***
set return OK
Server key value holding OK
*** Test to store v1, len=2000***
set return OK
Server key value holding KO: 1
*** Test to store v1, len=1999***
set return OK
Server key value holding OK
{code}
As I suspect you would ask, PHP version is 7.2.21, libmemcached 1.0.18, pecl memcached 3.1.3.

But the more important thing is that with the same runtime and code client from a real memcached (1.5.16), everything is fine...

Any change this get resolved ?

 

Thanks.

> Large values are corrupted when saved via Memcached client
> ----------------------------------------------------------
>
>                 Key: IGNITE-3772
>                 URL: https://issues.apache.org/jira/browse/IGNITE-3772
>             Project: Ignite
>          Issue Type: Bug
>          Components: clients
>    Affects Versions: 1.7
>            Reporter: Valentin Kulichenko
>            Priority: Major
>
> When a value which is larger than 32768 bytes is saved via Memcached client, it ends up corrupted in cache. Most likely something wrong with the parsing and the length of binary value is calculated incorrectly.
> Modified {{MemcacheRestExample}} which reproduces the issue is attached.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)