This queue is for tickets about the Cache-Memcached-Fast CPAN distribution.

Report information
The Basics
Id:
51084
Status:
rejected
Priority:
Low/Low

People
Owner:
Nobody in particular
Requestors:
zlevow [...] barracuda.com
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: inconsistent results when trying to assign a value to a null key
Date: Tue, 3 Nov 2009 11:29:30 -0800
To: "bug-Cache-Memcached-Fast@rt.cpan.org" <bug-Cache-Memcached-Fast@rt.cpan.org>
From: Zach Levow <zlevow@barracuda.com>
Not sure if it is legal for the key to be null (\x00), but when it is, Cache::Memcached::Fast works first three times and then returns null for any request. We've fixed our bug that was generating null keys, but thought you might want to know. I don't know if this is a memcached problem, or if it occurs with the standard Cache::Memcached perl module. Thanks, Zach Sample code to reproduce: #!/usr/bin/perl -w use strict; use Cache::Memcached::Fast; my $memd = undef; $memd = new Cache::Memcached::Fast({ servers => [ 'localhost:11211', ], namespace => 'bcs:', connect_timeout => 0.2, io_timeout => 0.5, close_on_error => 1, compress_threshold => 100_000, compress_ratio => 0.9, compress_methods => [ \&IO::Compress::Gzip::gzip, \&IO::Uncompress::Gunzip::gunzip ], max_failures => 3, failure_timeout => 2, ketama_points => 150, nowait => 1, hash_namespace => 1, serialize_methods => [ \&Storable::freeze, \&Storable::thaw ], utf8 => 0, max_size => 512 * 1024, }); use Data::Dumper; my $versions = $memd->server_versions; print Dumper($versions); for (1..5) { my @set_results = $memd->set("a", 'aaaa'); my @get_results = $memd->get("a"); print Dumper(\@set_results, \@get_results); @set_results = $memd->set("\x00", 'aaaa'); @get_results = $memd->get("\x00"); print Dumper(\@set_results, \@get_results); } Output of that code on my Debian box (Linux SERVERA 2.6.26-2-amd64 #1 SMP Wed Aug 19 22:33:18 UTC 2009 x86_64 GNU/Linux): ~/dev# /tmp/memcached_test.pl $VAR1 = { 'localhost:11211' => '1.2.2' }; $VAR1 = [ 1 ]; $VAR2 = [ 'aaaa' ]; $VAR1 = []; $VAR2 = []; $VAR1 = [ 1 ]; $VAR2 = [ 'aaaa' ]; $VAR1 = []; $VAR2 = []; $VAR1 = [ 1 ]; $VAR2 = [ 'aaaa' ]; $VAR1 = []; $VAR2 = []; $VAR1 = []; $VAR2 = []; $VAR1 = []; $VAR2 = []; $VAR1 = []; $VAR2 = []; $VAR1 = []; $VAR2 = []; ---------------------------------- Check out the Barracuda Spam & Virus Firewall - offering the fastest virus & malware protection in the industry: www.barracudanetworks.com/spam
\0 is not a valid key symbol. When you do $memd->set("\x00", 'aaaa') memcached -vvv outputs the following: <30 set bcs:
Show quoted text
>30 ERROR
Essentially what happens is: 1 client sends "set bcs:\0 0 0 4\r\naaaa\r\n" ("bcs:" is a namespace prefix, and "\0" is a key, 4 is value size). 2 because of terminating zero server reads command line as "set bcs:". 3 server can't parse the command, it replies "ERROR". After max_failures => 3 times getting an "ERROR" the client doesn't use this server for another failure_timeout => 2 seconds. That's why you see 3 replies and then nothing.


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.