Memcached::cas no longer working in 1.0.17

Bug #1412462 reported by TheSoofMan on 2015-01-19
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libmemcached
Undecided
Unassigned

Bug Description

Memcached::CAS is hardly working in 1.0.14.

By "hardly" i mean you have to set some value to the key you are using CAS on, like so:

=====================
(libmemcached 1.0.14, pecl-memcached 2.2.0, php 5.5.20, memcached 1.4.17):
WORKING CODE if $varName not set in memcache previously

        $transactionCAS = null;

        $variableCheckExisting = $objMc->get($varName);
        $getResult = $objMc->getResultCode();

        //Begin workaround
        if (!$variableCheckExisting && $getResult == Memcached::RES_NOTFOUND) {
            $objMc->set($varName, false); //Just set to false to avoid problems
            $transactionPreviousVal = null;
            $objMc->get($varName, null, static::$transactionCAS);
        }else{
            $transactionPreviousVal = $objMc->get($varName, null, static::$transactionCAS);
        }

=====================
(libmemcached 1.0.14, pecl-memcached 2.2.0, php 5.5.20, memcached 1.4.17):
NOT WORKING CODE if $varName not set in memcache previously:

            $transactionCAS = null;
            $transactionPreviousVal = $objMc->get($varName, null, $transactionCAS);

RESULT:

php: libmemcached/storage.cc:342: memcached_return_t memcached_send_ascii(memcached_st*, org::libmemcached::Instance*, const char*, size_t, const char*, size_t, time_t, uint32_t, uint64_t, bool, bool, memcached_storage_action_t): Assertion `memcached_failed(rc)' failed.

=====================
(libmemcached 1.0.17, pecl-memcached 2.2.0, php 5.5.20, memcached 1.4.17):
NOT WORKING (at all) CODE

        $transactionCAS = null;
        $variableCheckExisting = $objMc->get($varName);
        $getResult = $objMc->getResultCode();

        //Begin workaround
        if (!$variableCheckExisting && $getResult == Memcached::RES_NOTFOUND) {
            $objMc->set($varName, false); //Just set to false to avoid problems
            $transactionPreviousVal = null;
            $objMc->get($varName, null, static::$transactionCAS);
        }else{
            $transactionPreviousVal = $objMc->get($varName, null, static::$transactionCAS);
        }

RESULT:

php: libmemcached/do.cc:96: memcached_return_t memcached_vdo(memcached_instance_st*, libmemcached_io_vector_st*, size_t, bool): Assertion `memcached_last_error(instance->root) == MEMCACHED_SUCCESS' failed.

So, as of 1.0.17 Memcached::cas is no longer working at all for me.

System:
Gentoo 64bit, so everything compiled from source. Gcc 4.7.3, Kernel : 3.10.41

TheSoofMan (shutman) on 2015-01-19
description: updated
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers