tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chirag Dewan <>
Subject Re: OOME issue in Tomcat 6.0.18(with SSL)
Date Thu, 13 Jun 2013 04:59:32 GMT
Hi Chris,

A little more digging in and I found out that only with SSL,tomcat is creating a large number
of sessions. I can see in the logs for HTTP:

INFO: SessionListener: sessionDestroyed('2E8DE01EE3F0D166FEFC8A45353CD9ED')

Now,in case of HTTPS I see a large number of such logs. So I believe for HTTPS requests it
is creating a session for every request as compared to HTTP?

This is my SSL setting in client:

 public HttpTLSProtocolSocketFactory()
      this.sslcontext = SSLContext.getInstance("TLS");
      TrustManager[] arrayOfTrustManager = { new DummyX509TrustManager() };
      this.sslcontext.init(null, arrayOfTrustManager, null);
    catch (Exception localException)
      this.logger.log(Level.SEVERE, "Failed to created SSLContext: " + localException.getMessage());

  public Socket createSocket(String paramString, int paramInt1, InetAddress paramInetAddress,
int paramInt2, HttpConnectionParams paramHttpConnectionParams)
    throws IOException, UnknownHostException, ConnectTimeoutException
    if (paramHttpConnectionParams == null)
      throw new IllegalArgumentException("Parameters may not be null");
    int i = paramHttpConnectionParams.getConnectionTimeout();
    SSLSocketFactory localSSLSocketFactory = this.sslcontext.getSocketFactory();
    if (i == 0)
      return localSSLSocketFactory.createSocket(paramString, paramInt1, paramInetAddress,
    Socket localSocket = localSSLSocketFactory.createSocket();
    InetSocketAddress localInetSocketAddress1 = new InetSocketAddress(paramInetAddress,
    InetSocketAddress localInetSocketAddress2 = new InetSocketAddress(paramString, paramInt1);
    localSocket.connect(localInetSocketAddress2, i);
    return localSocket;

Can different sockets create different sessions?

So for HTTP I am not creating any new sessions,same should be the case for HTTPS. Right?

The only thing which differs in my is the SSLSocketFactory Implementation,which creates sockets.


 From: Christopher Schultz <>
To: Tomcat Users List <> 
Sent: Wednesday, 12 June 2013 8:14 PM
Subject: Re: OOME issue in Tomcat 6.0.18(with SSL)

Hash: SHA256


On 6/12/13 1:01 AM, Chirag Dewan wrote:
> I am facing an Out of Memory Issue with my application. I am using 
> Embedded Tomcat 6.0.18. I have a simple servlet deployed which
> does nothing but set the HTTPResponse and return it.

Are you sure you don't trigger session creation?

> Now I have 2 testing clients
> Client 1:
> HTTPClient 3.1 with MultiThreadedHttpConnectionManager with SSL 
> maxConnections = 200 maxConnectionsPerHost=200
> Client 2:
> HTTPClient 4.1 in which I configured multiple threads
> for (int i = 0; i < noofConnections; i++) { Thread t = new
> Thread(my); t.start(); }

What is noofConnections set to?

> With every thread executing HTTPGet on the servlet. This too with
> SSL.
> Now with client 1,my JVM crashes after just a few minutes. Running
> with 8gb heap space.
> I took a heap dump for 2gb heap space using Jmap and analyzed it
> with MAT. It seems that there were many instances of
> org.apache.catalina.session.StandardManager consuming almost 95% of
> heap space.

There should only be one StandardManager present per web application
deployed. You only have a single web application? Are you sure that
you have many StandardManager instances, or do you have a single
StandardManager with a huge number of sessions?

> CPU utilization is only 13 -14% and I can see only 65 threads
> active with netstat.
> With Client 2,everything looks fine. Though JVM crashes at 2gb,but
> at 8gb it works fine. Though CPU utilization is almost 90% and 100
> simultaneous threads created for 100 simultaneous threads.
> Both my server and clients are on Linux 64 bit machines.
> I believe that this is something related to the client 1 i.e.
> either the HTTPClient 3.1 or the MultiThreadedConnectionManager,but
> posting here if someone can assist me in what might be the root
> cause.

Try a single thread and a single connection. Take a packet-capture and
see what the response headers look like. I wouldn't be surprised if
you are generating a new session with each and every request.

- -chris
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools -
Comment: Using GnuPG with Thunderbird -


To unsubscribe, e-mail:
For additional commands, e-mail:
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message