Connection leak diagnostics in WebSphere Application Server

– Poorly written applications often do not properly release database connections.

  • Forget to call connection.close().
  • Most often in the exception case.
  • Connections should be closed in a finally{} block.

– Orphaned connections only return to the pool after timeout.

  • Can cause a backup of new connections waiting for old connections to time out.
  • New connections that have waited too long throw a connectionWaitTimeoutException.

– Connection manager is instrumented to print stack traces when a connectionWaitTimeoutException occurs.

  • Enabled using trace stringWAS.j2c=finest

Applications can suffer from performance problems and even appear to “hang” if they do not close their connections properly. This is most often caused by developers not properly using the connection.close() method. To ensure that connections will be closed properly, they should be closed in a finally{} block.

WebSphere is smart enough to eventually time out orphaned connections and return them to the pool, but for an application that makes frequent use of database connections, this might not be enough. New connections can get queued up waiting for the database while old connections are waiting to be timed out. This can bring the application grinding to a halt, and you can see connectionWaitExceptions.

The connection manager has lower performance impact than connection manager tracing. When activated, it enables a connection manager wrapper that holds the stack trace of all getConnection() calls in a throwable object. When an exception is thrown due to waiting on a full connection pool, print stack traces of all open connections. This enables you to significantly narrow your search area when you look at the application’s source code to try and find the responsible code.

Connection leaks have traditionally been hard to diagnose because the error messages do not usually provide specific enough information about the source of the problem. Usually a source code review is needed to find points in the code where connections are not properly closed. The connection manager makes this task much easier.



About Ishtiaque

I am IBM Certified Infrastructure Systems Architect, Linux Foundation Certified System Administrator, Oracle Certified Programmer in Java and Web Component Developer, and TOGAF 9 certified with over 10 years of support and development experience in IBM middleware software and Java. Additionally, have a sound grip in databases and OpenStack administration. I hold the following certifications: IBM Certified Infrastructure Systems Architect Linux Foundation Certified System Administrator (LFCS) TOGAF 9 Certified Oracle Certified Expert, Java EE6 Web Component Developer Oracle Certified Professional – Java 6 Programmer ITIL v3 Foundation Certified IBM Certified Solution Architect – Cloud Computing Infrastructure V1 IBM Certified System Administrator – WebSphere Portal V8, V7, V6.1, V6 IBM Certified System Administrator – WebSphere Application Server V7, V6.1 IBM Certified System Administrator – AIX V7 IBM Certified System Administrator – WebSphere MQ V7 IBM Certified Deployment Professional – Business Process Manager Advanced V7.5 IBM Certified Solution Advisor – Cloud Computing Architecture V3 IBM Certified Solution Developer – WebSphere Portal V5.1
This entry was posted in Java, WebSphere Application Server and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s