Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 21200 invoked from network); 22 Jun 2006 20:00:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Jun 2006 20:00:06 -0000 Received: (qmail 82300 invoked by uid 500); 22 Jun 2006 20:00:01 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 82256 invoked by uid 500); 22 Jun 2006 20:00:01 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 82242 invoked by uid 500); 22 Jun 2006 20:00:01 -0000 Delivered-To: apmail-jakarta-tomcat-dev@jakarta.apache.org Received: (qmail 82238 invoked by uid 99); 22 Jun 2006 20:00:01 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Jun 2006 13:00:01 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Jun 2006 13:00:00 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 2500E1A983A; Thu, 22 Jun 2006 12:59:40 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r416456 - in /tomcat/tc6.0.x/trunk/java/org/apache: coyote/http11/InternalNioInputBuffer.java tomcat/util/net/NioEndpoint.java Date: Thu, 22 Jun 2006 19:59:39 -0000 To: tomcat-dev@jakarta.apache.org From: fhanik@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060622195940.2500E1A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: fhanik Date: Thu Jun 22 12:59:39 2006 New Revision: 416456 URL: http://svn.apache.org/viewvc?rev=416456&view=rev Log: Catch the cancelled key exceptions and act appropriately Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java?rev=416456&r1=416455&r2=416456&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java Thu Jun 22 12:59:39 2006 @@ -32,6 +32,7 @@ import java.nio.channels.SelectionKey; import org.apache.tomcat.util.net.NioEndpoint.KeyAttachment; import org.apache.tomcat.util.net.NioEndpoint.Poller; +import java.nio.channels.CancelledKeyException; /** * Implementation of InputBuffer which provides HTTP request header parsing as @@ -564,13 +565,21 @@ if ( !timedOut && nRead == 0 ) try { final SelectionKey key = socket.keyFor(poller.getSelector()); - KeyAttachment att = (KeyAttachment)key.attachment(); + final KeyAttachment att = (KeyAttachment)key.attachment(); att.setWakeUp(true); poller.addEvent( new Runnable() { public void run() { - if ( key != null ) key.interestOps(SelectionKey.OP_READ); + try { + if (key != null) key.interestOps(SelectionKey.OP_READ); + } catch (CancelledKeyException ckx) { + try { + socket.socket().close(); + socket.close(); + att.setWakeUp(false); + } catch (Exception ignore) {} + } } }); synchronized (att.getMutex()) { att.getMutex().wait(25);} Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=416456&r1=416455&r2=416456&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Thu Jun 22 12:59:39 2006 @@ -1106,7 +1106,14 @@ if ( att != null ) att.setWakeUp(false); Runnable r = new Runnable() { public void run() { - if ( key != null ) key.interestOps(SelectionKey.OP_READ); + try { + if (key != null) key.interestOps(SelectionKey.OP_READ); + }catch ( CancelledKeyException ckx ) { + try { + socket.socket().close(); + socket.close(); + } catch ( Exception ignore ) {} + } } }; addEvent(r); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org