memcached doesn't work on a Sun Fire T2000 running Solaris 10
We recently downloaded and installed the Cool Tools memcached package on a Sun Fire T2000 running Solaris 10. I tested it by creating a small perl script to populate a memcached server with the contents of /usr/dict/words:
usrdictwords.pl:
#!/usr/bin/perl
#
# inserts all of the entries in the /usr/dict/words file into memcached
#
use strict;
use Cache::Memcached;
my $host ="neptune002:11211";
my $memc =new Cache::Memcached;
$memc->set_servers([$host]);
unless ($memc->set("foo","bar") &&
$memc->get("foo") eq"bar"){
die"memcached not running at $host ?\n";
}
my $usr_dict_words ="/usr/dict/words";
open INFILE,"<$usr_dict_words" or die"coult't open '$usr_dict_words' for input";
my $i = 0;
while ( <INFILE> ){
chomp();
my $word = $_;
$i++;
$memc->set($word,"1");
print"."if ($i % 100 == 0);
}
close(INFILE);
$memc->disconnect_all();
Then I tried to retrieve the same from the server using a corresponding perl script.
getusrdictwords.pl:
#!/usr/bin/perl
#
# checks memcachedfor previously inserted words from /usr/dict/words
#
use strict;
use Cache::Memcached;
my $host ="neptune002:11211";
my $memc =new Cache::Memcached;
$memc->set_servers([$host]);
unless ($memc->set("foo","bar") &&
$memc->get("foo") eq"bar"){
die"memcached not running at $host ?\n";
}
my $usr_dict_words ="/usr/dict/words";
open INFILE,"<$usr_dict_words" or die"coult't open '$usr_dict_words' for input";
my $i = 0;
while ( <INFILE> ){
chomp();
my $word = $_;
$i++;
my $result = $memc->get($word);
if ( $result ne"1" ){
print"couldn't get '$word' ('$result')\n";
}
else{
print"got '$word' -> '$result'\n";
}
print"."if ($i % 100 == 0);
}
close(INFILE);
$memc->disconnect_all();
When I run this latter program I get output like the following:
got'10th' ->'1'
got'1st' ->'1'
got'2nd' ->'1'
got'3rd' ->'1'
got'4th' ->'1'
got'5th' ->'1'
got'6th' ->'1'
got'7th' ->'1'
got'8th' ->'1'
got'9th' ->'1'
couldn't get 'a' ('')
got'AAA' ->'1'
got'AAAS' ->'1'
couldn't get 'Aarhus' ('')
couldn't get 'Aaron' ('')
got'AAU' ->'1'
got'ABA' ->'1'
couldn't get 'Ababa' ('')
couldn't get 'aback' ('')
couldn't get 'abacus' ('')
got'abalone' ->'1'
...
When I run memcached on a Linux machine and do the same test I get the results I expect (I find all strings that were previously inserted).
Does anyone have any ideas about what might be wrong? Is there a way to debug memcached on Solaris 10?
[5601 byte] By [
Dan_Specka] at [2007-11-27 0:36:37]

# 1
We are unable to reproduce this problem after testing on sparc, x64 and on a T2000, all running Solaris 10.
We tested running the client on the same system as well as on a different system.
To help debug the issue, you can add the following debug line in your 'set' script after set_servers:
$memc->set_servers([$host]);
$memc->set_debug(1);
If you're still stuck, please include information on the exact OS version, how memcached was started, etc.
Shanti
# 2
I'm helping out Dan, and I'm working on the same servers with the same script.
I added the set_debug line, and now the setting script has a bunch of output that looks like this:
Cache::Memcache: set z's = 1 (set z's 0 0 1
1)
Cache::Memcache: set zucchini = 1 (set zucchini 0 0 1
1)
Cache::Memcache: set Zurich = 1 (set Zurich 0 0 1
1)
Cache::Memcache: set zygote = 1 (set zygote 0 0 1
1)
The getting script looks like this:
MemCache: got z's = 1
got 'z's' -> '1'
MemCache: got zucchini = 1
got 'zucchini' -> '1'
couldn't get 'Zurich' ('')
couldn't get 'zygote' ('')
I'm not exactly sure what you would need as far as exact OS version goes. When I do a 'uname -a', it says this:
SunOS neptune002 5.10 Generic_118833-17 sun4v sparc SUNW,Sun-Fire-T200
To start up memcached, I add /opt/coolstack/lib to the front of my LD_LIBRARY_PATH, and then just run 'memcached'. I've tried various options, including -m 256 and up, -M, and -v. None of these options change the behavior. The memcached process does not produce any output at all, and program fails to get a bunch of the stored values.
I'm not sure if Dan made this clear, but if we run the exact same set of Perl scripts on the same Solaris host, but point them at a memcached running under Ubuntu linux, the script returns a 100% success rate. the memcached from coolstack is 1.2.1, while the linux version is 1.1.12; I'm not sure if that has anything to do with it.
# 3
Mike,
I tried to reproduce your problem on a Solaris SPARC and x86 machine. I never managed to make it fail. I am using memcached 1.2.0 from the latest Coolstack distrubution. You say in your Email that you are using memcached 1.2.1. What is the outout you get when you run
$ /opt/coolstack/bin/memcached -h
One thing, I would like you to try :
- run you set script to load the objects into the memcached server
- from the client's command line, run :
$ telnet host 11211
Trying 192.168.0.1...
Connected to host.
Escape character is '^]'.
get Zurich
END
get Zurich
VALUE Zurich 0 1
1
END
If "Zurich" is not a key that causes a problem, please replace it with an offending key. Let me know what you get.
BTW, let me know if there's a possibility to log into your system remotely. I'd be happy to do so.
Thanks,
Georg
# 4
> $ /opt/coolstack/bin/memcached -h
Doh! I was wrong, we are running 1.2.0:
% /opt/coolstack/bin/memcached -h
memcached 1.2.0
I don't know where I got 1.2.1 from. The version on linux is definitely 1.1.12, even after upgrading to ubuntu feisty fawn. (1.2.x vs 1.1.x)
> One thing, I would like you to try :
Zurich is indeed one of the troublesome keys. Here is what happens:
neptune002 % telnet localhost 11211
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
get Zurich
END
zucchini works (following directly:)
get zucchini
VALUE zucchini 0 1
1
END
> BTW, let me know if there's a possibility to log into
> your system remotely. I'd be happy to do so.
Alas, that's not possible. Thanks for the offer, though.
One other thing that may or may not be important. memcached is the only part of the cool stack we have installed. The /opt/coolstack/bin directory contains event_rpcgen.py, memcached, and memcached-debug. /opt/coolstack/lib contains:
lrwxrwxrwx1 rootroot22 Mar 29 08:02 libevent-1.2a.so.1 -> libevent-1.2a.so.1.0.3*
-rwxr-xr-x1 rootroot 150952 Feb 16 10:50 libevent-1.2a.so.1.0.3*
-rw-r--r--1 rootroot1131976 Feb 16 10:50 libevent.a
-rwxr-xr-x1 rootroot833 Feb 16 10:50 libevent.la*
lrwxrwxrwx1 rootroot22 Mar 29 08:02 libevent.so -> libevent-1.2a.so.1.0.3*
-Mike
# 5
I figured it out, and man do I feel stupid.
We had tried to compile a version of memcached previously on Solaris 9, and had quite a bit of trouble. Specifically, we had problems getting libevent to compile, and we tried various hacks to get it working. Right when we were about to give up on it, we noticed that memcached was available for Solaris 10 in the cool stack, and so that's what led us here.
I thought we had completely uninstalled the old memcached, but apparently, we did not. There was still a version of it in my (and Dan's) PATH, so we were running the halfway compiled version against the cool stack libevent, which sorta explains why it half works.
I killed off that other memcached, and ran /opt/coolstack/bin/memcached, and now everything is working fine. Sorry for all the trouble!
-mike
# 6
No, reason to feel stupid. There are only two types of SW engineers here, one admits to having made this mistake, the other one does not :-)
Anyway, I like your set/get scripts. Pretty handy for basic memcached testing. So, I got something out of helping you as well. For that, I thank you.
Georg