title: Getting java.nio.channels.CancelledKeyException without explicit cancellation of the key
body: <p>I have been getting Getting <code>java.nio.channels.CancelledKeyException</code> thrown from:</p>
  
  <pre><code>at sun.nio.ch.SelectionKeyImpl.ensureValid(SelectionKeyImpl.java:55)
  at sun.nio.ch.SelectionKeyImpl.interestOps(SelectionKeyImpl.java:64)
  </code></pre>
  
  <p>However, I am not calling the <code>java.nio.channels.SelectionKey.cancel()</code> explicitly at any point.</p>
  
  <p>An important piece of information is that this is happening in my testing environment which runs on EC2 and there is communication going on between multiple machines where I kill processes in the machines which are target for communication abruptly. However, I could not correlate this exception time of appearance to any initiated process termination. Could this happen if the underlying socket is disconnected or there are network connectivity issues?</p>
  
  <p>Thanks</p>