You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2021/11/04 20:55:03 UTC

[httpcomponents-core] 01/01: HTTPCORE-695: Unhandled CancelledKeyException during processPendingInterestOps leads to a shutdown of the underlying IOReactor

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch 4.4.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git

commit 2ad9417606978ff81445c7ff84b942d83fc24f6c
Author: Kurtcebe Eroglu <ku...@gmail.com>
AuthorDate: Thu Nov 4 20:25:08 2021 +0100

    HTTPCORE-695: Unhandled CancelledKeyException during processPendingInterestOps leads to a shutdown of the underlying IOReactor
---
 .../java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java
index 10371b7..c97fd4e 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java
@@ -465,7 +465,11 @@ public abstract class AbstractIOReactor implements IOReactor {
             final SelectionKey key = entry.getSelectionKey();
             final int eventMask = entry.getEventMask();
             if (key.isValid()) {
-                key.interestOps(eventMask);
+                try {
+                    key.interestOps(eventMask);
+                } catch (final CancelledKeyException ex) {
+                    // ignore and move on
+                }
             }
         }
     }