tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r1830549 - in /tomcat/trunk: java/org/apache/tomcat/util/net/SecureNio2Channel.java webapps/docs/changelog.xml
Date Mon, 30 Apr 2018 11:19:57 GMT
Author: remm
Date: Mon Apr 30 11:19:57 2018
New Revision: 1830549

URL: http://svn.apache.org/viewvc?rev=1830549&view=rev
Log:
Sometimes Future write will cause an ISE with NIO2 (timeout or cancel on a channel). Not a
very good idea IMO. Make things more consistent with SSL close.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java?rev=1830549&r1=1830548&r2=1830549&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java Mon Apr 30 11:19:57
2018
@@ -146,30 +146,41 @@ public class SecureNio2Channel extends N
 
     private class FutureFlush implements Future<Boolean> {
         private Future<Integer> integer;
+        private Exception e = null;
         protected FutureFlush() {
-            integer = sc.write(netOutBuffer);
+            try {
+                integer = sc.write(netOutBuffer);
+            } catch (IllegalStateException e) {
+                this.e = e;
+            }
         }
         @Override
         public boolean cancel(boolean mayInterruptIfRunning) {
-            return integer.cancel(mayInterruptIfRunning);
+            return (e != null) ? true : integer.cancel(mayInterruptIfRunning);
         }
         @Override
         public boolean isCancelled() {
-            return integer.isCancelled();
+            return (e != null) ? true : integer.isCancelled();
         }
         @Override
         public boolean isDone() {
-            return integer.isDone();
+            return (e != null) ? true : integer.isDone();
         }
         @Override
         public Boolean get() throws InterruptedException,
                 ExecutionException {
+            if (e != null) {
+                throw new ExecutionException(e);
+            }
             return Boolean.valueOf(integer.get().intValue() >= 0);
         }
         @Override
         public Boolean get(long timeout, TimeUnit unit)
                 throws InterruptedException, ExecutionException,
                 TimeoutException {
+            if (e != null) {
+                throw new ExecutionException(e);
+            }
             return Boolean.valueOf(integer.get(timeout, unit).intValue() >= 0);
         }
     }

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1830549&r1=1830548&r2=1830549&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon Apr 30 11:19:57 2018
@@ -52,6 +52,9 @@
       from issuing redirects or taking other action that required the response
       status code to be changed. (markt)
       </fix>
+      <fix>
+        Consistent exception propagation for NIO2 SSL close. (remm)
+      </fix>
     </changelog>
   </subsection>
 </section>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message