From f54fa7f411a8a0b7339e3b438c36164097609dde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Z=C3=B6chbauer?= Date: Fri, 3 Feb 2023 11:48:30 +0100 Subject: [PATCH] Issue #7650 - Fix race condition when stopping QueuedThreadPool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Dominik Zöchbauer --- .../org/eclipse/jetty/util/thread/QueuedThreadPool.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java index 9147f2b032d9..d1bd4153580e 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java @@ -280,9 +280,13 @@ protected void doStop() throws Exception } // Close any un-executed jobs - while (!_jobs.isEmpty()) + while (true) { Runnable job = _jobs.poll(); + if (job == null) + { + break; + } if (job instanceof Closeable) { try