You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2016/04/25 16:07:32 UTC

svn commit: r1740841 - /tomcat/tc8.0.x/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java

Author: markt
Date: Mon Apr 25 14:07:31 2016
New Revision: 1740841

URL: http://svn.apache.org/viewvc?rev=1740841&view=rev
Log:
Fix intermittent CI failure

Modified:
    tomcat/tc8.0.x/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java

Modified: tomcat/tc8.0.x/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java?rev=1740841&r1=1740840&r2=1740841&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java (original)
+++ tomcat/tc8.0.x/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java Mon Apr 25 14:07:31 2016
@@ -42,6 +42,7 @@ public class Nio2ServletInputStream exte
     private boolean flipped = false;
     private volatile boolean readPending = false;
     private volatile boolean interest = true;
+    private volatile boolean swallowEOF = false;
 
     public Nio2ServletInputStream(SocketWrapper<Nio2Channel> wrapper, AbstractEndpoint<Nio2Channel> endpoint0) {
         this.endpoint = endpoint0;
@@ -52,7 +53,7 @@ public class Nio2ServletInputStream exte
             public void completed(Integer nBytes, SocketWrapper<Nio2Channel> attachment) {
                 boolean notify = false;
                 synchronized (completionHandler) {
-                    if (nBytes.intValue() < 0) {
+                    if (!swallowEOF && nBytes.intValue() < 0) {
                         failed(new EOFException(), attachment);
                     } else {
                         readPending = false;
@@ -180,6 +181,11 @@ public class Nio2ServletInputStream exte
 
     @Override
     protected void doClose() throws IOException {
+        // Closing the channel will trigger an EOF. This is expected so set the
+        // flag to swallow it.
+        if (readPending) {
+            swallowEOF = true;
+        }
         channel.close();
     }
 



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