This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push: new f5f2b62 BZ63949: Restore write loop which was present in the selector code f5f2b62 is described below commit f5f2b62670f972fc6a857788084e4352f2d4cd87 Author: remm <r...@apache.org> AuthorDate: Fri Nov 22 17:04:03 2019 +0100 BZ63949: Restore write loop which was present in the selector code The issue was introduced in 9.0.20 by https://github.com/apache/tomcat/commit/4377d2db40 Thanks to Justin Wong for the testing and finding the root cause. --- java/org/apache/tomcat/util/net/NioEndpoint.java | 10 +++++++--- webapps/docs/changelog.xml | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index 7501647..fc61310 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -1273,9 +1273,13 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel> // registered for write once as both container and user code can trigger // write registration. } else { - if (socket.write(from) == -1) { - throw new EOFException(); - } + int n = 0; + do { + n = socket.write(from); + if (n == -1) { + throw new EOFException(); + } + } while (n > 0 && from.hasRemaining()); } updateLastWrite(); } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index bad8fa7..486fe95 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -55,6 +55,10 @@ Harmonize maxConnections default value to 8192 across all connectors. (remm) </fix> + <fix> + <bug>63949</bug>: Fix non blocking write problems with NIO due to the + need for a write loop. (remm) + </fix> </changelog> </subsection> <subsection name="Web applications"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org