elasticsearch/test/framework
Moritz Mack 76218fff09
[8.17] Prevent work starvation bug if using scaling EsThreadPoolExecutor with core pool size = 0 (#124732) (#125068)
When `ExecutorScalingQueue` rejects work to make the worker pool scale up while already being at max pool size (and a new worker consequently cannot be added), available workers might timeout just about at the same time as the task is then force queued by `ForceQueuePolicy`. This has caused starvation of work as observed for `masterService#updateTask` in #124667 where max pool size 1 is used. This configuration is most likely to expose the bug.

This PR changes `EsExecutors.newScaling` to not use `ExecutorScalingQueue` if max pool size is 1 (and core pool size is 0). A regular `LinkedTransferQueue` works perfectly fine in this case.

If max pool size > 1, a probing approach is used to ensure the worker pool is adequately scaled to at least 1 worker after force queueing work in `ForceQueuePolicy`.

Fixes #124667
Relates to #18613
2025-03-18 11:55:20 +01:00
..
src [8.17] Prevent work starvation bug if using scaling EsThreadPoolExecutor with core pool size = 0 (#124732) (#125068) 2025-03-18 11:55:20 +01:00
build.gradle Upgrade mockito (#121849) (#121933) 2025-02-07 05:53:09 +11:00