https://issues.apache.org/bugzilla/show_bug.cgi?id=49831
Summary: Issue with closing XAConnections on MSSQL
Product: Tomcat Modules
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: jdbc-pool
AssignedTo: [email protected]
ReportedBy: [email protected]
When using XAConnections with MSSQL it has been noticed that the physical
connections are not being closed when DataSourceProxy.close(boolean all) is
called. This method invokes
org.apache.tomcat.jdbc.pool.PooledConnection.disconnent() which calls
connection.close(). However, when used with SQLServer, the connection attribute
is a proxy object (type
com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolProxy) which wraps the
physical connection (of type com.microsoft.sqlserver.jdbc.SQLServerConnection).
Calling close() on the proxy object only notifies the pool manager that the
Connection is released back to the pool; it does not close the underlying
physical connection.
This is what the PooledConnection.disconnent() implementation currently reads:
private void disconnect(boolean finalize) {
if (isDiscarded()) {
return;
}
setDiscarded(true);
if (connection != null) {
try {
connection.close();
}catch (Exception ignore) {
if (log.isDebugEnabled()) {
log.debug("Unable to close underlying SQL connection",ignore);
}
}
}
connection = null;
xaConnection = null;
lastConnected = -1;
if (finalize) parent.finalize(this);
}
If the logic was changed to the following, it would properly closed the
XAConnection with the MSSQL.
private void disconnect(boolean finalize) {
if (isDiscarded()) {
return;
}
setDiscarded(true);
if (connection != null) {
try {
if (xaConnection != null) {
xaConnection.close();
} else {
connection.close();
}
}catch (Exception ignore) {
if (log.isDebugEnabled()) {
log.debug("Unable to close underlying SQL connection",ignore);
}
}
}
connection = null;
xaConnection = null;
lastConnected = -1;
if (finalize) parent.finalize(this);
}
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]