NullPointerException

Hanson Char hanson.char at gmail.com
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 gmail.com> 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/127.0.0.1:11211}" java.lang.NullPointerException
>         at
> net.spy.memcached.protocol.ProxyCallback.gotData(ProxyCallback.java
> :41)
>         at
> net.spy.memcached.protocol.ascii.GetOperationImpl.handleRead(GetOperationImpl.java:95)
>         at
> net.spy.memcached.protocol.ascii.OperationImpl.readFromBuffer(OperationImpl.java:104)
>         at
> net.spy.memcached.MemcachedConnection.handleReads
> (MemcachedConnection.java:300)
>         at
> net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:264)
>         at
> net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:180)
>
> 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 OptimizeGet.java
> or something like that.  Thanks
>
> -Chris
>
>


More information about the memcached mailing list