memcached_increment_with_initial() sets wrong initial value

Bug #1295208 reported by Szymon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libmemcached
New
Undecided
Unassigned

Bug Description

When calling memcached_increment_with_initial(memcached_st*, length, 1, 1, timeout, &out) (if there is no such key in memcached) you would expect this key to have "1" value. But it has something really weird:

"1\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0"

So the key value is a 22 characters string with a number at the beginning and then padding zeros. You can see it when yo use telnet and ask memcached directly for key value:

get get ADV-CNTR-IMP-not-a-date-time-3--1:-1
VALUE ADV-CNTR-IMP-not-a-date-time-3--1:-1 0 22
1END

Also Python library reports the same value.

From C language perspective this bug is not visible and this is probably why it hasn't been found yet. Any subsequent call to memcached_increment_with_initial sets value to a correct format, for example "2".

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.