mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-19 20:57:27 -04:00
* Prevent work starvation bug if using scaling EsThreadPoolExecutor with core pool size = 0 (#124732)
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
(cherry picked from commit
|
||
---|---|---|
.. | ||
external-modules | ||
fixtures | ||
framework | ||
immutable-collections-patch | ||
logger-usage | ||
metadata-extractor | ||
test-clusters | ||
x-content | ||
yaml-rest-runner | ||
build.gradle |