From 07ae3615ed63b68e395097ca6571f977437b31f1 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 2 Sep 2013 14:44:23 +1000 Subject: [PATCH] 416321 handle failure during blocked committing write --- .../eclipse/jetty/io/AbstractConnection.java | 11 +++++++-- .../eclipse/jetty/io/ssl/SslConnection.java | 23 ++++++++++++++----- .../org/eclipse/jetty/server/HttpChannel.java | 6 ++--- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractConnection.java b/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractConnection.java index 3fc9bef3ea6..002472abd62 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractConnection.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractConnection.java @@ -410,9 +410,16 @@ public abstract class AbstractConnection implements Connection } @Override - public void failed(Throwable x) + public void failed(final Throwable x) { - onFillInterestedFailed(x); + _executor.execute(new Runnable() + { + @Override + public void run() + { + onFillInterestedFailed(x); + } + }); } @Override diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java b/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java index b972ce9e04c..05e00c92f5f 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java @@ -291,12 +291,12 @@ public class SslConnection extends AbstractConnection } @Override - public void failed(Throwable x) + public void failed(final Throwable x) { // This means that a write of data has failed. Writes are done // only if there is an active writeflusher or a read needed to write // data. In either case the appropriate callback is passed on. - boolean failFiller = false; + boolean fail_filler = false; synchronized (DecryptedEndPoint.this) { if (DEBUG) @@ -309,12 +309,23 @@ public class SslConnection extends AbstractConnection if (_fillRequiresFlushToProgress) { _fillRequiresFlushToProgress = false; - failFiller = true; + fail_filler = true; } } - if (failFiller) - getFillInterest().onFail(x); - getWriteFlusher().onFail(x); + + final boolean filler_failed=fail_filler; + + getExecutor().execute(new Runnable() + { + @Override + public void run() + { + + if (filler_failed) + getFillInterest().onFail(x); + getWriteFlusher().onFail(x); + } + }); } }; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java index 7d542303bcf..de338c13dbb 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java @@ -722,8 +722,8 @@ public class HttpChannel implements HttpParser.RequestHandler, Runnable if (x instanceof EofException) { LOG.debug(x); - _response.getHttpOutput().closed(); _callback.failed(x); + _response.getHttpOutput().closed(); } else { @@ -733,16 +733,16 @@ public class HttpChannel implements HttpParser.RequestHandler, Runnable @Override public void succeeded() { - _response.getHttpOutput().closed(); _callback.failed(x); + _response.getHttpOutput().closed(); } @Override public void failed(Throwable th) { LOG.ignore(th); - _response.getHttpOutput().closed(); _callback.failed(x); + _response.getHttpOutput().closed(); } }); }