Leaseweb / LswMemcacheBundle

Symfony bundle for Memcache Doctrine caching and session storage in the Web Debug Toolbar.
MIT License
202 stars 57 forks source link

Warning: MemcachePool::set(): The lowest two bytes of the flags array is reserved for pecl/memcache internal use #66

Closed Tanariel closed 8 years ago

Tanariel commented 8 years ago

Hello,

i'm running a server on ubuntu 14.04, with the 3.0.8 memcache extension and i get this :

An exception has been thrown during the rendering of a template ("Warning: MemcachePool::set(): The lowest two bytes of the flags array is reserved for pecl/memcache internal use")

The only trail i found was here : http://stackoverflow.com/questions/3740317/php-memcached-error

but i didn't find a way to solve that at the moment.

Thanks in advance for any help you could provide.

mevdschee commented 8 years ago

Can you show the code that calls the "set" method?

Tanariel commented 8 years ago

Ok my bad, i only now realised that by changing the extension, the syntax of the set / get have changed.

Will refactor my code according to the new parameters for those functions.

Thanks for the help :)

andrzejdziekonski commented 8 years ago

Hi,

i also have this warning. No mather what do i use: set , or setAdp. My declaration is: for 'set' in controller: $this->get('memcache.default')->set($key, $value, 0, 7200);

for 'setAdp' in controller: $this->get('memcache.default')->setAdp($key, $value, 7200);

I use default bundle configuration:

lsw_memcache:
    doctrine:
        metadata_cache:
            pool: default
            entity_manager: default       
            document_manager: default      
        result_cache:
            pool: default
            entity_manager: [default, read]  
            prefix: "result_"         
        query_cache:
            pool: default
            entity_manager: default
    session:
        pool: sessions
        auto_load: true
        prefix: "session_"
        ttl: 7200
        locking: true
        spin_lock_wait: 150000
    pools:
        default:
            servers:
                - { host: localhost, tcp_port: 11211, weight: 15 }
            options:
                allow_failover: true
                max_failover_attempts: 20
                default_port: 11211
                chunk_size: 32768
                protocol: ascii
                hash_strategy: consistent
                hash_function: crc32
                redundancy: true
                session_redundancy: 2
                compress_threshold: 20000
                lock_timeout: 15

Might it be any server memcached configuration problem?

Tanariel commented 8 years ago

Hey andrzejdziekonski,

Did you check if you didn't change the memcache extension used by php ?

The previous versions of the bundles were using memcached <-- the d is important, and the newest versions uses memcache (<- no d).

If so, the problem is that the memcache extension 'set' syntax is not the same than the memcached one :

http://php.net/manual/fr/memcached.set.php -> public bool Memcached::set ( string $key , mixed $value [, int $expiration ] )

http://php.net/manual/fr/memcache.set.php -> bool Memcache::set ( string $key , mixed $var [, int $flag [, int $expire ]] )

i had this problem coz i didn't change the parameters accordingly.

are you sure that : $this->get('memcache.default')->setAdp($key, $value, 7200); don't need the flag as 3rd parameter ?

mevdschee commented 8 years ago

It does NOT need flags as third parameter, see: https://github.com/LeaseWeb/LswMemcacheBundle/blob/master/Cache/AntiDogPileMemcache.php#L53

andrzejdziekonski commented 8 years ago

Hi Tanariel,

thanks for your reply. I am pretty sure i am using 'memcache' extension. My phpinfo() says: memcache memcache support enabled Version 3.0.8 Revision $Revision: 329835 $

andrzejdziekonski commented 8 years ago

Does or does not? in your setAdp() declaration u have

setAdp($key, $value, $ttl=0)

so the third argument is ttl, and no $flag in there. Anyway i have the warning when i use 'set' function too so its not the case.

mevdschee commented 8 years ago

@andrzejdziekonski does NOT, sorry for the confusion

andrzejdziekonski commented 8 years ago

@mevdschee Do u know what might cause the problem?

My server configuration:

PHP 5.6.14
Apache/2.4.17 (FreeBSD)

$ pkg info memcache says:

memcached-1.4.24_2
pecl-memcache-3.0.8

Am i missing something ? I experimentaly changed third argument for 'set' and error said "expects parameter 3 to be long, string given" if it rings any bell.

andrzejdziekonski commented 8 years ago

Ok, nevermind. My warnings disappeared after i restarted server (before i had both pecl-memcached and pecl-memcache extensions).

mevdschee commented 8 years ago

OK, glad it is solved. Thanks for reporting back.