Skip to content

Commit 97fefa6

Browse files
committed
PR comments
1 parent 0f1f95d commit 97fefa6

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

server/src/main/java/org/elasticsearch/common/util/concurrent/EsThreadPoolExecutor.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ public class EsThreadPoolExecutor extends ThreadPoolExecutor {
3131

3232
// noop probe to prevent starvation of work in the work queue due to ForceQueuePolicy
3333
// https://github.com/elastic/elasticsearch/issues/124667
34+
// note, this is intentionally not a lambda to avoid this ever be turned into a compile time constant
35+
// matching similar lambdas coming from other places
3436
static final Runnable WORKER_PROBE = new Runnable() {
3537
@Override
3638
public void run() {}

server/src/test/java/org/elasticsearch/common/util/concurrent/EsExecutorsTests.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,40 @@ public void testScalingWithEmptyCoreAndKeepAlive() {
786786
);
787787
}
788788

789+
public void testScalingWithEmptyCoreAndLargerMaxSize() {
790+
// TODO currently the reproduction of the starvation bug does not work if max pool size > 1
791+
// https://github.com/elastic/elasticsearch/issues/124867
792+
testScalingWithEmptyCore(
793+
EsExecutors.newScaling(
794+
getTestName(),
795+
0,
796+
between(2, 5),
797+
0,
798+
TimeUnit.MILLISECONDS,
799+
true,
800+
EsExecutors.daemonThreadFactory(getTestName()),
801+
threadContext
802+
)
803+
);
804+
}
805+
806+
public void testScalingWithEmptyCoreAndKeepAliveAndLargerMaxSize() {
807+
// TODO currently the reproduction of the starvation bug does not work if max pool size > 1
808+
// https://github.com/elastic/elasticsearch/issues/124867
809+
testScalingWithEmptyCore(
810+
EsExecutors.newScaling(
811+
getTestName(),
812+
0,
813+
between(2, 5),
814+
1,
815+
TimeUnit.MILLISECONDS,
816+
true,
817+
EsExecutors.daemonThreadFactory(getTestName()),
818+
threadContext
819+
)
820+
);
821+
}
822+
789823
public void testScalingWithEmptyCoreAndWorkerPoolProbing() {
790824
// https://github.com/elastic/elasticsearch/issues/124667 is difficult to reproduce if max pool size > 1.
791825
// if probing mitigates the bug for max pool size = 1, we're good for larger pool sizes as well.

0 commit comments

Comments
 (0)