bigdata4u / spymemcached

Automatically exported from code.google.com/p/spymemcached
0 stars 0 forks source link

incr() is broken with binary protocol #274

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
It happens with the latest released spymemcached 2.8.4, even with memcached 
forced to communicate via binary protocol only. The platform is Ubuntu Linux, 
memcached 1.4.15.
java version "1.7.0_15"
OpenJDK Runtime Environment (IcedTea7 2.3.7) (7u15-2.3.7-0ubuntu1~12.04.1)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)

For example, just after first increment via binary protocol the string returned 
is something not usable for toLong()

scala> val mt = new MemcachedClient(new DefaultConnectionFactory, 
AddrUtil.getAddresses("localhost:11211"))
scala> val mb = new MemcachedClient(new BinaryConnectionFactory, 
AddrUtil.getAddresses("localhost:11211"))
...
scala> mb.getBulk(List("a", "b"))
res55: java.util.Map[java.lang.String,java.lang.Object] = {b=8, a=22}

scala> mb.incr("c", 2, 2, 1000000)
res56: Long = 2

scala> mb.getBulk(List("a", "b"))
res57: java.util.Map[java.lang.String,java.lang.Object] = {b=8, a=22}

scala> mb.getBulk(List("a", "b", "c"))
[line elided for control chars: possibly a scala signature]

<"c" is now something "2\ngarbage\nmore garbage">

scala> mb.getBulk(List("a", "b", "c"))
[line elided for control chars: possibly a scala signature]
scala> mb.getBulk(List("a", "b", "c"))
[line elided for control chars: possibly a scala signature]

<no luck>

scala> mb.incr("c", 2, 2, 1000000)
res61: Long = 4

scala> mb.getBulk(List("a", "b", "c"))
res62: java.util.Map[java.lang.String,java.lang.Object] = {b=8, c=4, a=22}

scala> mt.incr("d", 2, 2, 1000000)
res63: Long = 2

<notice "mt" is used>

scala> mb.getBulk(List("a", "b", "c", "d"))
res64: java.util.Map[java.lang.String,java.lang.Object] = {d=2, b=8, c=4, a=22}

Original issue reported on code.google.com by arkadi.s...@gmail.com on 25 Apr 2013 at 6:06

GoogleCodeExporter commented 8 years ago

Original comment by ingen...@gmail.com on 11 Nov 2013 at 5:58