CancelledKeyException in SPY memcached-2.0-pre5

Andrew Miller amiller at
Wed Dec 12 05:39:31 UTC 2007


I'm working on changing our underlying java memcached client to the  
"spy" memcached client.  Things have gone well in local testing,  
however, in broader testing, our applications are outright dying due  
to the following stack trace:

2007-12-11 20:25:15,239 ERROR [Memcached IO over {MemcachedConnection  
         at java.nio.channels.SelectionKey.isReadable 
         at net.spy.memcached.MemcachedConnection.handleIO 
         at net.spy.memcached.MemcachedConnection.handleIO 

I can reproduce this by restarting the memcached servers while there  
is memcache IO in progress.  It appears that in our environment (jdk  
1.5.0_11 on debian linux), a failed connection/read from one of the  
memcached servers is being interpreted as a CancelledKeyException  
(uncaught, bubbles all the way out of the JVM) vs. an IOException  
(Which appears to be caught by the code and retried).

I'm tempted to hack in an exception handler to deal with this  
exception type but I am not sure if that is appropriate, or if I am  
missing something more fundamental.  I'm not a java programmer by  
trade so I don't know if I'm missing something silly -  Can anyone  
comment on my misfortunes? :-)


More information about the memcached mailing list