We're experiencing a connection leak in a distributed transaction when the system is under heavy load. We're using commons-dbcp (latest version) + eclipselink and narayana to perform transaction coordination.
From time to time we can see a stacktrace reporting an abandoned connection. We are trying to figure out what's the root cause and we think that might be some issue in the commons dbcp (not sure) . More specifically, this parte of the code:
If the transactionContext is different than null but the state is not "active" (ex: STATUS_ROLLEDBACK, STATUS_ROLLING_BACK, etc) it executes the transactionComplete mothod that clears the reference to a shared connection and after that the connection is never closed (returned to the pool).
If we move the transactionComplete(); to an else,(see below), the connection leak does not happen.
After this the dbcp unit tests still pass but I'm not sure about this changes. Can you please check?