Return-Path: X-Original-To: apmail-hc-commits-archive@www.apache.org Delivered-To: apmail-hc-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 19C31FDF3 for ; Tue, 2 Apr 2013 16:10:58 +0000 (UTC) Received: (qmail 25046 invoked by uid 500); 2 Apr 2013 16:10:58 -0000 Delivered-To: apmail-hc-commits-archive@hc.apache.org Received: (qmail 24981 invoked by uid 500); 2 Apr 2013 16:10:57 -0000 Mailing-List: contact commits-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list commits@hc.apache.org Received: (qmail 24954 invoked by uid 99); 2 Apr 2013 16:10:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Apr 2013 16:10:56 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_FRT_STOCK2 X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Apr 2013 16:10:53 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 9CE7823889ED for ; Tue, 2 Apr 2013 16:10:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1463609 - in /httpcomponents/httpcore/branches/4.2.x: RELEASE_NOTES.txt httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java Date: Tue, 02 Apr 2013 16:10:32 -0000 To: commits@hc.apache.org From: olegk@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130402161032.9CE7823889ED@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: olegk Date: Tue Apr 2 16:10:32 2013 New Revision: 1463609 URL: http://svn.apache.org/r1463609 Log: HTTPCORE-336: Unhandled CancelledKeyException leads to a shutdown of the underlying IOReactor Contributed by Thomas Dudek Modified: httpcomponents/httpcore/branches/4.2.x/RELEASE_NOTES.txt httpcomponents/httpcore/branches/4.2.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java Modified: httpcomponents/httpcore/branches/4.2.x/RELEASE_NOTES.txt URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.2.x/RELEASE_NOTES.txt?rev=1463609&r1=1463608&r2=1463609&view=diff ============================================================================== --- httpcomponents/httpcore/branches/4.2.x/RELEASE_NOTES.txt (original) +++ httpcomponents/httpcore/branches/4.2.x/RELEASE_NOTES.txt Tue Apr 2 16:10:32 2013 @@ -1,3 +1,10 @@ +Changes since Release 4.2.4 +------------------- + +* [HTTPCORE-336] Unhandled CancelledKeyException leads to a shutdown of the underlying IOReactor. + Contributed by Thomas Dudek + + Release 4.2.4 ------------------- Modified: httpcomponents/httpcore/branches/4.2.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.2.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java?rev=1463609&r1=1463608&r2=1463609&view=diff ============================================================================== --- httpcomponents/httpcore/branches/4.2.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java (original) +++ httpcomponents/httpcore/branches/4.2.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java Tue Apr 2 16:10:32 2013 @@ -403,22 +403,25 @@ public abstract class AbstractIOReactor }; } - IOSession session = new IOSessionImpl(key, interestOpsCallback, sessionClosedCallback); - - int timeout = 0; + IOSession session; try { - timeout = channel.socket().getSoTimeout(); - } catch (IOException ex) { - // Very unlikely to happen and is not fatal - // as the protocol layer is expected to overwrite - // this value anyways - } - - session.setAttribute(IOSession.ATTACHMENT_KEY, entry.getAttachment()); - session.setSocketTimeout(timeout); - this.sessions.add(session); + session = new IOSessionImpl(key, interestOpsCallback, sessionClosedCallback); + int timeout = 0; + try { + timeout = channel.socket().getSoTimeout(); + } catch (final IOException ex) { + // Very unlikely to happen and is not fatal + // as the protocol layer is expected to overwrite + // this value anyways + } + session.setAttribute(IOSession.ATTACHMENT_KEY, entry.getAttachment()); + session.setSocketTimeout(timeout); + } catch (final CancelledKeyException ex) { + continue; + } try { + this.sessions.add(session); SessionRequestImpl sessionRequest = entry.getSessionRequest(); if (sessionRequest != null) { sessionRequest.completed(session);