akwei / memcached

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

Inconsistent display of maxbytes in "stats" and "stats settings" #319

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.echo "stats settings" | nc {host name or ip} {port}
2.echo "stats" | nc {host name or ip} {port}

What is the expected output? What do you see instead?
the limit_maxbytes in 'stats' is different from maxbytes in 'stats setting' 
when the maxbytes is set beyond the range of unsigned int.

What version of the product are you using? On what operating system?
1.4.15 on any linux 64bits os

Please provide any additional information below.
I just look at the source code, the code to produce the output of 'stats' is as 
below:
APPEND_STAT("limit_maxbytes", "%llu", (unsigned long long)settings.maxbytes);
while the code for 'stats setting' is as:
APPEND_STAT("maxbytes", "%u", (unsigned int)settings.maxbytes);
so it seems that the upper 32bits are truncated during the conversion from 
unsigned int to unsigned long long

Original issue reported on code.google.com by the.6th....@gmail.com on 6 May 2013 at 9:41

GoogleCodeExporter commented 9 years ago
Hi,

Trouble here too. Eviction happens when it reaches the maxbytes not at the 
limit_maxbytes. It only takes the maxbytes value not the limit_maxbytes value.

# rpm -qa | grep memcached
memcached-1.4.15-1.el6.x86_64
# file /usr/bin/memcached
/usr/bin/memcached: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), 
dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
]# uname -rop
2.6.32-358.11.1.el6.x86_64 x86_64 GNU/Linux
# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.4 (Santiago)
# cat /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="2048"
CACHESIZE="7168"
OPTIONS=""
# echo "stats settings" | nc localhost 11211 | grep maxbytes
STAT maxbytes 3221225472
]# echo "stats" | nc localhost 11211  | grep limit_maxbytes
STAT limit_maxbytes 7516192768

This is in production and we are in a trouble. Please help

Regards
Hirantha

Original comment by hiranth...@gmail.com on 28 Aug 2013 at 2:00

GoogleCodeExporter commented 9 years ago
To the first guy:

Just pushed a fix, will be in the next release.

To the second guy:

I hope you figured out what the problem was, because it certainly wasn't that. 
You didn't print out any of the stats saying what your stored bytes were, and 
'maxbytes' is the same internal value for both maxbytes and limit_maxbytes, 
it's just the display that was broken.

Original comment by dorma...@rydia.net on 7 Dec 2013 at 8:33