From 9ca87a5cf81454bd1ef1c76a251279bc3ba45fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Fern=C3=A1ndez=20Casta=C3=B1o?= Date: Mon, 23 Jan 2023 19:03:43 +0100 Subject: [PATCH 1/2] Add extra logging to PrioritizedThrottledTaskRunnerTests This should help debugging #92910 and rule out possible enviromental issues, such us slowness creating threads due to an overloaded CI worker. --- .../concurrent/PrioritizedThrottledTaskRunnerTests.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/src/test/java/org/elasticsearch/common/util/concurrent/PrioritizedThrottledTaskRunnerTests.java b/server/src/test/java/org/elasticsearch/common/util/concurrent/PrioritizedThrottledTaskRunnerTests.java index 0fd29e4ee303e..e2804f698b3d7 100644 --- a/server/src/test/java/org/elasticsearch/common/util/concurrent/PrioritizedThrottledTaskRunnerTests.java +++ b/server/src/test/java/org/elasticsearch/common/util/concurrent/PrioritizedThrottledTaskRunnerTests.java @@ -231,9 +231,14 @@ private int getRandomPriority() { } private void assertNoRunningTasks(PrioritizedThrottledTaskRunner taskRunner) { + logger.info("--> ensure that there are no running tasks in the executor"); final var barrier = new CyclicBarrier(maxThreads + 1); for (int i = 0; i < maxThreads; i++) { - executor.execute(() -> awaitBarrier(barrier)); + executor.execute(() -> { + logger.info("--> await until barrier is released"); + awaitBarrier(barrier); + logger.info("--> the barrier is released"); + }); } awaitBarrier(barrier); assertThat(taskRunner.runningTasks(), equalTo(0)); From 877b045ffb57ff45097f99b171d940b1b8ae1e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Fern=C3=A1ndez=20Casta=C3=B1o?= Date: Tue, 24 Jan 2023 08:56:19 +0100 Subject: [PATCH 2/2] Add max threads to logging --- .../util/concurrent/PrioritizedThrottledTaskRunnerTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/test/java/org/elasticsearch/common/util/concurrent/PrioritizedThrottledTaskRunnerTests.java b/server/src/test/java/org/elasticsearch/common/util/concurrent/PrioritizedThrottledTaskRunnerTests.java index e2804f698b3d7..58907436c9dad 100644 --- a/server/src/test/java/org/elasticsearch/common/util/concurrent/PrioritizedThrottledTaskRunnerTests.java +++ b/server/src/test/java/org/elasticsearch/common/util/concurrent/PrioritizedThrottledTaskRunnerTests.java @@ -231,7 +231,7 @@ private int getRandomPriority() { } private void assertNoRunningTasks(PrioritizedThrottledTaskRunner taskRunner) { - logger.info("--> ensure that there are no running tasks in the executor"); + logger.info("--> ensure that there are no running tasks in the executor. Max number of threads [{}]", maxThreads); final var barrier = new CyclicBarrier(maxThreads + 1); for (int i = 0; i < maxThreads; i++) { executor.execute(() -> {