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 2021/11/22 10:16:19 UTC
[tomcat] branch 9.0.x updated: Avoid duplicate read registrations for blocking I/O with NIO
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new b0675f3 Avoid duplicate read registrations for blocking I/O with NIO
b0675f3 is described below
commit b0675f34e6684db83c00850b2c002223a207cfd4
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Nov 22 10:15:14 2021 +0000
Avoid duplicate read registrations for blocking I/O with NIO
---
java/org/apache/tomcat/util/net/NioEndpoint.java | 7 ++++---
webapps/docs/changelog.xml | 4 ++++
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 9c8a713..0131504 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -1302,8 +1302,10 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
if (n == -1) {
throw new EOFException();
} else if (n == 0) {
- readBlocking = true;
- registerReadInterest();
+ if (!readBlocking) {
+ readBlocking = true;
+ registerReadInterest();
+ }
synchronized (readLock) {
if (readBlocking) {
try {
@@ -1316,7 +1318,6 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
} catch (InterruptedException e) {
// Continue
}
- readBlocking = false;
}
}
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 57f515a..a5b60f1 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -121,6 +121,10 @@
bug</a> that causes the acceptor to report an incoming connection more
than once. (markt)
</add>
+ <fix>
+ Avoid unnecessary duplicate read registrations for blocking I/O with the
+ NIO connector. (markt)
+ </fix>
</changelog>
</subsection>
</section>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org