MemcachedClient and timeout

Dustin Sallings dustin at
Tue Mar 18 07:08:29 UTC 2008

On Mar 17, 2008, at 23:46, Rakesh Rajan wrote:

> I tried to check this on my local deployment. The way I tested was  
> that I started my app ( with memcache running ) and in between  
> restarted memcached. And then any next operation on cache results in  
> this exception :
> Caused by: java.util.concurrent.ExecutionException:  
> java.lang.RuntimeException: Cancelled
>         at net.spy.memcached.MemcachedClient 
> $OperationFuture.get(
>         at  
> net.spy.memcached.MemcachedClient.get(
>         ... 46 more
> Caused by: java.lang.RuntimeException: Cancelled
>         ... 48 more
> This exception happens only the first time I access cache after  
> restarting memcached. Subsequent calls works fine. Is this the  
> exception that we are all talking about ? If not, how should I be  
> handling this ?

	This is expected in failure cases.  The client will auto-cancel any  
requests that have been partially sent as it's safer than just sending  
them again.  If you're paying attention to responses, you're going to  
be told that it was cancelled.

	It's up to you what to do with that.  You can try to send it again,  
or you can ignore it.

	The exception in the bug is internal to the client:

	The CancelledKeyException is what I'm referring to as being handled.   
If anyone can tell me how that condition can occur in that code, I'd  
be happy to do something about it, of course.

Dustin Sallings

More information about the memcached mailing list