Merge pull request #5732 from eclipse/jetty-10.0.x-5731-Pool-ArithmeticException

Fix ArithmeticException "/ by zero" in Pool.acquire()
This commit is contained in:
Ludovic Orban 2020-11-26 12:43:08 +01:00 committed by GitHub
commit df5622ecfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -249,6 +249,11 @@ public class Pool<T> implements AutoCloseable, Dumpable
{
LOGGER.trace("IGNORED", e);
size = entries.size();
// Size can be 0 when the pool is in the middle of
// acquiring a connection while another thread
// removes the last one from the pool.
if (size == 0)
break;
}
index = (index + 1) % size;
}