**Build scan:**
https://gradle-enterprise.elastic.co/s/ud4ggnomaa7p6/tests/:x-pack:plugin:ml:test/org.elasticsearch.xpack.ml.job.process.ProcessWorkerExecutorServiceTests/testAutodetectWorkerExecutorServiceDoesNotSwallowErrors
**Reproduction line:**
```
./gradlew ':x-pack:plugin:ml:test' --tests "org.elasticsearch.xpack.ml.job.process.ProcessWorkerExecutorServiceTests.testAutodetectWorkerExecutorServiceDoesNotSwallowErrors" -Dtests.seed=FCF6267296BD3EED -Dtests.locale=pl -Dtests.timezone=CST6CDT -Druntime.java=21
```

**Applicable branches:**
main

**Reproduces locally?:**
Yes

**Failure history:**
https://gradle-enterprise.elastic.co/scans/tests?tests.container=org.elasticsearch.xpack.ml.job.process.ProcessWorkerExecutorServiceTests&tests.test=testAutodetectWorkerExecutorServiceDoesNotSwallowErrors
**Failure excerpt:**
```
java.lang.Exception: Test abandoned because suite timeout was reached.

  at __randomizedtesting.SeedInfo.seed([FCF6267296BD3EED]:0)

```
x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/AbstractProcessWorkerExecutorService.java
private static final Logger logger = LogManager.getLogger(AbstractProcessWorkerExecutorService.class);
    protected final ThreadContext contextHolder;
    protected final String processName;
    private final CountDownLatch awaitTermination = new CountDownLatch(1);
    protected final BlockingQueue<T> queue;
    private final AtomicReference<Exception> error = new AtomicReference<>();
    private final AtomicBoolean running = new AtomicBoolean(true);
    private final AtomicBoolean shouldShutdownAfterCompletingWork = new AtomicBoolean(false);
    /**
     * @param contextHolder the thread context holder
     * @param processName the name of the process to be used in logging
     * @param queueCapacity the capacity of the queue holding operations. If an operation is added
     *                  for execution when the queue is full a 429 error is thrown.
     * @param queueSupplier BlockingQueue constructor
     */
    @SuppressForbidden(reason = "wraps a queue and handles errors appropriately")
    public AbstractProcessWorkerExecutorService(
        ThreadContext contextHolder,
        String processName,
        int queueCapacity,
        Function<Integer, BlockingQueue<T>> queueSupplier