paquettg / leaguewrap

League of Legend API wrapper
MIT License
67 stars 28 forks source link

Memcached returns 38 = MEMCACHED_INVALID_ARGUMENTS when decreasing the available hits #50

Closed duronrulez closed 9 years ago

duronrulez commented 9 years ago

For some reason memcached returns 38 / invalid arguments on this row:

if ($this->memcached->decrement($this->key, $count) === FALSE)

I have connected to the memcache from telnet and i can see the keys are properly set and there, but non the less it returns error when you try to decrease the key value.

dnlbauer commented 9 years ago

I think you are refering to line 121 in Limit.php

Is this error maybe related to http://php.net/manual/de/memcached.increment.php#111187 ? Can you try switching memcached to binary mode and check if this resolves the error?

// edit: from further reading: that might also be related to your memcached version. Setting of initial values isnt supported prior to Memcached 2.0.0b2. What version are you using?

duronrulez commented 9 years ago

My version is version 1.4.14 (Ubuntu) that is the version in 14.10 ubuntu LTS. How should i proceed to fix the issue? Use "add" first?

dnlbauer commented 9 years ago

How you checked if your memcached operates in binary mode? Am 11.12.2014 12:22 schrieb "duronrulez" notifications@github.com:

My version is version 1.4.14 (Ubuntu) that is the version in 14.10 ubuntu LTS

— Reply to this email directly or view it on GitHub https://github.com/paquettg/leaguewrap/issues/50#issuecomment-66605560.

duronrulez commented 9 years ago

Sorry, its running in auto mode. I will try forcing binary.

Edit: i've added -B binary in the memcached config file, but i still get the same error. Edit2: now its working, i have no idea why. I reinstalled the memcached software, and the php5-memcache libs.

duronrulez commented 9 years ago

Also for some reason this:

$this->memcached->set($this->key, $this->hits, time()+$this->seconds);

$this->seconds is 10 and 60 (2 rate limits as per riot terms), both keys set this way, never expire. But if i remove time() and leave only $this->seconds as expiry time, they expire as expected.

Memcached is a strange service :)

dnlbauer commented 9 years ago

yeah memcached is a bit strange from a compatibility point of view. There seem to be big (undocumented) changes from version to version that changes behaviour. Maybe you changed version of the extension or memcached by reinstallation without noticing :p

Good to hear that its working now, though!