You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2019/03/05 15:50:46 UTC

[tomcat] branch 8.5.x updated: Fix edge case causing a missing initial notification

This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
     new e450a49  Fix edge case causing a missing initial notification
e450a49 is described below

commit e450a49d8a6ee4f7243b2f7b0773c0ecce4b8406
Author: remm <re...@apache.org>
AuthorDate: Tue Mar 5 16:28:55 2019 +0100

    Fix edge case causing a missing initial notification
    
    This could be seen on CI #4110, which I managed to reproduce. Hopefully
    will not cause regressions.
---
 java/org/apache/tomcat/util/net/Nio2Endpoint.java | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
index 226e421..b551659 100644
--- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
+++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
@@ -1472,19 +1472,19 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel> {
                 if (readNotify) {
                     return;
                 }
+                readInterest = true;
                 if (readPending.tryAcquire()) {
                     // No read pending, so await bytes
-                    synchronized (readCompletionHandler) {
-                        readInterest = true;
-                        try {
-                            fillReadBuffer(false);
-                        } catch (IOException e) {
-                            // Will never happen
-                            setError(e);
+                    try {
+                        if (fillReadBuffer(false) > 0) {
+                            // Special case where the read completes inline, there is no notification
+                            // in that case and it cannot happen elsewhere
+                            getEndpoint().processSocket(Nio2SocketWrapper.this, SocketEvent.OPEN_READ, true);
                         }
+                    } catch (IOException e) {
+                        // Will never happen
+                        setError(e);
                     }
-                } else {
-                    readInterest = true;
                 }
             }
         }


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