Skip to content

Commit

Permalink
[JBJCA-1445] Avoid deadlock when the connection is being destroyed on…
Browse files Browse the repository at this point in the history
… one element pool.
  • Loading branch information
Jacek Jarzab authored and Jacek Jarzab committed Jan 26, 2024
1 parent f8b5ed4 commit f724974
Showing 1 changed file with 9 additions and 2 deletions.
Expand Up @@ -573,7 +573,14 @@ else if (debug)
{
if (pool.getInternalStatistics().isEnabled())
pool.getInternalStatistics().deltaBlockingFailureCount();

synchronized (cls) {
if (cls.isEmpty()) {
if (debug) {
log.debug("Timeout trying acquire lock but cls is empty. Releasing the orphaned lock");
}
pool.getLock().release();
}
}
// We timed out
throw new ResourceException(
bundle.noMManagedConnectionsAvailableWithinConfiguredBlockingTimeout(
Expand Down Expand Up @@ -746,7 +753,7 @@ else if (debug)
cl.destroy();
}

if (releasePermit)
if (releasePermit || (clw != null && clw.hasPermit()))
{
pool.getLock().release();
}
Expand Down

0 comments on commit f724974

Please sign in to comment.