From 845443322b663d95c7dbc0d4c13503a06da07ce4 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Fri, 11 Dec 2009 04:51:39 +0000 Subject: [PATCH] JETTY-1156 SSL blocking close with JVM Bug busy key fix git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1146 7e9141cc-0065-0410-87d8-b60c137991c4 --- VERSION.txt | 1 + .../http/ssl/SslSelectChannelEndPoint.java | 7 ++++--- .../eclipse/jetty/io/nio/SelectorManager.java | 19 +++++++++++++++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index fa8c062e9e9..47639bec50d 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -3,6 +3,7 @@ jetty-7.0.2-SNAPSHOT + 290765 Reset input for HttpExchange retry. + 296765 JMX Connector Server and ShutdownThread + 297421 Hide server/system classes from WebAppClassLoader.getResources + + JETTY-1156 SSL blocking close with JVM Bug busy key fix jetty-7.0.1.v20091125 25 November 2009 + 274251 DefaultServlet supports exact match mode. diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/ssl/SslSelectChannelEndPoint.java b/jetty-http/src/main/java/org/eclipse/jetty/http/ssl/SslSelectChannelEndPoint.java index 34f2976c3c0..3d2fd475ff3 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/ssl/SslSelectChannelEndPoint.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/ssl/SslSelectChannelEndPoint.java @@ -157,12 +157,13 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint // TODO - this really should not be done in a loop here - but with async callbacks. _closing=true; + long end=System.currentTimeMillis()+((SocketChannel)_channel).socket().getSoTimeout(); try { if (isBufferingOutput()) { flush(); - while (isOpen() && isBufferingOutput()) + while (isOpen() && isBufferingOutput() && System.currentTimeMillis()__BUSY_KEY && !(busy.channel() instanceof ServerSocketChannel)) { - SelectChannelEndPoint endpoint = (SelectChannelEndPoint)busy.attachment(); + final SelectChannelEndPoint endpoint = (SelectChannelEndPoint)busy.attachment(); Log.warn("Busy Key "+busy.channel()+" "+endpoint); busy.cancel(); if (endpoint!=null) - endpoint.close(); + { + dispatch(new Runnable() + { + public void run() + { + try + { + endpoint.close(); + } + catch (IOException e) + { + Log.ignore(e); + } + } + }); + } } } else