diff --git a/.gitignore b/.gitignore
index 155e785b01beb809a13c45c40d96f04f4dd6343b..5bb2f335745998d70b88904d02a86a962c6587c5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,8 +29,6 @@ project/build/target/
 project/plugins/target/
 project/plugins/lib_managed/
 project/plugins/src_managed/
-logs/
-log/
 spark-tests.log
 streaming-tests.log
 dependency-reduced-pom.xml
diff --git a/core/src/main/scala/spark/network/ConnectionManager.scala b/core/src/main/scala/spark/network/ConnectionManager.scala
index a79fce8697fa159c2939b712cdf07e3cca5a814b..2d9b4be4b31a97621eba4372b012118e5034efec 100644
--- a/core/src/main/scala/spark/network/ConnectionManager.scala
+++ b/core/src/main/scala/spark/network/ConnectionManager.scala
@@ -281,6 +281,9 @@ private[spark] class ConnectionManager(port: Int) extends Logging {
               if (key.isWritable) {
                 triggerWrite(key)
               }
+            } else {
+              logInfo("Key not valid ? " + key)
+              throw new CancelledKeyException()
             }
           } catch {
             // weird, but we saw this happening - even though key.isValid was true, key.isAcceptable would throw CancelledKeyException.