Sie sind auf Seite 1von 60

IBM Software Group

Understanding Information in J2C


Connection Pool Trace for IBM
Websphere Application Server V6.x
Marie Gann & Thu-Giang Pham

WebSphere Support Technical Exchange


IBM Software Group

Agenda

 Introduction
 Trace Options for J2C
 Terminology
 Resource Look Up
 Get Connection Request (LTC, User Tran)
 Connection Pool Dump
 Close Connection Request (LTC, User Tran)
 Connection Leak Logic

WebSphere Support Technical Exchange 2


IBM Software Group

Introduction
 IBM WebSphere Application Server V6.x provides implementation and
support for the new J2EE Connector Architecture (JCA) specification v1.5 as
part of the J2EE 1.4 platform.
 The JCA provides a standard mechanism that allows J2EE applications to
connect and use heterogeneous resources from
 Enterprise information systems (EIS)
 Relational database systems

 WebSphere provides client applications all system services:


 Connection manager
 Transaction manager
 Security management

 The IBM WebSphere Application Server J2C component provides


connection management based on JCA.
 This presentation helps to understand and interpret the information in a J2C
trace of WebSphere

WebSphere Support Technical Exchange 3


IBM Software Group

Trace Options
 WAS.j2c=all
 Includes all J2C classes
 ConnLeakLogic
 Part of WAS.j2c
 Enabled by default if WAS.j2c is enabled
 Can be disabled by setting
ConnLeakLogic=off
 Provides stack dump for connections that are in use more
than 10 seconds.
 ConnCloseLogic
 Not part of WAS.j2c
 Provides stack dump for connection close requests
 Must be entered manually in Trace Specification:
ConnCloseLogic=on

WebSphere Support Technical Exchange 4


IBM Software Group

Terminology
 J2C
 WebSphere Application Servers JCA implementation
 Application component
 Part of an application such as a servlet or EJB, normally
running on an application server
 RM (Resource Manager)
 Logical front-end which manages the resources of an
EIS (Enterprise Information System) or relational
database
 RA (Resource Adapter)
 Provides connectivity between an application component
and RM/EIS per the contracts specified in the JCA

WebSphere Support Technical Exchange 5


IBM Software Group

Terminology (Contd)
 Connection
 An object which provides connectivity to an EIS/Database for an
application component
 Connection pooling
 The pooling of connections means that Connections, when an
application is finished using them, are kept open with the RM in a
pool rather than actually being closed. A subsequent Connection
request by an application may then re-use a Connection from the pool
instead of Connections being constantly opened/closed with the
RM/EIS
 Pooling provides lower latency for Connection requests during typical
usage, while the number and size of the pools serves to limit the EIS
resources that may be consumed during peak usage periods

WebSphere Support Technical Exchange 6


IBM Software Group

Terminology (Contd)
 ConnectionFactory
 RA provides a ConnectionFactory as the interface for an
application component to request a Connection to the
EIS
 A DataSource is a JDBC-specific kind of
ConnectionFactory
 ConnectionManager
 JCA interface which provides the hook for the RA to
delegate a Connection request to the app server
 Each Resource has a unique ConnectionManager
 CRI (ConnectionRequestInfo)
 Contains the RAs own request-specific data

WebSphere Support Technical Exchange 7


IBM Software Group

Terminology (Contd)
 MCF (ManagedConnectionFactory)
 RA interface for the app server to match and create ManagedConnections.
 MC (ManagedConnection)
 RA interface to represent an EIS Connection to the app server.
 MCW (ManagedConnectionWrapper)
 A wrapper object used by J2C to manage the state of MC objects.
 An MCW can have the following states:
STATE_NEW initial state, before first use.
STATE_ACTIVE_FREE not allocated to any user.
STATE_ACTIVE_INUSE allocated to a user, but not currently used in a
transaction.
STATE_TRAN_WRAPPER_INUSE allocated to a user, and associated
with a transaction.
STATE_INACTIVE no longer associated with a MC or a connection pool,
the MCW is parked in a MCW pool (distinct from any connection pool) for
possible later reuse.

WebSphere Support Technical Exchange 8


IBM Software Group

Terminology (Contd)
 Connection Handle
 Java Object returned to application when a get connection request is
executed
 Is a reference to the RAs managed connection object
 ConnectionEventListener
 An application server interface for a ManagedConnection object to
make callbacks to the app server to report significant events in the
Connection life cycle
 PoolManager
 J2C object which implements a connection pool.
 One PoolManager per ConnectionFactory.
 A J2C connection pool can be thought of as having 3 sub-pools:
Free pool
Shareable connection pool
Unshareable connection pool

WebSphere Support Technical Exchange 9


IBM Software Group

Terminology (Contd)
 Shareable Connection
 Sharing a connection can only happen within a sharing scope. The most
common sharing scope is a transaction scope where multiple active
connection handles can share the same physical connection
A global transaction is either a user transaction initiated by the J2EE
application, or a container global transaction initiated by the
Application Server Enterprise Java Bean (EJB) container
Local Transaction Containment (LTC) is always established by the
container in the absence of a global transaction
 Allows for multiple getConnection requests by different parts of an
application to each be provided with their own reference (or handle) to the
same Managed Connection simultaneously (user tran only) or serially
(LTC)
 Reduces the Connection resources required by an application

WebSphere Support Technical Exchange 10


IBM Software Group

Terminology (Contd)
 Several conditions must be met for a Shareable Connection
to actually be shared. If any of the following requirements is
not met, two getConnection calls will return two distinct
physical (managed) connections:
 Java Naming and Directory Interface (JNDI) name
 Resource authentication setting
 Principal
 Connection transaction isolation level property
 Connection readOnly, catalog, and typeMap properties

WebSphere Support Technical Exchange 11


IBM Software Group

Terminology (Contd)
 Unshareable Connection
 An unshareable connection is not shared with other
components in the application
 The component using this connection has full control of
this connection
 See Information Center Topic Unshareable and
shareable connections at URL for more information:
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/topic/co
m.ibm.websphere.nd.doc/info/ae/ae/cdat_conshrnon.html

WebSphere Support Technical Exchange 12


IBM Software Group

Terminology (Contd)
 Local transaction containment (LTC)
 LTC is used to define the application server behavior in an unspecified
transaction context
 Unspecified transaction context is defined in the Enterprise
JavaBeans 2.0 (or later) specification; for example, at
http://java.sun.com/products/ejb/2.0.html
 A LTC is a bounded unit-of-work (UOW) scope, within which zero, one, or
more resource manager local transactions (RMLTs) can be accessed.
 The LTC defines the boundary at which all RMLTs must be complete; any
incomplete RMLTs are resolved, according to policy, by the
 Container
 For more information, see Information Center section Local transaction
containment (LTC) at URL:
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/topic/com.ibm.w
ebsphere.base.doc/info/aes/ae/cjta_loctran.html

WebSphere Support Technical Exchange 13


IBM Software Group

During Application Server Startup


 Signals the J2C RALifeCycleManager to start the
RA. The RA properties are used to initialize the RA
instance.
 WebSphere runtime innvokes
createConnectorReferenceableObject in J2C to
create a Referenceable for each
ConnectionFactory or DataSource. This
Referenceable is bound in the JNDI namespace.

WebSphere Support Technical Exchange 14


IBM Software Group

During Application Server Startup - Trace


[4/23/07 22:29:14:131 CDT] 0000000a RALifeCycleMa > startRA Entry
[4/23/07 22:29:14:131 CDT] 0000000a RALifeCycleMa 3
<---- J2C Resource Adapter Configuration Data ---->
Name = WebSphere Relational Resource Adapter
RAKey =
cells/mariestp2Node01Cell/nodes/mariestp2Node01/resources.xml#bui
ltin_rra
|-- J2C ConnectionFactory(s) Configuration Data --|
----------------------------------------------
CF Name = DB2 Universal JDBC Driver DataSource_CF
CF JNDIName = eis/jdbc/snoop_CMP
CF ConfigID =
cells/mariestp2Node01Cell/nodes/mariestp2Node01/resources.xml#CMP
ConnectorFactory_1173735789744
----------------------------------------------
CF Name = DB2 Universal JDBC Driver DataSource_CF
CF JNDIName = eis/jdbc/snoop2_CMP
CF ConfigID =
cells/mariestp2Node01Cell/nodes/mariestp2Node01/resources.xml#CMP
ConnectorFactory_1177338199278
<---- End J2C Resource Adapter Configuration Data ---->

WebSphere Support Technical Exchange 15


IBM Software Group

During Application Server Startup - Trace


[4/23/07 22:29:14:301 CDT] 0000000a ConnectionFac >
createConnectorReferenceableObject Entry
[4/23/07 22:29:14:301 CDT] 0000000a ConnectionFac 3 input parm1
Properties = <connectionImplClass :
com.ibm.ws.rsadapter.cci.WSRdbConnectionImpl
connectionFactoryInterface : javax.resource.cci.ConnectionFactory
specVersion : 1.5
stuckThreshold : 0
j2ee.resource.factory.href :
cells/mariestp2Node01Cell/nodes/mariestp2Node01/resources.xml#DataS
ource_1173735789744
j2c.adapter.licenseRequired : false
testConnection : false
j2c.adapter.largeIcon :
com.ibm.etools.j2ee.common.impl.IconTypeImpl@7a90ff4f (smallIcon:
rdb_small_icon.jpg, largeIcon: rdb_large_icon.jpg, lang: null)
FactoryJndiName : jdbc/snoop
reapTime : 180
name : DB2 Universal JDBC Driver DataSource
j2ee.resource.provider.href :
cells/mariestp2Node01Cell/nodes/mariestp2Node01/resources.xml#JDBCP
rovider_1173735749897
description : DB2 Universal Driver Datasource
*

WebSphere Support Technical Exchange 16


IBM Software Group

When Application Does a JNDI Lookup


 An application does a JNDI lookup, using the JNDI name of a resource
reference defined in the application (local namespace)
InitialContext context = new InitialContext();
// Indirect JNDI lookup J2EE recommended way
DataSource ds = context.lookup(java:comp/env/jdbc/myDataSource);
// Direct JNDI lookup - not recommended
DataSource ds = context.lookup(jdbc/myDataSource);

 A resource reference can have unique attributes that specify properties of


the desired connection, for example:
 Resource authentication method
 Isolation level
 Various other transactional properties
 An application (or applications) can have different ways of using the same
ConnectionFactory using multiple resource references having different
attributes.

WebSphere Support Technical Exchange 17


IBM Software Group

On the First JNDI Lookup


 JNDI will call the J2C ConnectionFactoryBuilder
getObjectInstance method identified by the bound
Referenceable in JNDI
 The MCF, CF, and PoolManager objects are created using
the properties defined in the WebSphere configuration
 A ConnectionManager instance is created using
CMConfigData created from the attributes on the resource
reference
 The getObjectInstance method returns a reference to the
ConnectionFactory to JNDI which caches it, and returns the
reference to the application in response to the lookup

WebSphere Support Technical Exchange 18


IBM Software Group

On the First JNDI Lookup - Trace


[4/23/07 12:08:49:296 CDT] 0000001b ConnectionFac > getObjectInstance for
jdbc/snoop Entry
[4/23/07 12:08:49:316 CDT] 0000001b J2CUtilityCla 3 component-managed
UserName from alias or custom props is mdgann
****[4/23/07 22:29:29:232 CDT] 0000001a J2CUtilityCla 3 component-managed
alias UserName blank or null. Using Custom Property UserName, Password.
****[4/23/07 22:29:29:232 CDT] 0000001a J2CUtilityCla 3 component-managed
UserName from alias or custom props is blank or null
[4/23/07 12:08:49:316 CDT] 0000001b PoolManager > PoolManager <init> Entry
[4/23/07 12:08:49:316 CDT] 0000001b PoolManager 3 Initial pool properties
used by PoolManager jdbc/snoop
[4/23/07 12:08:49:316 CDT] 0000001b PoolManager 3 Connection Timeout = 180)
[4/23/07 12:08:49:316 CDT] 0000001b PoolManager 3 Maximum Connections = 10
[4/23/07 12:08:49:316 CDT] 0000001b PoolManager 3 Minimum Connections = 1
[4/23/07 12:08:49:316 CDT] 0000001b PoolManager 3 Purge Policy = EntirePool
[4/23/07 12:08:49:316 CDT] 0000001b PoolManager 3 Unused Timeout = 1800)

WebSphere Support Technical Exchange 19


IBM Software Group

On the First JNDI Lookup Trace (Contd)

 direct Lookup
[4/23/07 22:29:29:242 CDT] 0000001a ConnectionFac 3 resRefOrBeanName used
to create CMConfigData is: null
[4/23/07 12:08:49:316 CDT] 0000001b ConnectionFac W J2CA0294W: Deprecated
usage of direct JNDI lookup of resource jdbc/snoop. The following default
values are used:
[Resource-ref settings]
res-auth: 1 (APPLICATION) <<< Component
res-isolation-level: 0 (TRANSACTION_NONE)
res-sharing-scope: true (SHAREABLE)

 Indirect Lookup
[4/17/07 15:40:26:891 PDT] 00000026 ConnectionFac 3 resRefOrBeanName
used to create CMConfigData is: jdbc/myimsdb1
[4/17/07 15:40:26:906 PDT] 00000026 ConnectionFac 3 Using CMConfigData
values:
[Resource-ref settings]
res-auth: 0 (CONTAINER)
res-isolation-level: 4 (TRANSACTION_REPEATABLE_READ)
res-sharing-scope: true (SHAREABLE)

WebSphere Support Technical Exchange 20


IBM Software Group

On the First JNDI Lookup Trace (Contd)

[4/23/07 12:08:49:377 CDT] 0000001b J2CXAResource < readObject Exit


DB2 Universal JDBC Driver DataSource
[Deployed Resource Adapter Properties]
OptionC_authDataAlias java.lang.String mariestp2Node01/snoop
[Resource Adapter DD]
{traceLevel=, reauthentication=false,
enableMultithreadedAccessDetection=false, traceFile=,
dataSourceClass=com.ibm.db2.jcc.DB2ConnectionPoolDataSource,
clientApplicationInformation=,
[Resource-ref settings]
res-auth: 1 (APPLICATION) << Component
res-isolation-level: 0 (TRANSACTION_NONE)
res-sharing-scope: true (SHAREABLE)
loginConfigurationName: null
loginConfigProperties: null

WebSphere Support Technical Exchange 21


IBM Software Group

On the First JNDI Lookup Trace (Contd)


[4/23/07 12:08:49:377 CDT] 0000001b ConnectionMan 3 This brings
the total no. of CM instances to 2
[4/23/07 12:08:49:377 CDT] 0000001b ConnectionMan <
ConnectionManager<init> Exit
[4/23/07 12:08:49:377 CDT] 0000001b ConnectionFac 3 instantiated
cm 568ef795
[4/23/07 12:08:49:377 CDT] 0000001b ConnectionFac <
getObjectInstance Exit

WebSphere Support Technical Exchange 22


IBM Software Group

getConnection (LTC)
 Application component calls the getConnection method on the
ConnectionFactory/DataSource instance in the RA, looked up via JNDI:
ds.getConnection();

 ConnectionFactory in RA does any RA-specific handling, and then


delegates the Connection request to J2C by calling allocateConnection
on its associated ConnectionManager instance.
 CRI constructed by the RA is provided in the allocateConnection call
 ConnectionManager instance collects security credentials, transactional
and other information, and calls the reserve method on the PoolManager
corresponding to the ConnectionFactory.
 The security Subject (if any) or user/pw, CRI, and transaction ID are
passed on the PoolManager.reserve call.
 Auto Commit is set to true for the following LTC trace example

WebSphere Support Technical Exchange 23


IBM Software Group

getConnection (LTC) - Trace


[4/23/07 22:29:30:334 CDT] 0000001a ConnectionMan > allocateConnection in cm
765525853 Entry
[4/23/07 22:29:30:334 CDT] 0000001a ConnectionMan 3 This CM is
[ConnectionManager]@2da0ff5d
JNDI Name <jdbc/snoop>
shareable <true>
[4/23/07 22:29:30:334 CDT] 0000001a PoolManager > reserve Entry
[4/23/07 22:29:30:334 CDT] 0000001a PoolManager 3 input parms...
subject = null affinity =
com.ibm.ws.LocalTransaction.LocalTranCoordImpl@c9c3f4f;RUNNING;
Shared connection = true
UserName = null
Password = null
Catalog = null
IsReadOnly = null
TypeMap = null
Holdability = DEFAULT CURSOR HOLDABILITY VALUE (0)
ConfigID = 0
Isolation = REPEATABLE READ (4)
Support isolation switching = true
Handle type = java.sql.Connection

WebSphere Support Technical Exchange 24


IBM Software Group

getConnection (LTC) Trace (Contd)


4/23/07 22:29:30:334 CDT] 0000001a PoolManager 3 reserve(), Pool contents
==> PoolManager name:jdbc/snoop
PoolManager object:441057116
Total number of connections: 1 (max/min 10/1, reap/unused/aged 180/1800/0,
connectiontimeout/purge 180/EntirePool)
(testConnection/inteval false/0, stuck
timer/time/threshold 0/0/0, surge time/connections 0/-1)
Shared Connection information (shared partitions 200)
com.ibm.ws.LocalTransaction.LocalTranCoordImpl@c9c3f4f;RUNNING;
MCWrapper id 3bebff47 Managed connection
WSRdbManagedConnectionImpl@1c1e7f47 State:STATE_TRAN_WRAPPER_INUSE Thread
Id: a8ebf42 Thread Name: WebContainer : 0 Handle count 0
Total number of connection in shared pool: 1
Free Connection information (free distribution table/partitions 5/1)
No free connections
UnShared Connection information
No unshared connections

WebSphere Support Technical Exchange 25


IBM Software Group

getConnection (LTC) Trace (Contd)


[4/23/07 22:29:30:334 CDT] 0000001a SharedPool > getSharedConnection
Entry
[4/23/07 22:29:30:334 CDT] 0000001a SharedPool < getSharedConnection,
returning mcWrapper Exit
MCWrapper id 3bebff47 Managed connection
WSRdbManagedConnectionImpl@1c1e7f47 State:STATE_TRAN_WRAPPER_INUSE Thread
Id: a8ebf42 Thread Name: WebContainer : 0 Handle count 0
[4/23/07 22:29:30:334 CDT] 0000001a PoolManager 3 reserve()
PoolManager name:jdbc/snoop
PoolManager object:441057116
Total number of connections: 1 (max/min 10/1, reap/unused/aged 180/1800/0,
connectiontimeout/purge 180/EntirePool)
(testConnection/inteval false/0, stuck
timer/time/threshold 0/0/0, surge time/connections 0/-1)
Shared Connection information (shared partitions 200)
com.ibm.ws.LocalTransaction.LocalTranCoordImpl@c9c3f4f;RUNNING;
MCWrapper id 3bebff47 Managed connection
WSRdbManagedConnectionImpl@1c1e7f47 State:STATE_TRAN_WRAPPER_INUSE Thread
Id: a8ebf42 Thread Name: WebContainer : 0 Handle count 0
Total number of connection in shared pool: 1
Free Connection information (free distribution table/partitions 5/1)
No free connections
UnShared Connection information
No unshared connections

WebSphere Support Technical Exchange 26


IBM Software Group

getConnection (LTC) - Trace(Contd)


RETURNS: MCWrapper id 3bebff47 Managed connection
WSRdbManagedConnectionImpl@1c1e7f47 State:STATE_TRAN_WRAPPER_INUSE Thread
Id: a8ebf42 Thread Name: WebContainer : 0 Handle count 0
[4/23/07 22:29:30:334 CDT] 0000001a PoolManager < reserve Exit
[4/23/07 22:29:30:334 CDT] 0000001a ConnectionMan < allocateMCWrapper Exit
[4/23/07 22:29:30:334 CDT] 0000001a MCWrapper 3 involvedInTransaction:
true
[4/23/07 22:29:30:334 CDT] 0000001a MCWrapper > getConnection Entry
[4/23/07 22:29:30:334 CDT] 0000001a MCWrapper < getConnection: Exit
com.ibm.ws.rsadapter.jdbc.WSJccSQLJConnection@4d683f4f
[4/23/07 22:29:30:334 CDT] 0000001a ConnectionMan < allocateConnection
4d683f4f Exit

WebSphere Support Technical Exchange 27


IBM Software Group

Connection Close
 When a MC is created, J2C calls addConnectionEventListener
on the MC to register a J2C Listener with the
ManagedConnection
 The MC must send a ConnectionEvent to all registered listeners
to notify them when a Connection handle is closed by the
application, when an error occurs which makes the Connection
unusable, or when certain LocalTransaction events occur.
 This gives J2C the information it needs to decide when to
release a connection to the Free pool, mark an MC for
cleanup/destruction, or to update transaction related state
information

WebSphere Support Technical Exchange 28


IBM Software Group

Close Connection (LTC not complete)


Sample code
ds =(javax.sql.DataSource) ctx.lookup("jdbc/snoop");
Connection con1 = null ;
try {
con1 = ds.getConnection();
con1.close;
Trace
[4/23/07 22:29:30:434 CDT] 0000001a ConnectionEve > connectionClosed Entry
[4/23/07 22:29:30:434 CDT] 0000001a ConnectionEve 3 ***Connection Close
Request*** Handle Name:
com.ibm.ws.rsadapter.jdbc.WSJccSQLJConnection@58a27f50 Connection
Pool: jdbc/snoop Details: : MCWrapper id 2b3e7f50 Managed connection
WSRdbManagedConnectionImpl@2b7bff50 State:STATE_TRAN_WRAPPER_INUSE Thread
Id: a8ebf42 Thread Name: WebContainer : 0 Handle count 1
[4/23/07 22:29:30:434 CDT] 0000001a MCWrapper 3 involvedInTransaction:
true
[4/23/07 22:29:30:434 CDT] 0000001a ConnectionEve < connectionClosed Exit

WebSphere Support Technical Exchange 29


IBM Software Group

Connection Leak in an LTC


 LTC leak can cause deadlock in back-end data store
 It is a common problem when migrating application from WebSphere v4.0 to v5.x and
greater
 Can occur when servlets are migrated from v2.2 to v2.3

 See this technote for more details:


http://www-01.ibm.com/support/docview.wss?uid=swg21121449
 LTC leak is caused when application does not close connections handle between
uses or does not meet the requirements for connection sharing
 Example getConnection without closing connection in LTC

ds = (javax.sql.DataSource) ctx.lookup("jdbc/snoop");
Connection con1 = null;
Connection con2 = null;
try {
con1 = ds.getConnection();
con2 = ds.getConnection();

WebSphere Support Technical Exchange 30


IBM Software Group

Connection Leak in an LTC - Trace


[4/23/07 22:29:30:334 CDT] 0000001a ConnectionMan 3 This CM is
[ConnectionManager]@2da0ff5d
JNDI Name <jdbc/snoop>
shareable <true>
[4/23/07 22:29:30:334 CDT] 0000001a ConnectionMan > allocateMCWrapper Entry
[4/23/07 22:29:30:334 CDT] 0000001a PoolManager > reserve Entry
[4/23/07 22:29:30:334 CDT] 0000001a PoolManager 3 input parms...
subject = null affinity =
com.ibm.ws.LocalTransaction.LocalTranCoordImpl@c9c3f4f;RUNNING;
Shared connection = true
UserName = null
Password = null
Catalog = null
IsReadOnly = null
TypeMap = null
Holdability = DEFAULT CURSOR HOLDABILITY VALUE (0)
ConfigID = 0
Isolation = REPEATABLE READ (4)
Support isolation switching = true
Handle type = java.sql.Connection

WebSphere Support Technical Exchange 31


IBM Software Group

Connection Leak in an LTC Trace (Contd)


[4/23/0722:29:30:334 CDT] 0000001a PoolManager 3 reserve(), Pool
contents ==> PoolManager name:jdbc/snoop
PoolManager object:441057116
Total number of connections: 1 (max/min 10/1, reap/unused/aged 180/1800/0,
connectiontimeout/purge 180/EntirePool)
(testConnection/inteval false/0, stuck
timer/time/threshold 0/0/0, surge time/connections 0/-1)
Shared Connection information (shared partitions 200)
com.ibm.ws.LocalTransaction.LocalTranCoordImpl@c9c3f4f;RUNNING; MCWrapper id
3bebff47 Managed connection WSRdbManagedConnectionImpl@1c1e7f47
State:STATE_TRAN_WRAPPER_INUSE Thread Id: a8ebf42 Thread Name: WebContainer
: 0 Handle count 1
Total number of connection in shared pool: 1
Free Connection information (free distribution table/partitions 5/1)
No free connections
UnShared Connection information
No unshared connections

WebSphere Support Technical Exchange 32


IBM Software Group

Connection Leak in an LTC Trace (Contd)


[4/23/07 22:29:30:334 CDT] 0000001a PoolManager 3 Searching for
shared connection in partition 15
[4/23/07 22:29:30:334 CDT] 0000001a SharedPool >
getSharedConnection Entry
[4/23/07 22:29:30:334 CDT] 0000001a SharedPool 3
allocateConnection_Common: HandleCount = 1
[4/23/07 22:29:30:334 CDT] 0000001a SharedPool I J2CA0086W:
Shareable connection MCWrapper id 3bebff47 Managed connection
WSRdbManagedConnectionImpl@1c1e7f47
State:STATE_TRAN_WRAPPER_INUSE Thread Id: a8ebf42 Thread Name:
WebContainer : 0 Handle count 1
from resource jdbc/snoop was used within a local transaction ontainment boundary.
[4/23/07 22:29:30:344 CDT] 0000001a SharedPool 3 Attempt to
share connection within LTC (J2CA0086)
[4/23/07 22:29:30:344 CDT] 0000001a SharedPool 3 mcWrapper =
MCWrapper id 3bebff47 Managed connection
WSRdbManagedConnectionImpl@1c1e7f47
State:STATE_TRAN_WRAPPER_INUSE Thread Id: a8ebf42 Thread Name:
WebContainer : 0 Handle count 1

WebSphere Support Technical Exchange 33


IBM Software Group

Connection Leak in an LTC Trace (Contd)


[4/23/07 22:29:30:344 CDT] 0000001a LtcLeakLogic 3 Current
connection request stack trace for LTC
com.ibm.ws.LocalTransaction.LocalTranCoordImpl@c9c3f4f;RUNNING;
[4/23/07 22:29:30:344 CDT] 0000001a LtcLeakLogic 3
getConnection stack trace information:
com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionMan
ager.java:868)
com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionMa
nager.java:617)
com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDa
taSource.java:402)
com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDa
taSource.java:371)
SnoopServlet.doGet(SnoopServlet.java:325)

WebSphere Support Technical Exchange 34


IBM Software Group

Connection Leak in an LTC Trace (Contd)


[4/23/07
22:29:30:344 CDT] 0000001a LtcLeakLogic 3 Previous
connection request stack trace for LTC
com.ibm.ws.LocalTransaction.LocalTranCoordImpl@c9c3f4f;RUNNING;
[4/23/07 22:29:30:344 CDT] 0000001a LtcLeakLogic 3
getConnection stack trace information:
com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionMa
nager.java:744)
com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDa
taSource.java:402)
com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDa
taSource.java:371)
SnoopServlet.doGet(SnoopServlet.java:277)

WebSphere Support Technical Exchange 35


IBM Software Group

Connection Leak in an LTC Trace (Contd)


[4/23/07 22:29:30:354 CDT] 0000001a SharedPool < getSharedConnection,
returning mcWrapper Exit
<null>
[4/23/07 22:29:30:354 CDT] 0000001a FreePool >
createManagedConnectionWithMCWrapper Entry
[4/23/07 22:29:30:434 CDT] 0000001a MCWrapper > MCWrapper <init> Entry
[4/23/07 22:29:30:434 CDT] 0000001a MCWrapper 3 Connection created time
1177385370434 for mcw MCWrapper id 2b3e7f50 Managed connection
WSRdbManagedConnectionImpl@2b7bff50 State:STATE_NEW
[4/23/07 22:29:30:434 CDT] 0000001a FreePool 3 Createing deferrable
alarm for reaper
[4/23/07 22:29:30:434 CDT] 0000001a FreePool <
createManagedConnectionWithMCWrapper MCWrapper id 2b3e7f50 Managed
connection WSRdbManagedConnectionImpl@2b7bff50 State:STATE_ACTIVE_FREE
[
4/23/07 22:29:30:434 CDT] 0000001a FreePool 3 Returning mcWrapper
[4/23/07 22:29:30:434 CDT] 0000001a FreePool 3 Returning mcWrapper
MCWrapper id 2b3e7f50 Managed connection
WSRdbManagedConnectionImpl@2b7bff50 State:STATE_ACTIVE_FREE
[4/23/07 22:29:30:434 CDT] 0000001a MCWrapper < markInUse Exit
[4/23/07 22:29:30:434 CDT] 0000001a SharedPool > setSharedConnection
Entry
[4/23/07 22:29:30:434 CDT] 0000001a SharedPool < setSharedConnection Exit

WebSphere Support Technical Exchange 36


IBM Software Group

Connection Leak in an LTC Trace (Contd)


[4/23/07 22:29:30:434 CDT] 0000001a PoolManager 3 reserve()
PoolManager name:jdbc/snoop
PoolManager object:441057116
Total number of connections: 2 (max/min 10/1, reap/unused/aged 180/1800/0,
connectiontimeout/purge 180/EntirePool)
(testConnection/inteval false/0, stuck
timer/time/threshold 0/0/0, surge time/connections 0/-1)
Shared Connection information (shared partitions 200)
com.ibm.ws.LocalTransaction.LocalTranCoordImpl@c9c3f4f;RUNNING; MCWrapper
id 2b3e7f50 Managed connection WSRdbManagedConnectionImpl@2b7bff50
State:STATE_ACTIVE_INUSE
com.ibm.ws.LocalTransaction.LocalTranCoordImpl@c9c3f4f;RUNNING; MCWrapper
id 3bebff47 Managed connection WSRdbManagedConnectionImpl@1c1e7f47
State:STATE_TRAN_WRAPPER_INUSE Thread Id: a8ebf42 Thread Name: WebContainer
: 0 Handle count 1
Total number of connection in shared pool: 2
Free Connection information (free distribution table/partitions 5/1)
No free connections
UnShared Connection information
No unshared connections

WebSphere Support Technical Exchange 37


IBM Software Group

Connection Leak in an LTC Trace (Contd)


RETURNS: MCWrapper id 2b3e7f50 Managed connection
WSRdbManagedConnectionImpl@2b7bff50 State:STATE_ACTIVE_INUSE
[4/23/07 22:29:30:434 CDT] 0000001a PoolManager 3 reserved managed
connection WSRdbManagedConnectionImpl@2b7bff50
[4/23/07 22:29:30:434 CDT] 0000001a PoolManager < reserve Exit
[4/23/07 22:29:30:434 CDT] 0000001a ConnectionMan 3 Using
MCWrapper@2b3e7f50
[4/23/07 22:29:30:434 CDT] 0000001a ConnectionMan < allocateMCWrapper Exit
[4/23/07 22:29:30:434 CDT] 0000001a ConnectionMan > involveMCInTran Entry
[4/23/07 22:29:30:434 CDT] 0000001a MCWrapper 3 involvedInTransaction:
false
[4/23/07 22:29:30:434 CDT] 0000001a ConnectionMan > initializeForUOW Entry
[4/23/07 22:29:30:434 CDT] 0000001a ConnectionMan 3 Transaction context
exists
[4/23/07 22:29:30:434 CDT] 0000001a MCWrapper >
getLocalTransactionWrapper Entry
[4/23/07 22:29:30:434 CDT] 0000001a MCWrapper <
getLocalTransactionWrapper Exit
[4/23/07 22:29:30:434 CDT] 0000001a ConnectionMan 3 Created transaction
wrapper@5bfaff50

WebSphere Support Technical Exchange 38


IBM Software Group

Connection Leak in an LTC Trace (Contd)


[4/23/07 22:29:30:434 CDT] 0000001a LocalTransact > addSync Entry
[4/23/07 22:29:30:434 CDT] 0000001a MCWrapper >
markLocalTransactionWrapperInUse Entry
[4/23/07 22:29:30:434 CDT] 0000001a MCWrapper <
markLocalTransactionWrapperInUse Exit
[4/23/07 22:29:30:434 CDT] 0000001a LocalTransact < addSync: true
Exit
[4/23/07 22:29:30:434 CDT] 0000001a CMConfigDataI 3
getResolutionControl returning 0
[4/23/07 22:29:30:434 CDT] 0000001a ConnectionMan <
initializeForUOW Exit
[4/23/07 22:29:30:434 CDT] 0000001a ConnectionMan <
involveMCInTran Exit
[4/23/07 22:29:30:434 CDT] 0000001a MCWrapper > getConnection
Entry
[4/23/07 22:29:30:434 CDT] 0000001a MCWrapper < getConnection:
Exit
com.ibm.ws.rsadapter.jdbc.WSJccSQLJConnection@58a27f50
[4/23/07 22:29:30:434 CDT] 0000001a ConnectionMan <
allocateConnection 58a27f50 Exit

WebSphere Support Technical Exchange 39


IBM Software Group

Release Connection When LTC Completes


[4/23/07 22:29:30:434 CDT] 0000001a LocalTransact > beforeCompletion
Entry
[4/23/07 22:29:30:434 CDT] 0000001a LocalTransact < beforeCompletion
Exit
[4/23/07 22:29:30:434 CDT] 0000001a LocalTransact > afterCompletion
Entry
[4/23/07 22:29:30:444 CDT] 0000001a LocalTransact 3 Using
transaction wrapper@5bfaff50
[4/23/07 22:29:30:444 CDT] 0000001a LocalTransact 3 Releasing the connection to the pool.
shareable = true handleCount = 0 isStale = false
4/23/07 22:29:30:444 CDT] 0000001a PoolManager > release Entry
[4/23/07 22:29:30:444 CDT] 0000001a PoolManager 3 input parms...
MC = MCWrapper id 2b3e7f50 Managed connection
WSRdbManagedConnectionImpl@2b7bff50 State:STATE_ACTIVE_INUSE
Thread Id: a8ebf42 Thread Name: WebContainer : 0 Handle count 0
input affinity =
com.ibm.ws.LocalTransaction.LocalTranCoordImpl@c9c3f4f;COMPLETED;

WebSphere Support Technical Exchange 40


IBM Software Group

Release Connection When LTC Completes


[4/23/07 22:29:30:444 CDT] 0000001a PoolManager 3 release(),
Pool contents ==> PoolManager name:jdbc/snoop
PoolManager object:441057116
Total number of connections: 2 (max/min 10/1, reap/unused/aged
180/1800/0, connectiontimeout/purge 180/EntirePool)
(testConnection/inteval false/0,
stuck timer/time/threshold 0/0/0, surge time/connections 0/-1)
Shared Connection information (shared partitions 200)
com.ibm.ws.LocalTransaction.LocalTranCoordImpl@c9c3f4f;COMPLETE
D; MCWrapper id 2b3e7f50 Managed connection
WSRdbManagedConnectionImpl@2b7bff50 State:STATE_ACTIVE_INUSE
Thread Id: a8ebf42 Thread Name: WebContainer : 0 Handle count 0
Total number of connection in shared pool: 1
Free Connection information (free distribution table/partitions 5/1)
(0)(0)MCWrapper id 3bebff47 Managed connection
WSRdbManagedConnectionImpl@1c1e7f47 State:STATE_ACTIVE_FREE
Total number of connection in free pool: 1
UnShared Connection information
No unshared connections

WebSphere Support Technical Exchange 41


IBM Software Group

Release Connection When LTC Completes


[4/23/07 22:29:30:444 CDT] 0000001a SharedPool >
removeSharedConnection Entry
[4/23/07 22:29:30:444 CDT] 0000001a SharedPool 3 Removed
connection
[4/23/07 22:29:30:444 CDT] 0000001a SharedPool <
removeSharedConnection Exit
[4/23/07 22:29:30:444 CDT] 0000001a FreePool >
returnToFreePool, datasource: jdbc/snoop Entry
[4/23/07 22:29:30:444 CDT] 0000001a MCWrapper > cleanup Entry
[4/23/07 22:29:30:444 CDT] 0000001a MCWrapper 3 InstanceOf
DissociatableManagedConnection is true In ConnectionManager
MCWrapper id 2b3e7f50 Managed connection
WSRdbManagedConnectionImpl@2b7bff50 State:STATE_ACTIVE_INUSE
Thread Id: a8ebf42 Thread Name: WebContainer : 0 Handle count 0
[4/23/07 22:29:30:444 CDT] 0000001a MCWrapper 3 Calling
mc.dissociateConnections()
[4/23/07 22:29:30:444 CDT] 0000001a MCWrapper 3 Returned from
mc.dissociateConnections()
[4/23/07 22:29:30:444 CDT] 0000001a MCWrapper < cleanup Exit
[4/23/07 22:29:30:444 CDT] 0000001a FreePool <
returnToFreePool Exit

WebSphere Support Technical Exchange 42


IBM Software Group

Release Connection When LTC Completes


[4/23/07 22:29:30:444 CDT] 0000001a PoolManager 3 release(), Pool contents
==> PoolManager name:jdbc/snoop
PoolManager object:441057116
Total number of connections: 2 (max/min 10/1, reap/unused/aged 180/1800/0,
connectiontimeout/purge 180/EntirePool)
(testConnection/inteval false/0, stuck
timer/time/threshold 0/0/0, surge time/connections 0/-1)
Shared Connection information (shared partitions 200)
No shared connections
Free Connection information (free distribution table/partitions 5/1)
(0)(0)MCWrapper id 2b3e7f50 Managed connection
WSRdbManagedConnectionImpl@2b7bff50 State:STATE_ACTIVE_FREE
(0)(0)MCWrapper id 3bebff47 Managed connection
WSRdbManagedConnectionImpl@1c1e7f47 State:STATE_ACTIVE_FREE
Total number of connection in free pool: 2
UnShared Connection information
No unshared connections
[4/23/07 22:29:30:444 CDT] 0000001a PoolManager 3 released managed
connection WSRdbManagedConnectionImpl@2b7bff50
[4/23/07 22:29:30:444 CDT] 0000001a PoolManager < release Exit
[4/23/07 22:29:30:444 CDT] 0000001a LocalTransact < afterCompletion

WebSphere Support Technical Exchange 43


IBM Software Group

Connection Close Logic


 Recently added to aid the detection of connection handles being
incorrectly used such as
 Finalizer doing connection closes
 Passing Connection handles between threads
 Must enable trace manually ConnCloseLogic=on
[4/23/07 22:29:30:434 CDT] 0000001a ConnectionEve > connectionClosed Entry
[4/23/07 22:29:30:434 CDT] 0000001a ConnCloseLogi 3 Connection Close Request Stack:
Java.lang.Throwable
at
com.ibm.ejs.j2c.ConnectionEventListener.connectionClosed(ConnectionEventListener.java:169)
at
com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.processConnectionClosedEvent(WSRdbManag
edConnectionImpl.java:1477)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.closeWrapper(WSJdbcConnection.java:724)
at com.ibm.ws.rsadapter.jdbc.WSJccConnection.closeWrapper(WSJccConnection.java:694)
at com.ibm.ws.rsadapter.jdbc.WSJdbcObject.close(WSJdbcObject.java:144)
at com.ibm.ws.rsadapter.jdbc.WSJdbcObject.close(WSJdbcObject.java:103)
at SnoopServlet.doGet(SnoopServlet.java:351)
[4/23/07 22:29:30:434 CDT] 0000001a ConnectionEve 3 ***Connection Close Request*** Handle
Name: com.ibm.ws.rsadapter.jdbc.WSJccSQLJConnection@58a27f50 Connection Pool: jdbc/snoop
Details: : MCWrapper id 2b3e7f50 Managed connection WSRdbManagedConnectionImpl@2b7bff50
State:STATE_TRAN_WRAPPER_INUSE Thread Id: a8ebf42 Thread Name: WebContainer : 0 Handle
count 1
[4/23/07 22:29:30:434 CDT] 0000001a MCWrapper 3 involvedInTransaction: true
[4/23/07 22:29:30:434 CDT] 0000001a ConnectionEve < connectionClosed Exit

WebSphere Support Technical Exchange 44


IBM Software Group

getConnection for User Transaction

ds = (javax.sql.DataSource) ctx.lookup("jdbc/snoop");
Connection con1 = null ;
UserTransaction ut = ctx.lookup("java:comp/UserTransaction");

ut.begin();
con1 = ds.getConnection();

WebSphere Support Technical Exchange 45


IBM Software Group

getConnection for User Transaction - Trace


[4/23/07 22:29:30:174 CDT] 0000001a ConnectionMan > allocateConnection in cm 765525853 Entry
[4/23/07 22:29:30:174 CDT] 0000001a ConnectionMan 3 This CM is [ConnectionManager]@2da0ff5d
JNDI Name <jdbc/snoop>
shareable <true>

[4/23/07 22:29:30:174 CDT] 0000001a ConnectionMan > allocateMCWrapper Entry


[4/23/07 22:29:30:174 CDT] 0000001a PoolManager > reserve Entry
[4/23/07 22:29:30:174 CDT] 0000001a PoolManager 3 input parms...
subject = null affinity = com.ibm.ws.Transaction.JTA.TransactionImpl@161c3f5e#tid=1
Shared connection = true
Force new MC = false
Connection Request Information =
com.ibm.ws.rsadapter.spi.WSConnectionRequestInfoImpl@1227bf5e

WebSphere Support Technical Exchange 46


IBM Software Group

getConnection User Transaction Trace (Contd)


extention DS properties = null
extention DS properties key = 0
useHetrogeneous = false
optimizeForGetUseCloseUsage = false
changable CRI = false
UserName = null
Password = null
Catalog = null
IsReadOnly = null
TypeMap = null
NoEnlist = false
ShareWithCMPOnly = false
Holdability = DEFAULT CURSOR HOLDABILITY VALUE (0)
ConfigID =0
Isolation = REPEATABLE READ (4)
Support isolation switching = true
Handle type = java.sql.Connection

WebSphere Support Technical Exchange 47


IBM Software Group

getConnection User Transaction Trace (Contd)


[4/23/07 22:29:30:174 CDT] 0000001a PoolManager 3 reserve(), Pool contents ==> PoolManager name:jdbc/snoop
PoolManager object:441057116
Total number of connections: 1 (max/min 10/1, reap/unused/aged 180/1800/0, connectiontimeout/purge 180/EntirePool)
(testConnection/inteval false/0, stuck timer/time/threshold 0/0/0, surge time/connections 0/-1)
Shared Connection information (shared partitions 200)
com.ibm.ws.Transaction.JTA.TransactionImpl@161c3f5e#tid=1 MCWrapper id 3bebff47 Managed connection
WSRdbManagedConnectionImpl@1c1e7f47 State:STATE_TRAN_WRAPPER_INUSE Thread Id: a8ebf42 Thread
Name: WebContainer : 0 Handle count 1
Total number of connection in shared pool: 1
Free Connection information (free distribution table/partitions 5/1)

No free connections

UnShared Connection information


No unshared connections

[4/23/07 22:29:30:174 CDT] 0000001a PoolManager 3 Searching for shared connection in partition 1
[4/23/07 22:29:30:174 CDT] 0000001a SharedPool > getSharedConnection Entry
[4/23/07 22:29:30:174 CDT] 0000001a SharedPool < getSharedConnection, returning mcWrapper Exit
MCWrapper id 3bebff47 Managed connection WSRdbManagedConnectionImpl@1c1e7f47
State:STATE_TRAN_WRAPPER_INUSE Thread Id: a8ebf42 Thread Name: WebContainer : 0 Handle count 1

WebSphere Support Technical Exchange 48


IBM Software Group

getConnection User Transaction Trace (Contd)


[4/23/07 22:29:30:174 CDT] 0000001a PoolManager 3 reserve()
PoolManager name:jdbc/snoop
PoolManager object:441057116
Total number of connections: 1 (max/min 10/1, reap/unused/aged 180/1800/0, connectiontimeout/purge
180/EntirePool)
(testConnection/inteval false/0, stuck timer/time/threshold 0/0/0, surge time/connections 0/-1)
Shared Connection information (shared partitions 200)
com.ibm.ws.Transaction.JTA.TransactionImpl@161c3f5e#tid=1 MCWrapper id 3bebff47 Managed connection
WSRdbManagedConnectionImpl@1c1e7f47 State:STATE_TRAN_WRAPPER_INUSE Thread Id: a8ebf42
Thread Name: WebContainer : 0 Handle count 1
Total number of connection in shared pool: 1
Free Connection information (free distribution table/partitions 5/1)
No free connections

UnShared Connection information


No unshared connections

RETURNS: MCWrapper id 3bebff47 Managed connection WSRdbManagedConnectionImpl@1c1e7f47


State:STATE_TRAN_WRAPPER_INUSE Thread Id: a8ebf42 Thread Name: WebContainer : 0 Handle
count 1

[4/23/07 22:29:30:174 CDT] 0000001a PoolManager 3 reserved managed connection


WSRdbManagedConnectionImpl@1c1e7f47
[4/23/07 22:29:30:174 CDT] 0000001a PoolManager < reserve Exit
[4/23/07 22:29:30:174 CDT] 0000001a ConnectionMan < allocateMCWrapper Exit
[4/23/07 22:29:30:174 CDT] 0000001a MCWrapper 3 involvedInTransaction: true
[4/23/07 22:29:30:174 CDT] 0000001a MCWrapper > getConnection Entry
[4/23/07 22:29:30:174 CDT] 0000001a MCWrapper < getConnection: Exit
com.ibm.ws.rsadapter.jdbc.WSJccSQLJConnection@77927f48
[4/23/07 22:29:30:174 CDT] 0000001a ConnectionMan < allocateConnection 77927f48 Exit

WebSphere Support Technical Exchange 49


IBM Software Group

Commit User Transaction

ds = (javax.sql.DataSource) ctx.lookup("jdbc/snoop");
Connection con1 = null ;
UserTransaction ut = ctx.lookup("java:comp/UserTransaction");
ut.begin();
con1 = ds.getConnection();
con1.close;

ut.commit();

WebSphere Support Technical Exchange 50


IBM Software Group

Commit User Transaction


[4/23/07 22:29:30:324 CDT] 0000001a LocalTransact > beforeCompletion Entry
[4/23/07 22:29:30:324 CDT] 0000001a LocalTransact < beforeCompletion Exit

[4/23/07 22:29:30:324 CDT] 0000001a LocalTransact > afterCompletion Entry


[4/23/07 22:29:30:324 CDT] 0000001a LocalTransact 3 Using transaction
wrapper@4d2e7f4e

[4/23/07 22:29:30:324 CDT] 0000001a LocalTransact 3 Releasing the connection


to the pool. shareable = true handleCount = 0 isStale = false

[4/23/07 22:29:30:324 CDT] 0000001a PoolManager > release Entry

[4/23/07 22:29:30:324 CDT] 0000001a PoolManager 3 input parms...


MC = MCWrapper id 147e7f4e Managed connection WSRdbManagedConnectionImpl@e98ff4e
State:STATE_ACTIVE_INUSE Thread Id: a8ebf42 Thread Name: WebContainer : 0 Handle count 0

input affinity = com.ibm.ws.Transaction.JTA.TransactionImpl@161c3f5e#tid=1

[4/23/07 22:29:30:324 CDT] 0000001a PoolManager 3 release(), Pool contents ==> PoolManager name:jdbc/snoop2
PoolManager object:940883806
Total number of connections: 1 (max/min 10/1, reap/unused/aged 180/1800/0, connectiontimeout/purge 180/EntirePool)
(testConnection/inteval false/0, stuck timer/time/threshold 0/0/0, surge time/connections 0/-1)
Shared Connection information (shared partitions 200)
com.ibm.ws.Transaction.JTA.TransactionImpl@161c3f5e#tid=1 MCWrapper id 147e7f4e Managed connection
WSRdbManagedConnectionImpl@e98ff4e State:STATE_ACTIVE_INUSE Thread Id: a8ebf42 Thread Name:
WebContainer : 0 Handle count 0
Total number of connection in shared pool: 1

WebSphere Support Technical Exchange 51


IBM Software Group

Commit User Transaction (Contd)

Free Connection information (free distribution table/partitions 5/1)

No free connections

UnShared Connection information


No unshared connections

[4/23/07 22:29:30:324 CDT] 0000001a SharedPool > removeSharedConnection Entry


[4/23/07 22:29:30:324 CDT] 0000001a SharedPool 3 Removed connection
[4/23/07 22:29:30:324 CDT] 0000001a SharedPool < removeSharedConnection Exit
[4/23/07 22:29:30:324 CDT] 0000001a FreePool > returnToFreePool, datasource:
jdbc/snoop2 Entry

WebSphere Support Technical Exchange 52


IBM Software Group

Commit User Transaction Trace (Contd)


[4/23/07 22:29:30:324 CDT] 0000001a MCWrapper > cleanup Entry
[4/23/07 22:29:30:324 CDT] 0000001a MCWrapper 3 InstanceOf DissociatableManagedConnection is
true In ConnectionManager MCWrapper id 147e7f4e Managed connection
WSRdbManagedConnectionImpl@e98ff4e State:STATE_ACTIVE_INUSE Thread Id: a8ebf42 Thread
Name: WebContainer : 0 Handle count 0
[4/23/07 22:29:30:324 CDT] 0000001a MCWrapper 3 Calling mc.dissociateConnections()
[4/23/07 22:29:30:324 CDT] 0000001a MCWrapper 3 Returned from mc.dissociateConnections()
[4/23/07 22:29:30:324 CDT] 0000001a MCWrapper < cleanup Exit
[4/23/07 22:29:30:324 CDT] 0000001a FreePool < returnToFreePool Exit
[4/23/07 22:29:30:324 CDT] 0000001a PoolManager 3 release(), Pool contents ==>
PoolManager name:jdbc/snoop2
PoolManager object:940883806
Total number of connections: 1 (max/min 10/1, reap/unused/aged 180/1800/0, connectiontimeout/purge
180/EntirePool)
(testConnection/inteval false/0, stuck timer/time/threshold 0/0/0, surge time/connections 0/-
1)
Shared Connection information (shared partitions 200)
No shared connections
Free Connection information (free distribution table/partitions 5/1)
(2)(0)MCWrapper id 147e7f4e Managed connection WSRdbManagedConnectionImpl@e98ff4e
State:STATE_ACTIVE_FREE
Total number of connection in free pool: 1
UnShared Connection information
No unshared connections
[4/23/07 22:29:30:324 CDT] 0000001a PoolManager 3 released managed connection
WSRdbManagedConnectionImpl@e98ff4e
[4/23/07 22:29:30:324 CDT] 0000001a PoolManager < release Exit
[4/23/07 22:29:30:324 CDT] 0000001a LocalTransact < afterCompletion Exit

WebSphere Support Technical Exchange 53


IBM Software Group

Commit User Transaction with Open Connection


Handle
ds = (javax.sql.DataSource) ctx.lookup("jdbc/snoop");
Connection con1 = null;
UserTransaction ut = null;
try {
ut = ctx.lookup("java:comp/UserTransaction");
ut.begin();
con1 = ds.getConnection();
ut.commit();
...

WebSphere Support Technical Exchange 54


IBM Software Group

Commit User Transaction with Open


Connection Handle - Trace
[4/24/07 13:36:16:175 CDT] 0000001a LocalTransact >
afterCompletion Entry
[4/24/07 13:36:16:175 CDT] 0000001a LocalTransact 3 Using
transaction wrapper@1dd67f47
[4/24/07 13:36:16:175 CDT] 0000001a LocalTransact 3 Information:
handle not closed at end of UOW. Connection from pool jdbc/snoop
[4/24/07 13:36:16:175 CDT] 0000001a LocalTransact 3 Releasing the
connection to the pool. shareable = true handleCount = 1
isStale = false
[4/24/07 13:36:16:175 CDT] 0000001a PoolManager > release Entry

WebSphere Support Technical Exchange 55


IBM Software Group

Connection Leak
 A connection leak occurs when the application uses a
connection, but it never explicitly calls the close() method on
the connection object to return the connection back to the
connection pool for reuse
 Connection is associated with a Transaction that is not
committed
 You might have a connection leak if your application
receives exceptions such as:
 com.ibm.websphere.ce.cm.ConnectionWaitTimeoutException
 com.ibm.websphere.ce.j2c.ConnectionWaitTimeoutException
 Enable ConnLeakLogic=all trace to gather information about
which application methods could potentially lead to leaking
connections (not closing connection) or holding on to
connections longer than expected

WebSphere Support Technical Exchange 56


IBM Software Group

Connection Leak Logic


Connection Leak Logic Information:
MCWrapper id 79f9ec6 Managed connection
com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl@71ff1ec6
State:STATE_TRAN_WRAPPER_INUSE Thread Id: 76109ed6 Thread Name: ORB.thread.pool : 1
Handle count 0
Start time inuse Thu Apr 12 08:15:19 CEST 2007 Time inuse 10 (seconds)
Last allocation time Thu Apr 12 08:15:28 CEST 2007

getConnection stack trace information:


at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:582)
at
com.ibm.ws.rsadapter.cci.WSRdbConnectionFactoryImpl.getConnection(WSRdbConnectionFactoryIm
pl.java:143)
at
com.ibm.ws.rsadapter.cci.WSRelationalRAAdapter.checkBackendId(WSRelationalRAAdapter.java:161
)
at com.ibm.ws.ejbpersistence.beanextensions.ConcreteBeanClassExtensionImpl.bind(Unknown
Source)
at
com.ibm.ws.ejbpersistence.beanextensions.ConcreteBeanClassExtensionImpl.checkBinding(Unknown
Source)
at
com.ibm.ws.ejbpersistence.beanextensions.ConcreteBeanStatefulInstanceExtensionImpl.setPMHomeI
nfo(Unknown Source)
at com.ibm.ejs.container.ContainerManaged2_0BeanO.<init>(ContainerManaged2_0BeanO.java:116)
at
com.ibm.ejs.container.ContainerManaged2_0BeanOFactory.create(ContainerManaged2_0BeanOFact
ory.java:42)

WebSphere Support Technical Exchange 57


IBM Software Group

Reference
 WebSphere Application Server V6: JCA Connection Problem Determination
http://www.redbooks.ibm.com/redpieces/pdfs/redp4080.pdf

 Connection sharing

http://www.ibm.com/developerworks/websphere/library/techarticles/0404_tang/0404_tan
g.html

 Connection Behavior

http://www.ibm.com/developerworks/websphere/library/techarticles/0506_johnsen/0506_
johnsen.html

WebSphere Support Technical Exchange 58


IBM Software Group

Additional WebSphere Product Resources


 Discover the latest trends in WebSphere Technology and implementation,
participate in technically-focused briefings, webcasts and podcasts at:
www.ibm.com/developerworks/websphere/community/
 Learn about other upcoming webcasts, conferences and events:
www.ibm.com/software/websphere/events_1.html
 Join the Global WebSphere User Group Community:
www.websphereusergroup.org
 Access key product show-me demos and tutorials by visiting IBM Education
Assistant: www.ibm.com/software/info/education/assistant
 Learn about the Electronic Service Request (ESR) tool for submitting
problems electronically:
www.ibm.com/software/support/viewlet/ESR_Overview_viewlet_swf.html
 Sign up to receive weekly technical My support emails:
www.ibm.com/software/support/einfo.html

WebSphere Support Technical Exchange 59


IBM Software Group

Questions and Answers

WebSphere Support Technical Exchange 60

Das könnte Ihnen auch gefallen