Proactive insights, news and tips from Oracle WebLogic Server Support. Learn Oracle from Oracle.

  • November 4, 2015

Connection Leak Profiling for WLS 12.2.1 Datasource

Stephen Felts

This is the first of a series of three articles that describes
enhancements to datasource profiling in WLS 12.2.1. These enhancements were requested by customers and Oracle support. I think they will be very useful in tracking
down problems in the application.

The pre-12.2.1 connection leak diagnostic profiling option
requires that the connection pool “Inactive Connection Timeout Seconds”
attribute be set to a positive value in order to determine how long before an
idle reserved connection is considered leaked. Once identified as being leaked, a connection is reclaimed and
information about the reserving thread is written out to the diagnostics
log. For applications that hold
connections for long periods of time, false positives can result in application
errors that complicate debugging. To
address this concern and improve usability, two enhancements to connection leak
profiling are available:

1. Connection leak
profile records will be produced for all reserved connections when the
connection pool reaches max capacity and a reserve request results in a
PoolLimitSQLException error.

2. An optional
Connection Leak Timeout Seconds attribute will be added to the datasource
descriptor for use in determining when a connection is considered
“leaked”. When an idle connection
exceeds the timeout value a leak profile log message is written and the
connection is left intact.

The existing connection leak profiling value (0x000004) must
be set on the datasource connection pool ProfileType attribute bitmask to
enable connection leak detection. Setting the ProfileConnectionLeakTimeoutSeconds attribute may be used in
place of InactiveConnectionTimeoutSeconds for identifying potential connection

This is a WLST script to set the values.

# java weblogic.WLST prof.py

import sys, socket, os

hostname = socket.gethostname()




# Edit the configuration to set the leak timeout



cd('/JDBCSystemResources/' + datasource + '/JDBCResource/' + datasource +
'/JDBCConnectionPoolParams/' +
datasource )

cmo.setProfileConnectionLeakTimeoutSeconds(120) # set the connection leak

cmo.setProfileType(0x000004) # turn on profiling




This is what the console page looks like after it is set.  Note the profile type and timeout value are set on the Diagnostics tab for the datasource.

The existing leak detection diagnostic profiling log record
format is used for leaks triggered by either the ProfileConnectionLeakTimeoutSeconds
attribute or when pool capacity is exceeded. In either case a log record is generated only once for each reserved
connection. If a connection is
subsequently released to pool, re-reserved and leaked again, a new record will
be generated. An example resource leak diagnostic
log record is shown below.  The output can be reviewed in the console or by looking at the datasource profile output text file.

<WEBLOGIC.JDBC.CONN.LEAK> <Thu Apr 09 14:00:22 EDT 2015>
at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:559)



currentUser=...,currentThread=Thread[[ACTIVE] ExecuteThread: '0' for queue:
'weblogic.kernel.Default (self-tuning)',5,Pooled

supportIsValid=true> <[partition-id: 0] [partition-name: DOMAIN] >

For applications that may have connection leaks but also have some valid long-running operations, you will now be able to scan through a list of connections that may be problems without interfering with normal application execution.

Join the discussion

Comments ( 3 )
  • Faisal Qadeer Friday, June 8, 2018
    Is setProfileConnectionLeakTimeoutSeconds is specific to Weblogic 12. That mbean property not working on 11g. I'm getting an error:

    Starting an edit session ...
    Started edit session, please be sure to save and activate your
    changes once you are done.
    Problem invoking WLST - Traceback (innermost last):
    File "enable_profile.py", line 14, in ?
    AttributeError: setProfileConnectionLeakTimeoutSeconds
  • Stephen Felts Wednesday, June 13, 2018
    As the title and text above indicate, this feature is first available in WLS 12.2.1. It is not available in earlier WLS releases.
  • Pat Malay Friday, August 24, 2018
    What is the performance implications of enabling Connection Leak Detection by setting the profile type to 4?

    Also if multiple types of profiling is required do we simply add the bit masks?

    Profile Type values are documented in

    However int values corresponding to them are not documented? Where do we get the values? For ex: if profile type need to be set only to usage weblogic.jdbc.common.internal.JDBCConstants.PROFILE_TYPE_CONN_USAGE whats the value? Educated guess will be 1.
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.