tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From František Kučera <>
Subject Allow keeping tcpNoDelay untouched (default)
Date Sun, 14 Jul 2019 17:10:11 GMT

I got this error when new HTTP request comes:

14-Jul-2019 18:18:39.296 SEVERE [http-nio-8080-Acceptor] Error setting 
socket options Operace není podporována
                 at Method)

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. IMHO it might keep the state of socket's tcpNoDelay 
untouched (i.e. do not call setTcpNoDelay() method) if there is no 
explicit configuration to set this option.

I looked in the git history and current sources and there is the 
condition: "if (tcpNoDelay != null)" and:

  * TCP_NO_DELAY option. JVM default used if not set.
protected Boolean tcpNoDelay = Boolean.TRUE;

and it was "tcpNoDelay = null;" in 2008. So it seems that it worked this 
way before... But now it always calls setTcpNoDelay(true) if not 
configured to false (and then it calls setTcpNoDelay(false)). I have not 
found any way to configure Tomcat to not set this option and keep the 
socket in its original state.

Or there might be a third option in the tcpNoDelay configuration 
<> 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). This 
might be more backward compatible behavior.

I can help with writing the patch and testing but I would appreciate 
some design advice.

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.


View raw message