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/10/08 11:31:42 UTC

[tomcat] branch 7.0.x updated: 63814: Do not set server socket timeout with negative values in NIO

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

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


The following commit(s) were added to refs/heads/7.0.x by this push:
     new 0a18642  63814: Do not set server socket timeout with negative values in NIO
0a18642 is described below

commit 0a18642108a637b9800042f4202d284da93a9682
Author: remm <re...@apache.org>
AuthorDate: Tue Oct 8 13:31:30 2019 +0200

    63814: Do not set server socket timeout with negative values in NIO
---
 java/org/apache/tomcat/util/net/NioEndpoint.java | 4 +++-
 webapps/docs/changelog.xml                       | 8 ++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 2f25ee4..33a7d18 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -474,7 +474,9 @@ public class NioEndpoint extends AbstractEndpoint<NioChannel> {
         InetSocketAddress addr = (getAddress()!=null?new InetSocketAddress(getAddress(),getPort()):new InetSocketAddress(getPort()));
         serverSock.socket().bind(addr,getBacklog());
         serverSock.configureBlocking(true); //mimic APR behavior
-        serverSock.socket().setSoTimeout(getSocketProperties().getSoTimeout());
+        if (getSocketProperties().getSoTimeout() > 0) {
+            serverSock.socket().setSoTimeout(getSocketProperties().getSoTimeout());
+        }
 
         // Initialize thread count defaults for acceptor, poller
         if (acceptorThreadCount == 0) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 21b38f2..44c1aad 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -60,6 +60,14 @@
   issues do not "pop up" wrt. others).
 -->
 <section name="Tomcat 7.0.98 (violetagg)">
+  <subsection name="Coyote">
+    <changelog>
+      <fix>
+        <bug>63814</bug>: Do not set server socket timeout with negative
+        values in NIO. (remm)
+      </fix>
+    </changelog>
+  </subsection>
 </section>
 <section name="Tomcat 7.0.97 (violetagg)">
   <subsection name="Catalina">


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


Re: [tomcat] branch 7.0.x updated: 63814: Do not set server socket timeout with negative values in NIO

Posted by Rémy Maucherat <re...@apache.org>.
On Tue, Oct 8, 2019 at 3:35 PM Mark Thomas <ma...@apache.org> wrote:

> On 08/10/2019 12:31, remm@apache.org wrote:
> > This is an automated email from the ASF dual-hosted git repository.
> >
> > remm pushed a commit to branch 7.0.x
> > in repository https://gitbox.apache.org/repos/asf/tomcat.git
> >
> >
> > The following commit(s) were added to refs/heads/7.0.x by this push:
> >      new 0a18642  63814: Do not set server socket timeout with negative
> values in NIO
> > 0a18642 is described below
> >
> > commit 0a18642108a637b9800042f4202d284da93a9682
> > Author: remm <re...@apache.org>
> > AuthorDate: Tue Oct 8 13:31:30 2019 +0200
> >
> >     63814: Do not set server socket timeout with negative values in NIO
> > ---
> >  java/org/apache/tomcat/util/net/NioEndpoint.java | 4 +++-
> >  webapps/docs/changelog.xml                       | 8 ++++++++
> >  2 files changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java
> b/java/org/apache/tomcat/util/net/NioEndpoint.java
> > index 2f25ee4..33a7d18 100644
> > --- a/java/org/apache/tomcat/util/net/NioEndpoint.java
> > +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
> > @@ -474,7 +474,9 @@ public class NioEndpoint extends
> AbstractEndpoint<NioChannel> {
> >          InetSocketAddress addr = (getAddress()!=null?new
> InetSocketAddress(getAddress(),getPort()):new InetSocketAddress(getPort()));
> >          serverSock.socket().bind(addr,getBacklog());
> >          serverSock.configureBlocking(true); //mimic APR behavior
> > -
> serverSock.socket().setSoTimeout(getSocketProperties().getSoTimeout());
> > +        if (getSocketProperties().getSoTimeout() > 0) {
> > +
> serverSock.socket().setSoTimeout(getSocketProperties().getSoTimeout());
> > +        }
>
> Shouldn't this be >= 0 to allow for infinite timeouts?
>

Yes since this is not NIO2.

Rémy

Re: [tomcat] branch 7.0.x updated: 63814: Do not set server socket timeout with negative values in NIO

Posted by Mark Thomas <ma...@apache.org>.
On 08/10/2019 12:31, remm@apache.org wrote:
> This is an automated email from the ASF dual-hosted git repository.
> 
> remm pushed a commit to branch 7.0.x
> in repository https://gitbox.apache.org/repos/asf/tomcat.git
> 
> 
> The following commit(s) were added to refs/heads/7.0.x by this push:
>      new 0a18642  63814: Do not set server socket timeout with negative values in NIO
> 0a18642 is described below
> 
> commit 0a18642108a637b9800042f4202d284da93a9682
> Author: remm <re...@apache.org>
> AuthorDate: Tue Oct 8 13:31:30 2019 +0200
> 
>     63814: Do not set server socket timeout with negative values in NIO
> ---
>  java/org/apache/tomcat/util/net/NioEndpoint.java | 4 +++-
>  webapps/docs/changelog.xml                       | 8 ++++++++
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java
> index 2f25ee4..33a7d18 100644
> --- a/java/org/apache/tomcat/util/net/NioEndpoint.java
> +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
> @@ -474,7 +474,9 @@ public class NioEndpoint extends AbstractEndpoint<NioChannel> {
>          InetSocketAddress addr = (getAddress()!=null?new InetSocketAddress(getAddress(),getPort()):new InetSocketAddress(getPort()));
>          serverSock.socket().bind(addr,getBacklog());
>          serverSock.configureBlocking(true); //mimic APR behavior
> -        serverSock.socket().setSoTimeout(getSocketProperties().getSoTimeout());
> +        if (getSocketProperties().getSoTimeout() > 0) {
> +            serverSock.socket().setSoTimeout(getSocketProperties().getSoTimeout());
> +        }

Shouldn't this be >= 0 to allow for infinite timeouts?

Mark

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