Question

I encountered a strange behavior when migrating from tomcat 5.5 to tomcat 7.0.37. I use a standard https Connector:

<Connector address="x.x.x.x" port="9090" scheme="https" secure="true"
  clientAuth="false" sslProtocol="TLS" SSLEnabled="true" 
  ciphers="SSL_RSA_WITH_RC4_128_MD5,SSL_RSA_WITH_RC4_128_SHA,
        TLS_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,
        TLS_DHE_DSS_WITH_AES_128_CBC_SHA,SSL_RSA_WITH_3DES_EDE_CBC_SHA,
        SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA,
        SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA" 
  URIEncoding="UTF-8" keystorePass="x" keystoreFile="x" 
  connectionTimeout="-1" maxPostSize="-1" />

When flag connectionTimeout="-1" is set, every request to Tomcat is causing a constant 20%-30% processor usage. So after generating 5 request for any type of resource (simple html page, jar file) the processor usage reaches 100%.

When I remove connectionTimeout="-1" flag, this behavior does not occur. I use a standard Tomcat 7 configuration.

Can someone explain what's going on?

Was it helpful?

Solution

Took me a min to figure this one out. I was also able to reproduce this issue. Looking at the documentation for http connectors. It doesn't say you can set it to -1 but it doesn't say you can't either. So I dived into the code to find out for sure. In the code I found the below(soTimeout = connectionTimeout)

if (soTimeout != null && soTimeout.intValue() >= 0)
  socket.setSoTimeout(soTimeout.intValue());

So based off that -1 is never getting set and the Socket java class is using default settings.

If you are wanting a infinite timeout set it to 0(I would not recommend as this can bring you all kinds of problems.)

EDIT #1

Looked a little deeper into this and it seems there is a bug in tomcat which I have reported and will be in 7.0.42 onwards.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top