Skip to content

Binary protocol is broken #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ziadloo opened this issue May 15, 2013 · 13 comments
Closed

Binary protocol is broken #77

ziadloo opened this issue May 15, 2013 · 13 comments
Labels

Comments

@ziadloo
Copy link

ziadloo commented May 15, 2013

I've been having trouble using binary protocol in very simple scenarios. For instance:

<?php
$mc = new \Memcached();
$mc->setOption(\Memcached::OPT_BINARY_PROTOCOL, true);
$mc->addServer("127.0.0.1", 11211);

$mc->touch("key", time() + 600);
$touchResult = $mc->getResultCode();
$mc->set("key", 1, time() + 600);
$setResult = $mc->getResultCode();

echo "<pre>";
echo "Touch result: $touchResult\n";
echo "Set result: $setResult\n";
echo "</pre>";

The first run outputs:

Touch result: 16 [RES_NOTFOUND]
Set result: 0 [RES_SUCCESS]

And the second run forth will output:

Touch result: 0 [RES_SUCCESS]
Set result: 5 [RES_WRITE_FAILURE]

Here are my system's configurations:

  • Ubuntu 12.04 64bit
  • PHP 5.3.14
  • memcached 2.1.0 (PECL module)
  • libmemcached 1.0.8
  • Memcached sever 1.4.13
@acidrain1983
Copy link

I've been able to duplicate this issue, I've also had issues with Touch command that's why I found this report.

@eduardosoliv
Copy link

Problems here too:

         Text protocol
         php > $m = new \Memcached();
         php > $m->addServer('localhost', 11211);
         php > $m->add('test', 4, null);
         var_dump($m->get('test'));
         int(4)
         php > $m->increment('test', 4);
         php > var_dump($m->get('test'));
         int(8)

         Binary protocol:
         php > $mb = new \Memcached();
         php > $mb->addServer('localhost', 11211);
         php > $mb->setOption(\Memcached::OPT_BINARY_PROTOCOL, true);
         php > $mb->add('test2', 4, null);
         php > var_dump($mb->get('test2'));
         int(4)
         php > $mb->increment('test2', 4);
         php > var_dump($mb->get('test2'));
         bool(false)

@JaredWilliams
Copy link

Can't replicate any of these problems with

php-memcached 2.1.0
libmemcached 1.0.17
memcached 1.4.15

@eduardosoliv
Copy link

I updated my versions to this and solved my problem with increment:

memcached 1.4.15

memcached support => enabled
Version => 2.1.0
libmemcached version => 1.0.8
Session support => yes
igbinary support => no
json support => no

@ziadloo
Copy link
Author

ziadloo commented Jun 10, 2013

Here are my new configurations and the problem still remains:

  • Ubuntu 12.04 64bit
  • PHP 5.3.14
  • memcached 2.1.0 (PECL module)
  • libmemcached 1.0.8
  • Memcached sever 1.4.15
  • Session support yes
  • igbinary support no
  • json support no

Considering the same code above, the first run outputs:

Touch result: 16 [RES_NOTFOUND]
Set result: 0 [RES_SUCCESS]

And the second run forth will output:

Touch result: 0 [RES_SUCCESS]
Set result: 5 [RES_WRITE_FAILURE]

@eduardosoliv
Copy link

My contribution (my config is already above), I get exactly same results:

Touch result: 16
Set result: 0
Touch result: 0
Set result: 5

@mkoppanen
Copy link
Member

touch seems to be broken with binary protocol for some reason, ignores timeout

mkoppanen added a commit that referenced this issue Oct 18, 2013
@ziadloo
Copy link
Author

ziadloo commented Oct 18, 2013

@mkoppanen would you please state the version in which is issue has been resolved?

@mkoppanen
Copy link
Member

I am testing with libmemcached 1.0.17

@mkoppanen
Copy link
Member

Also, if you look at the following: https://travis-ci.org/php-memcached-dev/php-memcached the tests/gh_77.phpt seems to be pass with all libmemcached versions.

@KnightAR
Copy link

@mkoppanen I've ran the test on my server (which I've been having this problem with) and the test failed:

bool(false)
bool(false)

Server info:

Linux 2.6.34-xen-r5 SMP Sun Jan 1 22:47:41 EST 2012 x86_64 Intel(R) Xeon(R) CPU E5430 @ 2.66GHz GenuineIntel GNU/Linux

PHP 5.4.13--pl0-gentoo (cli) (built: Aug 6 2013 17:39:08)

Memcached section in: php -i

memcached
memcached support => enabled
Version => 2.1.0
libmemcached version => 1.0.14
Session support => yes
igbinary support => no
json support => no

The highest version of libmemcached in the Gentoo repos is 1.0.14, and the ebuilds I've found for libmemcached, 2.1.0 won't compile against so I really don't have a choice right now. :(

@mkoppanen
Copy link
Member

Which version of memcached?

@mkoppanen
Copy link
Member

Added 1.0.14 to builds: https://travis-ci.org/php-memcached-dev/php-memcached/builds/12748482

Looks like the test fails on 1.0.14 and passes on higher versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants