Hanson Char hanson.char at
Mon Oct 15 06:27:28 UTC 2007

I am not using this memcached client, but my guess is can it be
related to concurrency issue ?  On Dustin's website:

"This is a simple, asynchronous, single-threaded memcached client
written in java."

so there can be problem if the client is used in a non
single-threaded, concurrent environment.

(I am using the Ketama version of Greg Whalin's java memcached client,
and I also previously encountered some NPE threading issue with the
way MD5 sum was used.  So I locally fixed it to make it thread-safe.)

Hanson Char

On 10/14/07, Chris Lamprecht <clamprecht at> wrote:
> I'm using the java client by Dustin Sallings, 2.0-pre4, and under a load of
> about 20 requests per second, I'm getting this error every few minutes (and
> it seems to kill the NIO thread, so I have to restart the program):
> Exception in thread "Memcached IO over {MemcachedConnection to
> localhost/}" java.lang.NullPointerException
>         at
> net.spy.memcached.protocol.ProxyCallback.gotData(
> :41)
>         at
> net.spy.memcached.protocol.ascii.GetOperationImpl.handleRead(
>         at
> net.spy.memcached.protocol.ascii.OperationImpl.readFromBuffer(
>         at
> net.spy.memcached.MemcachedConnection.handleReads
> (
>         at
> net.spy.memcached.MemcachedConnection.handleIO(
>         at
> net.spy.memcached.MemcachedConnection.handleIO(
> Here's the code where the NPE is happening (just after the assert
> statement):
> public void gotData(String key, int flags, byte[] data) {
>     Collection<GetOperation.Callback> cbs=callbacks.get(key);
>     assert cbs != null : "No callbacks for key " + key;
>     for(GetOperation.Callback c : cbs) {          <---- NPE here
>         c.gotData(key, flags, data);
>     }
> }
> Any ideas?  I haven't dug into the code yet to try and debug it.  Also
> previously I tried the 1.4 client version and got an NPE in
> or something like that.  Thanks
> -Chris

More information about the memcached mailing list