You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2019/07/16 20:36:22 UTC

[Bug 63568] New: Allow keeping tcpNoDelay untouched (default)

https://bz.apache.org/bugzilla/show_bug.cgi?id=63568

            Bug ID: 63568
           Summary: Allow keeping tcpNoDelay untouched (default)
           Product: Tomcat 9
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: issues.apache.org.db7c0rhii@frantovo.cz
  Target Milestone: -----

Created attachment 36661
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36661&action=edit
hotfix to enable Tomcat listening on an inherited unix domain socket

Hello,

I got this error when new HTTP request comes:

14-Jul-2019 18:18:39.296 SEVERE [http-nio-8080-Acceptor]
org.apache.tomcat.util.net.NioEndpoint.setSocketOptions Error setting socket
options
        java.net.SocketException: Operace není podporována
                at sun.nio.ch.Net.setIntOption0(Native Method)
                at sun.nio.ch.Net.setSocketOption(Net.java:334)
                at
sun.nio.ch.SocketChannelImpl.setOption(SocketChannelImpl.java:190)
                at
sun.nio.ch.SocketAdaptor.setBooleanOption(SocketAdaptor.java:271)
                at
sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:306)
                at
org.apache.tomcat.util.net.SocketProperties.setProperties(SocketProperties.java:204)
                at
org.apache.tomcat.util.net.NioEndpoint.setSocketOptions(NioEndpoint.java:401)
                at
org.apache.tomcat.util.net.NioEndpoint.setSocketOptions(NioEndpoint.java:73)
                at org.apache.tomcat.util.net.Acceptor.run(Acceptor.java:115)
                at java.lang.Thread.run(Thread.java:748)

do not panic, this does not happen in normal conditions - my setup is kind of
special. Given socket does not support the tcpNoDelay option, so it throws an
exception. To get rid of it, I patched the Tomcat's source code (see
attachment, it patches the latest git version).

I am looking for a more clean solution that could be merged in the official
sources. I suggest adding a third option in the tcpNoDelay configuration
<https://tomcat.apache.org/tomcat-9.0-doc/config/http.html> like "default" or
"null" besides the "true" and "false" (i.e. convert some booleans to Booleans
in the source code and allow the null value) which will cause that
setTcpNoDelay() method will not be called on new incomming connections/sockets.

Please confirm whether this is a good solution – I will then write a new patch.

Original mailing list thread:
<http://tomcat.10.x6.nabble.com/Allow-keeping-tcpNoDelay-untouched-default-td5087592.html>

Context: I am interested in making applications listen on unix domain sockets
instead of TCP ones (e.g. Jetty can work this way) and especially in listening
on sockets inherited from parent process (the "useInheritedChannel" in Tomcat's
Connector configuration). And unix domain socket has no tcpNoDelay option
obviously.

Franta

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 63568] Allow keeping tcpNoDelay untouched (default)

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63568

--- Comment #3 from František Kučera <xkucf03/> <is...@frantovo.cz> ---
Thanks.

If anyone want to test it, here is config for systemd:
<https://blog.frantovo.cz/c/372/#toc_14> or a simple loader written in C:
<https://blog.frantovo.cz/c/372/#toc_12> which makes Tomcat listen on an
inherited unix domain socket. Integration with Apache HTTPD is also easy -
like:

ProxyPass unix:/run/tomcat|http://localhost/

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 63568] Allow keeping tcpNoDelay untouched (default)

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63568

--- Comment #1 from Remy Maucherat <re...@apache.org> ---
Since it's probably not a good idea to change the default behavior at this
point, the "hotfix" proposed does not sound that bad.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 63568] Allow keeping tcpNoDelay untouched (default)

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63568

Remy Maucherat <re...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #2 from Remy Maucherat <re...@apache.org> ---
I chose to use the patch. This will be in 8.5.44 and 9.0.23.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org